跳到主要內容

Working with DIDs

Utility functions to create/inspect did, and do did-based auth, an implementation of abt-did-protocol

fromSecretKey(sk, type) ⇒ string

Gen DID from private key and type config

Spec: https://github.com/ArcBlock/ABT-DID-Protocol#create-did

Kind: static method Returnsstring - DID string Access: public

ParamTypeDescription
skstringhex encoded secret key string
typeobjectwallet type

fromPublicKey(pk, type) ⇒ string

Gen DID from public key and type config

Kind: static method Returnsstring - DID string Access: public

ParamTypeDescription
pkstringhex encoded public key
typeobjectwallet type

fromHash(hash, role) ⇒ string

Gen DID from an hex encoded hash and role type

Kind: static method Returnsstring - DID string Access: public

ParamTypeDescription
hashstringhex encoded hash
roleenumrole type

isFromPublicKey(did, pk) ⇒ boolean

Check if an DID is generated from a publicKey

Kind: static method Access: public

ParamTypeDescription
didstringstring of the did, usually base58btc format
pkstringhex encoded publicKey string

isValid(did) ⇒ boolean

Check if a DID string is valid

Kind: static method Access: public

ParamTypeDescription
didstringaddress string