This package contains an implementation of the AbstractIdentifierProvider
for the did:jwk
method.
Enabling creating and resolving of did:jwk
entities, conforming to the spec for DID-JWK
- createIdentifier
- deleteIdentifier
- resolveDidJwk
When creating a new Identifier you can choose to import your own keys or have them generated for you. You can also choose to use specific Key IDs for your key, regardless of generation or import. The options object when creating an identifier is as follows:
export interface KeyOpts {
key?: MinimalImportableKey // Optional key to import. If not specified a key with random kmsKeyRef will be created
type?: Key // The key type. Defaults to Secp256k1
use?: KeyUse // The key use
}
The example below generates a JWK DID with auto-generated keys.
const identifier: IIdentifier = await agent.didManagerCreate()
The example below generates a JWK DID using imported keys.
const identifier: IIdentifier = await agent.didManagerCreate({
key: {
privateKeyHex: '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6',
},
})
Deleting an identifier is straightforward:
const deleted: boolean = await agent.didManagerDelete({ did: identifier.did })
The example below resolves a did:jwk to DIDResolutionResult.
const didResolutionResult: DIDResolutionResult = await agent.resolveDid({ didUrl: 'did:jwk:ey....' })
yarn add @sphereon/ssi-sdk-ext.did-provider-jwk
yarn build