Verifier API Reference

This document provides a concise API reference for the Verifier class within the Hedera DID SDK for JavaScript. This class is responsible for verifying signatures.

Class Diagram

The class diagram below illustrates the core methods of the Verifier interface for interacting with cryptographic keys.

verifier class diagram

Constructor

constructor

constructor(publicKey: PublicKey)

Initializes a new Verifier instance.

Parameters
  • publicKey: (Required) A public key class instance.

Static Methods

fromMultibase

static fromMultibase(multibase: string): Verifier

Initializes a new Verifier instance from a multibase-encoded public key.

Returns

The new Verifier instance.

fromBase58

static fromBase58(base58: string): Verifier

Initializes a new Verifier instance from a base58-encoded public key.

Returns

The new Verifier instance.

Methods

publicKey

publicKey(): string

Returns the public key associated with the Verifier instance in DER format.

Returns

The public key in DER format.

verify

verify(message: Uint8Array, signature: Uint8Array): boolean

Verifies the given signature against the message and public key.

Parameters
  • message: The message that was signed.

  • signature: The signature to be verified.

Returns

true if the signature is valid, false otherwise.

Errors

Exception code Description

invalidArgument

Invalid public key type. Expected ED25519.

Class Implementation

The Hashgraph DID SDK provides the Verifier class within its verifier-internal package. For further details, refer to the @hashgraph-did-sdk-js/verifier-internal package documentation.