// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { KmsKeyringClass, KmsKeyringInput, KMSConstructible, KmsClientSupplier, getClient, limitRegions, excludeRegions, cacheClients, AwsEsdkKMSInterface, } from '@aws-crypto/kms-keyring' import { immutableClass, KeyringNode, Newable, NodeAlgorithmSuite, } from '@aws-crypto/material-management-node' import { KMS, KMSClientConfig } from '@aws-sdk/client-kms' import { version } from './version' const getKmsClient = getClient(KMS, { customUserAgent: `AwsEncryptionSdkJavascriptNodejs/${version}`, }) const cacheKmsClients = cacheClients(getKmsClient) export type KmsKeyringNodeInput = Partial> export type KMSNodeConstructible = KMSConstructible export type KmsNodeClientSupplier = KmsClientSupplier export class KmsKeyringNode extends KmsKeyringClass< NodeAlgorithmSuite, AwsEsdkKMSInterface >(KeyringNode as Newable) { constructor({ clientProvider = cacheKmsClients, keyIds, generatorKeyId, grantTokens, discovery, discoveryFilter, }: KmsKeyringNodeInput = {}) { super({ clientProvider, keyIds, generatorKeyId, grantTokens, discovery, discoveryFilter, }) } } immutableClass(KmsKeyringNode) export { getKmsClient, cacheKmsClients, getClient, limitRegions, excludeRegions, cacheClients, KMS, }