Skip to content

Latest commit

 

History

History

core

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@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.provider] object Uri of IRI node.

Composes API object from it's components

core.registerIdentifier(seed, publicKeys)

Param Type Description
seed string The seed of the MAM channel.
publicKeys Array.<string> PEM-formatted public Keys.

Publish the DID document to the MAM channel with specific Tangle 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.