-
Notifications
You must be signed in to change notification settings - Fork 3
Verifiable Credentials Step By Step
Suhail Manzoor edited this page Dec 10, 2020
·
5 revisions
How identity is managed with Umqhele.
Firstly generate a ed25519 key-pair which can be found at Transmute DID Key:
import * as ed25519 from '@transmute/did-key-ed25519';
import crypto from 'crypto';
const seed = crypto.randomBytes(32).toString('hex');
let key = await Ed25519KeyPair.generate({
secureRandom: () => {
return Buffer.from(seed, 'hex');
},
});Then you generate a DID document using the key-pair generated above. In order to generate the document, you first have to install npm i @transmute/did-key-common@latest --save and then pass the key generated above to the keyToDidDoc function.
import crypto from 'crypto';
import * as ed25519 from '@transmute/did-key-ed25519';
import { keyToDidDoc } from '@transmute/did-key-common';
const seed = crypto.randomBytes(32).toString('hex');
let ed25519Key = await Ed25519KeyPair.generate({
secureRandom: () => {
return Buffer.from(seed, 'hex');
},
});
const diddoc = await keyToDidDoc(ed25519Key);