UNPKG

@jmcanterafonseca-iota/anchoring-channels

Version:

Powered by IOTA Streams, Anchor Channels is an easy to be used library that allows to anchor messages to the Tangle.

61 lines (60 loc) 2.29 kB
/// <reference types="node" /> import { ILinkedDataSignature } from "./models/ILinkedDataSignature"; import { ISigningResult } from "./models/ISigningResult"; /** * It allows to sign and verify messages using a Verification Method provided by a DID * * It generates and verifies EdDSA (Ed25519) signatures * */ export declare class IotaSigner { private readonly _did; private readonly _didDocument; private constructor(); get did(): string; /** * Creates a new signer associating it with a particular decentralized identity * * @param node The node * * @param did The DID that has the verification methods of the signer * * @returns The newly created signer */ static create(node: string, did: string): Promise<IotaSigner>; /** * * Signs a string message using the Ed25519 signature algorithm * * @param message The message * @param method The method used for signing (referred as a DID fragment identifier) * @param secret The secret * * @returns The signature details including its value encoded in Base58 * */ sign(message: Buffer, method: string, secret: string): Promise<ISigningResult>; /** * Signs a JSON document * * @param doc The JSON document as an object or as a string * @param verificationMethod Verification method * @param secret The secret * @param signatureType The type of signature to be generated * * @returns The JSON document including its corresponding Linked Data Signature */ signJson(doc: string | Record<string, unknown>, verificationMethod: string, secret: string, signatureType?: string): Promise<ILinkedDataSignature>; /** * Signs a JSON-LD document * * @param doc The JSON-LD document as an object or as a string * @param verificationMethod Verification method * @param secret The secret * @param signatureType The type of signature to be generated (by default 'Ed25519Signature2018') * * @returns The Linked Data Signature represented as a Linked Data Proof * */ signJsonLd(doc: string | Record<string, unknown>, verificationMethod: string, secret: string, signatureType?: string): Promise<ILinkedDataSignature>; }