DID Kit

DID Manager

The DID Manager SDK provides a set of methods for managing decentralized identifiers (DIDs) and interacting with the associated DID documents. This SDK enables developers to create issuer and subject profiles, resolve DIDs, delete DIDs, manage Verifiable Credential (VC) creation, and more.

Table of Contents

  • Create Issuer Profile

  • Create Subject Profile

  • Resolve DID

  • Delete Issuer DID

  • Delete Subject DID

  • List Issuer Profiles

  • List Subject Profiles

  • Create Verifiable Credential

  • List Verifiable Credentials

  • List VC Templates

Bootstrapping the SDK for DID kit

const krypcore_web3_sdk = require("@krypc/krypcore-web3-sdk");
const configFilePath = '../../config.json';
const Web3Engine = new krypcore_web3_sdk.Web3Engine(configFilePath);
const DidManagerService = new krypcore_web3_sdk.Services.DidManager(configFilePath);

SDK Methods

Create Issuer Profile

createIssuerProfile(name, greeting, designation, key)

Creates an issuer profile with the specified details.

Parameters

  • issuerName (string): The name of the issuer.

  • issuerDescription (string): The description of the issuer.

  • issuerDesignation (string): The designation of the issuer.

  • method (string): The did method type to create

Usage

const issuerProfileCreationStatus = await DidManagerService.createIssuerProfile("Bharathq", "Hello", "Desig", "key");
console.log(issuerProfileCreationStatus);

Create Subject Profile

createSubjectProfile(subjectId, subjectName, subjectDescription, method)

Creates a subject profile with the specified details.

Parameters

  • email (string): The email of the subject.

  • name (string): The name of the subject.

  • description (string): The description of the subject.

  • key (string): The key associated with the subject.

Usage

const subjectProfileCreationStatus = await DidManagerService.createSubjectProfile("nick@krypqc.com", "nick", "desc", "key");
console.log(subjectProfileCreationStatus);

Resolve DID

resolveDid(did)

Resolves the given DID to its associated DID document.

Parameters

  • did (string): The DID to resolve.

Usage

const resolveDidStatus = await DidManagerService.resolveDid("did:key:z6MkfUupa7JeZcjg44SH86vpHSFVSK3sVNtugwYH77bkJfrs");
console.log(resolveDidStatus);

Delete Issuer DID

deleteIssuerDid(did)

Deletes the specified issuer DID.

Parameters

  • did (string): The issuer DID to delete.

Usage

const deleteIssuerDidStatus = await DidManagerService.deleteIssuerDid("did:key:z6MkfUupa7JeZcjg44SH86vpHSFVSK3sVNtugwYH77bkJfrs");
console.log(deleteIssuerDidStatus);

Delete Subject DID

deleteSubjectDid(did)

Deletes the specified subject DID.

Parameters

  • did (string): The subject DID to delete.

Usage

const deleteSubjectDidStatus = await DidManagerService.deleteSubjectDid("did:key:z6MkfUupa7JeZcjg44SH86vpHSFVSK3sVNtugwYH77bkJfrs");
console.log(deleteSubjectDidStatus);

List Issuer Profiles

listIssuerProfiles(limit, page)

Lists the issuer profiles with pagination support.

Parameters

  • limit (number): The maximum number of profiles to return.

  • page (number): The page number to retrieve.

Usage

const issuerProfiles = await DidManagerService.listIssuerProfiles(5, 1);
console.log(issuerProfiles.Data);

List Subject Profiles

listSubjectProfiles(limit, page)

Lists the subject profiles with pagination support.

Parameters

  • limit (number): The maximum number of profiles to return.

  • page (number): The page number to retrieve.

Usage

const subjectProfiles = await DidManagerService.listSubjectProfiles(5, 1);
console.log(subjectProfiles.Data);

Create Verifiable Credential

createVC(issuerDid, subjectDid, proofType, template)

Creates a Verifiable Credential (VC) between the specified issuer and subject DIDs.

Parameters

  • issuerDid (string): The issuer DID.

  • subjectDid (string): The subject DID.

  • proofType (string): The proof type for the VC.

  • template (string): The VC template name.

Usage

const vcCreationStatus = await DidManagerService.createVC("did:key:z6MkhnAbbQsrPQGNyHDLNqjt5ywa9cQWwS7bmLzM7seCqtQ4", "did:key:z6MkiAXLfj9beATvYJLy7w2A9z9p63FWAGo7cV79yvQ4aCqd", "LD_PROOF", "StatusList2021Entry");
console.log(vcCreationStatus);

List Verifiable Credentials

listVC(limit, page)

Lists the Verifiable Credentials (VCs) with pagination support.

Parameters

  • limit (number): The maximum number of VCs to return.

  • page (number): The page number to retrieve.

Usage

const listVcStatus = await DidManagerService.listVC(5, 1);
console.log(listVcStatus.Data);

List VC Templates

listVCTemplates()

Lists the available Verifiable Credential (VC) templates.

Usage

const listVcTemplatesStatus = await DidManagerService.listVCTemplates();
console.log(listVcTemplatesStatus);

Make sure to replace the provided values with the appropriate ones for your application. If needed, refer to the KrypCore Web3 SDK documentation for more details on the parameters and usage of each method.

Please ensure that your environment is properly configured and that you have the necessary access tokens and dependencies in place.

Feel free to reach out if you have any further questions or need additional assistance.

Last updated