@sphereon/did-resolver-jwk
TypeScript icon, indicating that this package has built-in type declarations

0.10.2-unstable.5 • Public • Published


Sphereon
Ssi-sdk-jwk-did-provider
(Typescript)

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

Available functions

  • createIdentifier
  • deleteIdentifier
  • resolveDidJwk

Usage

Creating an identifier

When creating a new Veramo 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 kid will be created
  type?: Key // The key type. Defaults to Secp256k1
  use?: KeyUse // The key use
}

Creating an Identifier using auto-generated keys

The example below generates a JWK DID with auto-generated keys.

const identifier: IIdentifier = await agent.didManagerCreate()

Creating an Identifier using imported keys

The example below generates a JWK DID using imported keys.

const identifier: IIdentifier = await agent.didManagerCreate({
  key: {
    privateKeyHex: '06eb9e64569203679b36f834a4d9725c989d32a7fb52c341eae3517b3aff8ee6',
  },
})

Removing the Identifier and DID

Deleting an identifier is straightforward:

const deleted: boolean = await agent.didManagerDelete({ did: identifier.did })

Resolving a DID

The example below resolves a did:jwk to DIDResolutionResult.

const didResolutionResult: DIDResolutionResult = await agent.resolveDid({ didUrl: 'did:jwk:ey....' })

Installation

yarn add @sphereon/ssi-sdk-did-provider-jwk

Build

yarn build

Readme

Keywords

Package Sidebar

Install

npm i @sphereon/did-resolver-jwk

Weekly Downloads

162

Version

0.10.2-unstable.5

License

Apache-2.0

Unpacked Size

30.8 kB

Total Files

18

Last publish

Collaborators

  • nklomp78
  • nklomp
  • spostma
  • bramtencate