@didtools/key-webcrypto
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Webcrypto Key Did Provider

This is a DID Provider which implements EIP2844 for did:key: using webcrypto with non-extractable keys. Currently P-256 is supported.

Installation

npm install --save @didtools/key-webcrypto

Usage

import { WebcryptoProvider } from '@didtools/key-webcrypto'
import KeyResolver from 'key-did-resolver'
import { DID } from 'dids'

const keyPair = generateP256KeyPair()
const provider = new WebcryptoProvider(keypair)
const did = new DID({ provider, resolver: KeyResolver.getResolver() })
await did.authenticate()

// log the DID
console.log(did.id)

// create JWS
const { jws, linkedBlock } = await did.createDagJWS({ hello: 'world' })

// verify JWS
await did.verifyJWS(jws)

License

Apache-2.0 OR MIT

Package Sidebar

Install

npm i @didtools/key-webcrypto

Weekly Downloads

402

Version

0.2.0

License

(Apache-2.0 OR MIT)

Unpacked Size

9.79 kB

Total Files

4

Last publish

Collaborators

  • dav1do
  • dbcfd
  • cb3box
  • ukstv
  • jpham2023
  • oed
  • paul_lecam