14
14
*/
15
15
16
16
import {
17
- KmsKeyring ,
17
+ KmsKeyringClass ,
18
+ KeyRingConstructible , // eslint-disable-line no-unused-vars
18
19
KmsKeyringInput , // eslint-disable-line no-unused-vars
19
20
KMSConstructible , // eslint-disable-line no-unused-vars
20
21
KmsClientSupplier , // eslint-disable-line no-unused-vars
@@ -31,7 +32,7 @@ import {
31
32
EncryptedDataKey , // eslint-disable-line no-unused-vars
32
33
immutableClass ,
33
34
importCryptoKey ,
34
- WebCryptoKeyring
35
+ KeyringWebCrypto // eslint-disable-line no-unused-vars
35
36
} from '@aws-crypto/material-management-browser'
36
37
import { getWebCryptoBackend } from '@aws-crypto/web-crypto-backend'
37
38
import { KMS , KMSConfiguration } from '@aws-sdk/client-kms-browser' // eslint-disable-line no-unused-vars
@@ -43,14 +44,14 @@ export type KmsKeyringWebCryptoInput = Partial<KmsKeyringInput<KMS>>
43
44
export type KMSWebCryptoConstructible = KMSConstructible < KMS , KMSConfiguration >
44
45
export type KmsWebCryptoClientSupplier = KmsClientSupplier < KMS >
45
46
46
- export class KmsKeyringNode extends KmsKeyring < WebCryptoAlgorithmSuite , KMS > {
47
+ export class KmsKeyringBrowser extends KmsKeyringClass ( KeyringWebCrypto as KeyRingConstructible < WebCryptoAlgorithmSuite > ) {
47
48
constructor ( {
48
49
clientProvider = cacheKmsClients ,
49
- kmsKeys ,
50
- generatorKmsKey ,
50
+ keyIds ,
51
+ generatorKeyId ,
51
52
grantTokens
52
53
} : KmsKeyringWebCryptoInput = { } ) {
53
- super ( { clientProvider, kmsKeys , generatorKmsKey , grantTokens } )
54
+ super ( { clientProvider, keyIds , generatorKeyId , grantTokens } )
54
55
}
55
56
56
57
async _onEncrypt ( material : WebCryptoEncryptionMaterial , context ?: EncryptionContext ) {
@@ -88,12 +89,7 @@ export class KmsKeyringNode extends KmsKeyring<WebCryptoAlgorithmSuite, KMS> {
88
89
89
90
return _material . setCryptoKey ( cryptoKey , trace )
90
91
}
91
-
92
- [ Symbol . hasInstance ] ( obj : any ) {
93
- return obj instanceof WebCryptoKeyring ||
94
- Function . prototype [ Symbol . hasInstance ] . call ( this , obj )
95
- }
96
92
}
97
- immutableClass ( KmsKeyringNode )
93
+ immutableClass ( KmsKeyringBrowser )
98
94
99
95
export { getClient , cacheKmsClients , limitRegions , excludeRegions , cacheClients }
0 commit comments