@aomi/one-did-resolver

0.0.0-Alpha.2 • Public • Published

One Did Provider

提供自定义标识的DID

Installation

npm install @aomi/one-did-provider
// or
yarn add @aomi/one-did-provider

Providers

OneEd25519Provider

基于OneEd25519Provider封装的DID。

原ED25519 DID 结构

did:key:z${base58(publicKey)}

One ED25519 DID 结构

did:one:${base64(flag)}.z${base58(publicKey)}
import { OneEd25519Provider } from '@aomi/one-did-provider'
import KeyResolver from 'key-did-resolver'
import { DID } from 'dids'

const seed = new Uint8Array(...) //  32 bytes with high entropy
const provider = new OneEd25519Provider('master app',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)

// create JWE
const jwe = await did.createDagJWE({ very: 'secret' }, [did.id])

// decrypt JWE
const decrypted = await did.decryptDagJWE(jwe)

Readme

Keywords

none

Package Sidebar

Install

npm i @aomi/one-did-resolver

Weekly Downloads

3

Version

0.0.0-Alpha.2

License

MIT

Unpacked Size

12.2 kB

Total Files

24

Last publish

Collaborators

  • sean-tian
  • happysuns