@tangle-js/ld-proofs
Version:
Linked Data Proofs on the Tangle. Powered by IOTA Identity & IOTA Streams
58 lines (57 loc) • 2.23 kB
TypeScript
/// <reference types="node" />
import type { IJsonDocument } from "./models/IJsonDocument";
import type { ILinkedDataSignature } from "./models/ILinkedDataSignature";
import type { ISigningOptions } from "./models/ISigningOptions";
import type { 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 did The DID that has the verification methods of the signer.
* @param node The node.
* @returns The newly created signer.
*/
static create(did: string, node?: string): Promise<IotaSigner>;
/**
* Signs a string message using the Ed25519 signature algorithm.
*
* @param message The message.
* @param options The signing options.
* @returns The signature details including its value encoded in Base58.
*/
sign(message: Buffer, options: ISigningOptions): Promise<ISigningResult>;
/**
* Signs a JSON(-LD) document.
*
* @param doc The JSON(-LD) document as an object or as a string.
* @param options The parameters to use to generate the signature.
* @returns The JSON document including its corresponding Linked Data Signature.
*/
signJson(doc: string | IJsonDocument, options: ISigningOptions): Promise<ILinkedDataSignature>;
/**
* Signs a JSON document.
*
* @param doc The JSON document as an object or as a string.
* @param options The parameters to use to generate the signature.
* @returns The JSON document including its corresponding Linked Data Signature.
*/
private doSignJson;
/**
* Signs a JSON-LD document.
*
* @param doc The JSON-LD document as an object or as a string.
* @param options The parameters to use to generate the signature.
* @returns The Linked Data Signature represented as a Linked Data Proof.
*/
private doSignJsonLd;
}