A class representing a SealingKey which provides cryptographic sealing (encryption) and unsealing (decryption) capabilities.

Constructors

Properties

Methods

Constructors

  • Constructs a SealingKey instance with the given private and public keys.

    Parameters

    • privateKey: string

      The private key used for decryption.

    • publicKey: string

      The public key used for encryption.

    Returns SealingKey

    Throws

    Will throw an error if the provided keys lengths do not match the required lengths for private and public keys.

Properties

privateKey: string

The private key used for decryption.

publicKey: string

The public key used for encryption.

Methods

  • Unseals (decrypts) the provided ciphertext using the instance's private key.

    Parameters

    • ciphertext: string | Uint8Array

      The encrypted data to be decrypted.

    Returns bigint

    BigInt - The decrypted message as a bigint.

    Throws

    Will throw an error if the decryption process fails.

  • Seals (encrypts) the provided message for a receiver with the specified public key.

    Parameters

    • value: number | bigint

      The message to be encrypted.

    • publicKey: string

      The public key of the intended recipient.

    Returns string

    string - The encrypted message in hexadecimal format.

    Static

    Throws

    Will throw if the provided publicKey or value do not meet defined preconditions.