Skip to content

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

Notifications You must be signed in to change notification settings

alejandroalffer/hs-ssi-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published