/vid-node-sdk

Java script sdk for creating and verifying dids, diddocs, verifiable credentials and verifiable presentations.

Primary LanguageTypeScript

Hypersign Self Soverign Identity (SSI) Js SDK

This sdk is an implementation of proposed DID framework by the W3C Credential Community Group

Building

npm i
npm run build
npm run test

Install

npm i hs-ssi-sdk --save

Usage

import HypersignSsiSDK from "hs-ssi-sdk";
const hsSdk = new HypersignSsiSDK(
  offlineSigner,
  "http://localhost:26657", // RPC
  "http://localhost:1317"  // REST Endpoint
);
await hsSdk.init();
const { did, schema, vc, vp } = hsSdk;

APIs

hsSdk.did

    generateKeys(params: { seed:string }): Promise<{ privateKeyMultibase: string, publicKeyMultibase: string }>;
    generate(params: { publicKeyMultibase: string }): string;
    register(params: { 
        didDocString: string , 
        privateKeyMultibase: string, 
        verificationMethodId: string 
    }): Promise<any>;
    resolve(params: { did: string }): Promise<any>;
    update(params: { 
        didDocString: string
        privateKeyMultibase: string
        verificationMethodId: string
        versionId: string 
    }): Promise<any>;
    deactivate(params: { 
        didDocString: string
        privateKeyMultibase: string
        verificationMethodId: string
        versionId: string 
    }): Promise<any>;

hsSdk.schema

  getSchema(params: {
    name: string;
    description?: string;
    author: string;
    fields?: Array<ISchemaFields>;
    additionalProperties: boolean;
  }): Schema;

  signSchema(params: {
    privateKey: string;
    schema: ISchemaProto;
  }): Promise<any>;

  registerSchema(params: {
    schema: Schema;
    signature: string;
    verificationMethodId: string;
  }): Promise<any>;

hsSdk.vc

  getCredential(params: {
    schemaId: string;
    subjectDid: string;
    issuerDid: string;
    expirationDate: string;
    fields: Object;
  }): Promise<IVerifiableCredential>;
  signCredential(params: {
    credential: IVerifiableCredential;
    issuerDid: string;
    privateKey: string;
  }): Promise<any>;
  verifyCredential(params: { 
    credential: IVerifiableCredential,
    issuerDid: string
  }): Promise<any>;

hsSdk.vp

  getPresentation(params: {
    verifiableCredential: IVerifiableCredential;
    holderDid: string;
  }): Promise<any>;
  signPresentation(params: {
    presentation: IVerifiablePresentation;
    holderDid: string;
    privateKey: string;
    challenge: string;
  }): Promise<any>;
  verifyPresentation(params: {
    signedPresentation: IVerifiablePresentation ,
    challenge: string,
    domain?: string,
    issuerDid: string,
    holderDid: string,
  }): Promise<any>;

Issue

This sdk is in highly under development. In case you find any bug, kindly report it ASAP. Thank You!