Is a javascript library for DID related operation (generate, sign, verify etc). It also provides APIs to store/update/retrive DID and DID Documents to/from the Hypersign DID Registry on the Hypersign Blockchain network easily.
npm i https://github.com/hypersign-protocol/hid-ssi-js-sdk --save
import { HypersignDID } from 'hs-ssi-sdk';
const hypersignDID = new HypersignDID();
// OR initialize by passing a namepace. Default 'testnet'
// More complex way to initialize this class can be found in this documentation later
const namespace = 'testnet';
const hypersignDID = new HypersignDID({ namespace });
sign(params: {
didDocument: object; // A DID Document to signed
privateKeyMultibase: string; // private key mulibase of type ED25519
challenge: string; // Random challenge
domain: string; // Domain name
did: string; // DID, if passed then DID will be resolved and `didDocument` parameter will not be used
verificationMethodId: string // Verification method identifier
}): Promise<ISignedDIDDocument>;
verify(params: {
didDocument: object; // Signed did documen
verificationMethodId: string; // The verification method
challenge: string; // Random challenge
domain?: string // The domain name
}): Promise<object>;
const hypersignDid = new HypersignDID({
offlineSigner, // OPTIONAL signer of type OfflineSigner
nodeRestEndpoint: 'https://api.jagrat.hypersign.id', // OPTIONAL RPC endpoint of the Hypersign blockchain, Default 'TEST'
nodeRpcEndpoint: 'https://rpc.jagrat.hypersign.id', // OPTIONAL REST endpoint of the Hypersign blockchain
namespace: 'testnet', // OPTIONAL namespace of did, Default ''
});
// OR Just initalize with offlineSigner
const hypersignDid = new HypersignDID({
offlineSigner
})
const result = await hypersignDID.update({
didDocument,
privateKeyMultibase,
verificationMethodId,
versionId, // VersionId when DID is registered on chain. See the didDocumentMetadata when DID resolves
});
const result = await hypersignDID.deactivate({
didDocument,
privateKeyMultibase,
verificationMethodId,
versionId, // VersionId when DID is registered on chain. See the didDocumentMetadata when DID resolves
});