Back to Linera Protocol

Class PrivateKeySigner

web/@linera/client/docs/classes/PrivateKeySigner.html

0.15.171.7 KB
Original Source
  • PrivateKeySigner

Class PrivateKeySigner

A signer implementation that holds the private key in memory.

⚠️ WARNING: This class is intended only for testing or development purposes. It stores the private key directly in memory, which makes it unsuitable for production environments due to security risks.

The PrivateKey signer uses an in-memory ethers.Wallet to sign messages following the EIP-191 scheme. It verifies that the provided owner matches the wallet address before signing.

Supports key creation from both a raw private key and a mnemonic phrase.

Implements

Index

Methods

containsKeysign

Methods

containsKey

containsKey(owner: string): Promise<boolean>

Checks whether the instance holds a key whose associated address matches the given EVM address.

Parameters

  • owner: string

The EVM address to check for.

Returns Promise<boolean>

A promise that resolves to true if the key exists and matches the given address, otherwise false.

sign

sign(owner: string, value: Uint8Array): Promise<string>

Signs a given value using the private key associated with the specified EVM address. The signing process must follow the EIP-191 standard.

Parameters

  • owner: string

The EVM address whose private key will be used to sign the value.

  • value: Uint8Array

The data to be signed, as a Uint8Array.

Returns Promise<string>

A promise that resolves to the EIP-191-compatible signature in hexadecimal string format.

Settings

Member Visibility

  • Protected
  • Inherited
  • External

ThemeOSLightDark

On This Page

Methods containsKeysign