Skip to content

Latest commit

 

History

History
81 lines (55 loc) · 1.88 KB

README.md

File metadata and controls

81 lines (55 loc) · 1.88 KB

Hypersign Self Soverign Identity (SSI) Js SDK

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

Building

git submodule update --init --recursive
cd libs/vc-js && npm i && cd -
npm i 
npm run build
npm run test

Usage

Install

npm i hs-ssi-sdk --save

Use

// import
import HypersignSsiSDK from 'hs-ssi-sdk';

// initialise
const hsSdk = new HypersignSsiSDK(
    { nodeUrl: "http://localhost:5000" } // Hypersign node url
); 

const { did, schema, credential } = hsSdk;

APIs

hsSdk.did

    didUrl: string;
    generateKeys(): object;
    getDidDocAndKeys(user: object): Promise<any>;
    getDid(options: IDIDOptions): Promise<any>;
    register(didDoc: object): Promise<any>;
    resolve(did: string): Promise<any>;
    verify(params: IParams): Promise<any>;
    sign(params: IParams): Promise<any>;

hsSdk.schema

    schemaUrl: string;
    generateSchema({ name, author, description, properties }: ISchema): Promise<ISchemaTemplate>;
    registerSchema(schema: ISchemaTemplate): Promise<any>;
    getSchema(options: {schemaId?: string, author?: string}): Promise<any>;

hsSdk.credential

    generateCredential(schemaUrl, params: { subjectDid, issuerDid, expirationDate, attributesMap: Object }): Promise<any>;
    signCredential(credential, issuerDid, privateKey): Promise<any>;
    verifyCredential(credential: object, issuerDid: string): Promise<any>;
    generatePresentation(verifiableCredential, holderDid): Promise<any> ;
    signPresentation(presentation, holderDid, privateKey, challenge): Promise<any> 
    verifyPresentation({ presentation, challenge, domain, issuerDid, holderDid }) : Promise<any>

Issue

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