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

Hierarchy (View Summary)

Constructors

Properties

extendedSecretKey: string
publicKey: PublicKey
secretKey: string

Methods

  • Signs a message using the key pair's secret key.

    Parameters

    • message: Uint8Array

      The message to be signed.

    Returns Signature

    The signature object containing the signature and the public key.

  • 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

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

    keyRandom.secretKey
    // returns [SECRET_KEY]