Represents a cryptographic entity capable of signing messages and verifying signatures using the EdDSA scheme with Poseidon hash and the Baby Jubjub elliptic curve.

Constructors

  • Initializes a new instance, deriving necessary cryptographic parameters from the provided private key. If the private key is not passed as a parameter, a random 32-byte hexadecimal key is generated.

    The private key must be an instance of Buffer, Uint8Array or a string. The input will be used to generate entropy and there is no limit in size. The string is used as a set of raw bytes (in UTF-8) and is typically used to pass passwords or secret messages. If you want to pass a bigint, a number or a hexadecimal, be sure to convert them to one of the supported types first. The 'conversions' module in @zk-kit/utils provides a set of functions that may be useful in case you need to convert types.

    Parameters

    • privateKey: string | Uint8Array | Buffer = ...

      The private key used for signing and public key derivation.

    Returns EdDSAPoseidon

Properties

packedPublicKey: bigint
privateKey: string | Uint8Array | Buffer
publicKey: Point<bigint>
secretScalar: bigint

Methods

  • Verifies a signature against a message and the public key stored in this instance.

    Parameters

    • message: BigNumberish

      The message whose signature is to be verified.

    • signature: Signature

      The signature to be verified.

    Returns boolean

    True if the signature is valid for the message and public key, false otherwise.