HashiCorp Vault Signer API Reference

This document provides a concise API reference for the Vault Signer class within the Hedera DID SDK for JavaScript. This class is responsible for signing data, and verifying signatures using HashiCorp Vault as the key store.

Class Diagram

The class diagram below illustrates the core methods of the Vault Signer interface for interacting with cryptographic keys stored in HashiCorp Vault.

vault signer class diagram

Constructor

constructor

constructor(options: SignerOptions)

Initializes a new Signer instance.

Parameters
  • options: (Required) An object containing the necessary options to create a Signer instance (refer to SignerOptions Type for details).

Methods

publicKey

publicKey(): string

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

Returns

The public key in DER format.

sign

sign(message: Uint8Array): Uint8Array

Signs the given message using the private key stored in HashiCorp Vault and returns the signature.

Parameters
  • message: The message to be signed.

Returns

The signature of the message.

verify

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

Verifies the given signature using the public key stored in HashiCorp Vault.

Parameters
  • message: The message that was signed.

  • signature: The signature to be verified.

Returns

true if the signature is valid, false otherwise.

Data Types

This section elaborates on the data types employed within the Signer class.

SignerOptions Type

The SignerOptions type is an object that contains the necessary options to create a Signer instance.

Name Type Description

clientApi

VaultApi

An internal API object that interacts with HashiCorp Vault.

keyName

string

A unique identifier for the key stored in HashiCorp Vault.

Errors

Exception code Description

internalError

When a Vault API call fails. Message contains the error details.

Class Implementation

The Hashgraph DID SDK provides the Vault Signer class within its signer-hashicorp-vault package. For further details, refer to the @hashgraph-did-sdk-js/signer-hashicorp-vault package documentation.