- Allow
fromKeyPair
to be called with only a key agreement key pair.
- Update
get()
andpublicKeyToDidDoc()
to supportkeyAgreement-only
DIDs.
- Add
use()
method that allows multibase-multikey headers and a multibase-multikey deserializer (which replacesverificationSuite
previously) to handle data using that header. - Add
fromKeyPair()
that generates the DID Document along with the corresponding key pairs from averificationKeyPair
.fromKeyPair()
also optionally takes akeyAgreementKeypair
param.
- BREAKING Renamed
createVerificationSuite()
tocreateFromMultibase()
which now no longer takes agenerate
param and is adapted to convert the legacy verification suites to provide proper.fromMultibase()
method.
- BREAKING:
DidKeyDriver
no longer takes averificationSuite
param in the constructor. - BREAKING:
generate()
method has now been replaced by a new methodfromKeyPair()
. This approach externalizes key pair generation to allow whatever parameters are necessary / possible (such as random bytes / seeds) to be provided in the key-pair-specific implementation. This also greatly reduces the complexity of this library and the need to import key pair libraries generally.
- Added ECDSA Multikey support. Exports
createVerificationSuite()
utility function that can be used to create averificationSuite
from a multikey library such as@digitalbazaar/ecdsa-multikey
when creating aDidKeyDriver
instance.
- BREAKING: Remove support for node <= 14.
- BREAKING: Convert to module (ESM).
- BREAKING: Require Node.js >=14.
- Update dependencies.
- Lint module.
- BREAKING: Update 2020 cryptosuites to use multicodec encoding for keys.
- Add backwards compatibility, allow returning the
did:key
document using theEd25519VerificationKey2018
andX25519KeyAgreementKey2019
suites.
- Add
didKeyDriver.publicKeyToDidDoc({keyPair})
method. (This used to be thekeyToDidDoc()
method, in<= v0.7.0
, removed in v1.0 and brought back by popular demand.)
- BREAKING: Rename npm package from
did-method-key
to@digitalbazaar/did-method-key
. - BREAKING: Return
{didDocument, keyPairs, methodFor}
fromgenerate()
. - BREAKING: Upgrade to
crypto-ld
v5.0 based key suites, update to useEd25519VerificationKey2020
andX25519KeyAgreementKey2020
crypto suites. - BREAKING: DID Document context changed from
'https://w3id.org/did/v0.11'
to the DID WG-publishedhttps://www.w3.org/ns/did/v1
, plus the contexts for theEd25519VerificationKey2020
andX25519KeyAgreementKey2020
crypto suites. See the "Example DID Document" section of the README. - BREAKING: Rename
computeKeyId()
->computeId()
. - Avoid mutation of ed25519 key passed into keyToDidDoc.
- Use underscores for utility functions.
- Add
methodFor
andpublicMethodFor
convenience functions. - BREAKING: Move the lru-cache to
did-io
'sCachedResolver
class. - BREAKING:
keyToDidDoc
driver method removed. (See Upgrading notes for alternatives.) - BREAKING: The
publicKey
property of the DID Document has been deprecated by the DID Data Model, and is now renamed toverificationMethod
.
1) Check for the changed generate()
return signature. The usage is now:
const {didDocument, keyPairs, methodFor} = await didKeyDriver.generate();
Note that keyPairs
is a js Map
instance containing the public/private key
pairs for both the signing key and the X25519 key agreement key.
And the methodFor
convenience function allows you to fetch a particular
public/private key pair for a given purpose. For example:
const {didDocument, keyPairs, methodFor} = await didKeyDriver.generate();
const authenticationKeyPair = methodFor({purpose: 'authentication'});
const keyAgreementKeyPair = methodFor({purpose: 'keyAgreement'});
2) Make sure to adjust your documentLoader
to handle the new contexts.
3) The keyToDidDoc
function has been renamed to publicKeyToDidDoc()
(as
of v1.1), and the return signature has changed.
// For example, if you have a key description object (such as that returned by
// a KMS system's "generate key" operation):
const publicKeyDescription = {
"@context": "https://w3id.org/security/suites/ed25519-2020/v1",
"id": "did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv",
"type": "Ed25519VerificationKey2020",
"controller": "did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv",
"publicKeyMultibase": "zFj5p9C2Sfqth6g6DEXtw5dWFqrtpFn4TCBBPJHGnwKzY"
};
const {didDocument} = await didKeyDriver.publicKeyToDidDoc({publicKeyDescription});
// Or, you can start with an `LDKeyPair` instance:
const keyPair = await Ed25529VerificationKey2020.generate();
const {didDocument} = await didKeyDriver.publicKeyToDidDoc({publicKeyDescription: keyPair});
Don't forget that you can use the didKeyDriver.publicMethodFor({purpose})
method to fetch a particular key, after creating the DID Document.
const keyAgreementKey = didKeyDriver.publicMethodFor({didDocument, purpose: 'keyAgreement'});
// Note that the resulting keyAgreementKey pair will only have the public key material, not private
- Add cache with option to configure its max size.
- BREAKING: Make
keyToDidDoc
asynchronous.
- Return public/private key pair from
generate()
, available ondidDoc.keys
.
- BREAKING: Use
x25519-key-pair
v2.0.0, changed fingerprint format for X25519 keys. - Use
crypto-ld
v0.3.7.
- Add
computeKeyId()
andmethod
to driver, to work withdid-io
downstream.
- Use x25519-key-pair@1.
driver.get()
can now also resolve individual keys.
- BREAKING: Undo previous change, using
https://w3id.org/did/v0.11
as@context
, apologies for the confusion.
- BREAKING: Now using
'https://www.w3.org/ns/did/v1'
as context.
- BREAKING: Fix - Use fingerprint hash fragment as key id.
-
Add core files.
-
See git history for changes previous to this release.