File tree 3 files changed +36
-0
lines changed
3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { EncryptionContext } from '@aws-crypto/material-management'
5
+
6
+ //= aws-encryption-sdk-specification/framework/aws-kms/aws-kms-hierarchical-keyring.md#branch-key-supplier
7
+ //# The Branch Key Supplier is an interface containing the GetBranchKeyId
8
+ //# operation. This operation MUST take in an encryption context as input, and
9
+ //# return a branch key id (string) as output.
10
+ export interface BranchKeyIdSupplier {
11
+ getBranchKeyId ( encryptionContext : EncryptionContext ) : string
12
+ }
Original file line number Diff line number Diff line change @@ -16,3 +16,4 @@ export * from './region_from_kms_key_arn'
16
16
export * from './kms_mrk_strict_multi_keyring'
17
17
export * from './kms_mrk_discovery_multi_keyring'
18
18
export { AwsEsdkKMSInterface } from './kms_types'
19
+ export * from './branch_key_id_supplier'
Original file line number Diff line number Diff line change
1
+ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { EncryptionContext } from '@aws-crypto/material-management'
5
+ import { BranchKeyIdSupplier } from '../src'
6
+ import { expect } from 'chai'
7
+
8
+ describe ( 'Branch key id supplier' , ( ) => {
9
+ //= aws-encryption-sdk-specification/framework/aws-kms/aws-kms-hierarchical-keyring.md#branch-key-supplier
10
+ //= type=test
11
+ //# The Branch Key Supplier is an interface containing the GetBranchKeyId
12
+ //# operation. This operation MUST take in an encryption context as input, and
13
+ //# return a branch key id (string) as output.
14
+ it ( 'Can implement the interface' , ( ) => {
15
+ class Example implements BranchKeyIdSupplier {
16
+ getBranchKeyId ( encryptionContext : EncryptionContext ) : string {
17
+ return '' in encryptionContext ? '' : ''
18
+ }
19
+ }
20
+
21
+ expect ( new Example ( ) . getBranchKeyId ( { } ) ) . to . equal ( '' )
22
+ } )
23
+ } )
You can’t perform that action at this time.
0 commit comments