Crypto KMS
    Preparing search index...

    Class KmsError

    Error raised by crypto-kms providers, carrying a stable KmsErrorCode.

    Branch on code rather than on the message text, which may change.

    try {
    await kms.decrypt(keyId, ciphertext, context);
    } catch (err) {
    if (err instanceof KmsError && err.code === "DECRYPTION_FAILED") {
    // wrong context or tampered ciphertext
    }
    throw err;
    }

    Hierarchy

    • Error
      • KmsError
    Index
    • Create a KMS error with a code, a message and the key it concerns.

      Parameters

      Returns KmsError

    name: "KmsError"

    Always "KmsError".

    Machine-readable reason.

    keyId: string | undefined

    The key the failing operation addressed, when there was one.