Javascript
Installation
Two versions of DIDKit can be installed via npm
, both under the organization "@spruceid":
didkit-wasm is packed to operate in the browser via wasm-pack.
didkit-wasm-node is packed to operate in Node.JS via wasm-pack.
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
Last updated
Was this helpful?