1.2.0 • Published 5 years ago

@tangleid/core v1.2.0

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

@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)

ParamTypeDefaultDescription
settingsobject{}Connection settings
params.providersobjectThe IRI node providers in differenct network.

Composes API object from it's components

core.registerIdentifier(network, seed, publicKeys)

ParamTypeDescription
networkstringThe network identitfer.
seedstringThe seed of the MAM channel.
publicKeysArray.<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)

ParamTypeDescription
didstringThe DID of DID document.

Fetch DID document by DID.

Returns: Promise.<object> - Promise object represents the DID Document.

core.signRsaSignature(document, publicKey, privateKeyPem)

ParamTypeDescription
documentobjectJSON-LD document to be signed.
publicKeyPublicKeyMetaPublic key metadata.
privateKeyPemstringPEM-formatted private key.

Sign JSON-LD document with RSA signature suite.

Returns: Promise.<object> - Promise object represents signed JSON-LD document.

core.verifyRsaSignature(document)

ParamTypeDescription
documentobjectJSON-LD document to be verify.

Verify JSON-LD document signature.

Returns: Promise.<boolean> - Promise object represents verification result.