Creates a new key source instance.
Note: The config may be empty/undefined when using ClassFactory. Configuration is typically loaded from the database and passed when retrieving keys.
Optionalconfig: EncryptionKeySourceConfigOptional configuration for the key source
Protected_Configuration passed during instantiation. Contains lookupValue and any source-specific additional config.
Cleans up the AWS KMS client.
Retrieves encryption key material from AWS KMS.
This method expects the lookupValue to contain a base64-encoded encrypted data key (ciphertext blob) that was encrypted using a KMS customer master key (CMK).
For envelope encryption pattern:
Base64-encoded encrypted data key
Optional_keyVersion: stringNot used for KMS (versioning handled by KMS)
Buffer containing the decrypted key material
Initializes the AWS KMS client.
Lazy-loads the AWS SDK to avoid requiring it when not used. Uses the default credential chain for authentication.
Checks if a key exists in AWS KMS.
Note: This only checks if the key ARN/alias format is valid. Actual key existence is verified on GetKey().
The KMS key ARN or alias
true if the lookup value appears to be a valid KMS key reference
Validates that the AWS KMS client is properly configured.
true if the client is initialized and region is configured
Validates that the AWS KMS key is accessible by attempting a decrypt operation.
For envelope encryption, this decrypts the data key blob and validates its length. Key material is decoded internally for validation only — never returned to the caller.
Optional_keyVersion: stringOptionalexpectedKeyLengthBytes: number
AWS KMS key source provider.
Retrieves encryption keys from AWS Key Management Service. The key material is stored encrypted in KMS and decrypted on retrieval.
Security Notes
Example