@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.
Identitier | Network |
---|---|
0x1 | Tangle Mainnet |
0x2 | Tangle Devnet |
API Reference
did~encodeToDid(params)
Link: https://w3c-ccg.github.io/did-spec/#the-generic-did-scheme DID Document}.
Param | Type | Description |
---|---|---|
params | object |
Encode parameters. |
params.network | string |
Network identifier. |
params.address | string |
Address in 81-trytes format. |
Encode TangleID DID with specific network and address.
Returns: string
- TangleID which follow the DID scheme
did~decodeFromDid(tangleid)
Param | Type | Description |
---|---|---|
tangleid | string |
TangleID 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)
Param | Type | Description |
---|---|---|
url | string |
the 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)
Param | Type | Description |
---|---|---|
url | string |
the 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)
Param | Type | Description |
---|---|---|
controller | string |
DID of the controller. |
publicKeyPems | Array.<string> |
PEM-formatted public Keys. |
Create metadata of public keys from PEM-formatted public Keys.
Returns: Array.<Object>
- Public keys