Key DID
Utility functions for did:key
DIDs.
Installation
npm install @didtools/key-did
Usage
Create a DID with an optional seed
import { createDID } from '@didtools/key-did'
const seed = // 32 bytes of entropy, Uint8Array
const did = createDID(seed)
// Authenticate with the provider
await did.authenticate()
Generate a random private key and create an authenticated DID
import { generatePrivateKey, getAuthenticatedDID } from '@didtools/key-did'
const randomKey = generatePrivateKey()
const did = await getAuthenticatedDID(randomKey)
Functions
createDID
▸ createDID(seed?
): DID
Parameters
Name | Type |
---|---|
seed? | Uint8Array |
Returns
DID
generatePrivateKey
▸ generatePrivateKey(): Uint8Array
Returns
Uint8Array
getAuthenticatedDID
▸ getAuthenticatedDID(seed
): Promise
<DID
>
Parameters
Name | Type |
---|---|
seed | Uint8Array |
Returns
Promise
<DID
>