Class: InternalEd25519Signer

An internal implementation of the Signer interface. This implementation uses the Ed25519 algorithm from the tweetnacl library.

This signer support cryptosuite: eddsa-jcs-2022.

Usage:

const signer = new InternalEd25519Signer(privateKey);
const securedDocument = await signer.sign(inputDocument, proofOptions);

Implements

  • Signer<EdDSAProofCreator, EdDSA_ALGORITHM>

Constructors

Constructor

new InternalEd25519Signer(privateKey): InternalEd25519Signer

Create a new Signer instance.

Parameters

======= privateKey

Uint8Array

The private key in Uint8Array format.

Returns

InternalEd25519Signer

Methods

canSign()

canSign(proofType): boolean

Checks if the signer can sign with the given proof type.

Parameters

======= proofType

string

The proof type to check.

Returns

boolean

True if the signer can sign the given proof type, false otherwise.

Implementation of

Signer.canSign


sign()

sign<InputDocument, ProofOptions>(inputDocument, proofOptions): Promise<SecuredDataDocument<InputDocument>>

Sign a message or any other data.

Type Parameters

======= InputDocument

InputDocument extends InputDocument

======= ProofOptions

ProofOptions extends EdDSAProofOptions

Parameters

======= inputDocument

InputDocument

The input document to sign.

======= proofOptions

ProofOptions

The proof options.

Returns

Promise<SecuredDataDocument<InputDocument>>

The signature.

Implementation of

Signer.sign


signSigningRequest()

signSigningRequest<SigningRequest>(signingRequest): Proof

Signs a signing request with a cryptosuite.

Type Parameters

======= SigningRequest

SigningRequest extends ProofSigningRequest<EdDSA_ALGORITHM>

Parameters

======= signingRequest

SigningRequest

The signing request to sign.

Returns

Proof

The proof.

Implementation of

Signer.signSigningRequest