Links

Javascript

Installation

Two versions of DIDKit can be installed via npm, both under the organization "@spruceid":
For example: npm install @spruceid/didkit-wasm.

Example

// Import the module
const DIDKit = require('@spruceid/didkit');
​
console.log(DIDKit.getVersion());
​
// To issue credentials and presentations, you need a key.
// The library provides a function to generate one.
const key = DIDKit.generateEd25519Key();
​
// There are two helpful functions to obtain a DID and the `did:key`
// `verificationMethod` from the key.
const did = DIDKit.keyToDID('key', key);
const verificationMethod = DIDKit.keyToVerificationMethod('key', key);

Examples

Components
Example
Web Application, dApp
​JS Code​
Node.js, API Service
​JS Code​