digitalbazaar / did-method-key

A did-io driver for the DID "key" method
Other
25 stars 10 forks source link

Add methodFor convenience function to generate() return. #36

Closed dmitrizagidulin closed 3 years ago

dmitrizagidulin commented 3 years ago

Adds a methodFor convenience function (as a replacement for the did:key-specific verificationKeyPair and keyAgreementKeyPair return properties), based on conversation with @mattcollier and @dlongley.

Usage:

const {didDocument, keyPairs, methodFor} = await didKeyDriver.generate();

// For signing Verifiable Credentials
const verificationKeyPair = methodFor({purpose: 'assertionMethod'});
// For Authorization Capabilities (zCaps)
const invocationKeyPair = methodFor({purpose: 'capabilityInvocation'});
// For Encryption using `@digitalbazaar/minimal-cipher`
const keyAgreementPair = methodFor({purpose: 'keyAgreement'});