1.2.0 • Published 5 years ago

@tangleid/did v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@tangleid/did

Utilities for the coding of decentralized identifiers.

Installation

Install using npm:

npm install @tangleid/did

or using yarn:

yarn add @tangleid/did

Network Identifiers

Used to describe which Tangle network interacts.

IdentitierNetwork
0x1Tangle Mainnet
0x2Tangle Devnet

API Reference

did~encodeToDid(params)

Link: https://w3c-ccg.github.io/did-spec/#the-generic-did-scheme DID Document}.

ParamTypeDescription
paramsobjectEncode parameters.
params.networkstringNetwork identifier.
params.addressstringAddress in 81-trytes format.

Encode TangleID DID with specific network and address.

Returns: string - TangleID which follow the DID scheme

did~decodeFromDid(tangleid)

ParamTypeDescription
tangleidstringTangleID which follow the DID scheme DID Document.

Decode infromation of network and address from TangleID.

Returns: Object - } The infromation of network and address.

did~isDidUrl(url)

ParamTypeDescription
urlstringthe URL to be checked.

Checks if given URL is a DID URL.

Returns: boolean - The boolean that represent the url whether DID URL.

did~decodeFromDidUrl(url)

ParamTypeDescription
urlstringthe DID URL that will be decoded.

Decode information of the DID URL.

Returns: Object - The information of the DID URL. https://w3c-ccg.github.io/did-spec/#generic-did-syntax

did~createMetaPublicKeys(controller, publicKeyPems)

ParamTypeDescription
controllerstringDID of the controller.
publicKeyPemsArray.<string>PEM-formatted public Keys.

Create metadata of public keys from PEM-formatted public Keys.

Returns: Array.<Object> - Public keys