@tangleid/core
v1.2.0
Published
Core functionality to interact with TangleID
Downloads
3
Readme
@tangleid/core
Core functionality to interact with TangleID. Includes methods for:
- Registering and resolving identifier
- Signing JSON-LD document
- Verifying JSON-LD document signature
Installation
Install using npm:
npm install @tangleid/core
or using yarn:
yarn add @tangleid/core
API Reference
core.composeAPI([settings])
| Param | Type | Default | Description | | --- | --- | --- | --- | | [settings] | object | {} | Connection settings | | [params.providers] | object | | The IRI node providers in differenct network. |
Composes API object from it's components
core.registerIdentifier(network, seed, publicKeys)
| Param | Type | Description | | --- | --- | --- | | network | string | The network identitfer. | | seed | string | The seed of the MAM channel. | | publicKeys | Array.<string> | PEM-formatted public Keys. |
Publish the DID document to the Tangle MAM channel with specific network.
Returns: Promise.<object> - Promise object represents the result. The result
conatains DID did
and DID document document
.
core.resolveIdentifier(did)
| Param | Type | Description | | --- | --- | --- | | did | string | The DID of DID document. |
Fetch DID document by DID.
Returns: Promise.<object> - Promise object represents the
DID Document.
core.signRsaSignature(document, publicKey, privateKeyPem)
| Param | Type | Description | | --- | --- | --- | | document | object | JSON-LD document to be signed. | | publicKey | PublicKeyMeta | Public key metadata. | | privateKeyPem | string | PEM-formatted private key. |
Sign JSON-LD document with RSA signature suite.
Returns: Promise.<object> - Promise object represents signed JSON-LD document.
core.verifyRsaSignature(document)
| Param | Type | Description | | --- | --- | --- | | document | object | JSON-LD document to be verify. |
Verify JSON-LD document signature.
Returns: Promise.<boolean> - Promise object represents verification result.