This class provides key pair functionality for Ed25519 curve: generating key pairs, encoding key pairs, signing and verifying.

Hierarchy (view full)

Constructors

Properties

extendedSecretKey: string
publicKey: PublicKey
secretKey: string

Methods

  • Verifies the signature of a message using the key pair's public key.

    Parameters

    • message: Uint8Array

      The message to be verified.

    • signature: Uint8Array

      The signature to be verified.

    Returns boolean

    true if the signature is valid, otherwise false.

  • Generate a new random keypair.

    Returns KeyPairEd25519

    Example

    const keyRandom = KeyPair.fromRandom();
    keyRandom.publicKey
    // returns [PUBLIC_KEY]

    keyRandom.secretKey
    // returns [SECRET_KEY]