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

0.3.2 • Public • Published

secp256k1 Key Did Provider

This is a DID Provider which implements EIP2844 for did:key: using secp256k1.

Installation

npm install --save @didtools/key-secp256k1

Usage

import { Secp256k1Provider } from '@didtools/key-secp256k1'
import KeyResolver from 'key-did-resolver'
import { DID } from 'dids'

const seed = new Uint8Array(...) //  32 bytes with high entropy
const provider = new Secp256k1Provider(seed)
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-secp256k1

Weekly Downloads

12

Version

0.3.2

License

(Apache-2.0 OR MIT)

Unpacked Size

7.73 kB

Total Files

4

Last publish

Collaborators

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