Represents a Crypto class that provides encryption and decryption functionality using AWS KMS.

Constructors

Methods

Constructors

  • Constructs a new instance of a KeyManager with the provided region, keyId, and optional encryption algorithm.

    Parameters

    • region: string

      The region where the key is stored.

    • keyId: string

      The ID of the key.

    • OptionaloptEncryptionAlgorithm: EncryptionAlgorithmSpec

      The encryption algorithm to use (default is RSAES_OAEP_SHA_256).

    Returns default

    None

Methods

  • Decrypts the given data using the RSAES_OAEP_SHA_256 encryption algorithm.

    Parameters

    • data: string

      The encrypted data to decrypt.

    Returns Promise<null | string>

    • A promise that resolves to the decrypted plaintext string. If decryption fails, null is returned.
  • Encrypts the given data using RSAES_OAEP_SHA_256 encryption algorithm.

    Parameters

    • data: any

      The data to be encrypted.

    Returns Promise<null | string>

    • A promise that resolves to the encrypted data as a hexadecimal string.