Giter VIP home page Giter VIP logo

hid-ssi-js-sdk's Introduction

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!

hid-ssi-js-sdk's People

Contributors

vishwas1 avatar arnabghose997 avatar pratap2018 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.