14
14
*/
15
15
16
16
import { KmsClientSupplier } from './kms_client_supplier' // eslint-disable-line no-unused-vars
17
- import { needs , Keyring , EncryptionMaterial , DecryptionMaterial , SupportedAlgorithmSuites , EncryptionContext , KeyringTrace , KeyringTraceFlag , EncryptedDataKey , immutableClass } from '@aws-crypto/material-management' // eslint-disable-line no-unused-vars
17
+ import {
18
+ needs ,
19
+ Keyring ,
20
+ EncryptionMaterial , // eslint-disable-line no-unused-vars
21
+ DecryptionMaterial , // eslint-disable-line no-unused-vars
22
+ SupportedAlgorithmSuites , // eslint-disable-line no-unused-vars
23
+ EncryptionContext , // eslint-disable-line no-unused-vars
24
+ KeyringTrace , // eslint-disable-line no-unused-vars
25
+ KeyringTraceFlag ,
26
+ EncryptedDataKey , // eslint-disable-line no-unused-vars
27
+ immutableClass ,
28
+ readOnlyProperty
29
+ } from '@aws-crypto/material-management'
18
30
import { KMS_PROVIDER_ID , generateDataKey , encrypt , decrypt , kms2EncryptedDataKey } from './helpers'
19
31
import { KMS } from './kms_types/KMS' // eslint-disable-line no-unused-vars
20
32
import { DecryptOutput } from './kms_types/DecryptOutput' // eslint-disable-line no-unused-vars
@@ -28,9 +40,9 @@ export interface KmsKeyringInput<Client extends KMS> {
28
40
}
29
41
30
42
export abstract class KmsKeyring < S extends SupportedAlgorithmSuites , Client extends KMS > extends Keyring < S > {
31
- public kmsKeys : string [ ] = [ ]
43
+ public kmsKeys ! : string [ ]
32
44
public generatorKmsKey ?: string
33
- public clientProvider : KmsClientSupplier < Client >
45
+ public clientProvider ! : KmsClientSupplier < Client >
34
46
public grantTokens ?: string
35
47
36
48
constructor ( { clientProvider, generatorKmsKey, kmsKeys = [ ] , grantTokens } : KmsKeyringInput < Client > ) {
@@ -41,10 +53,10 @@ export abstract class KmsKeyring<S extends SupportedAlgorithmSuites, Client exte
41
53
/* Precondition: clientProvider needs to be a callable function. */
42
54
needs ( typeof clientProvider === 'function' , '' )
43
55
44
- this . clientProvider = clientProvider
45
- this . kmsKeys = kmsKeys
46
- this . generatorKmsKey = generatorKmsKey
47
- this . grantTokens = grantTokens
56
+ readOnlyProperty ( this , ' clientProvider' , clientProvider )
57
+ readOnlyProperty ( this , ' kmsKeys' , kmsKeys )
58
+ readOnlyProperty ( this , ' generatorKmsKey' , generatorKmsKey )
59
+ readOnlyProperty ( this , ' grantTokens' , grantTokens )
48
60
}
49
61
50
62
/* Keyrings *must* preserve the order of EDK's. The generatorKmsKey is the first on this list. */
0 commit comments