Skip to content

Commit 0b1a025

Browse files
committed
update duvet anotations
1 parent 4d798b6 commit 0b1a025

10 files changed

+103
-150
lines changed

modules/branch-keystore-node/src/branch_keystore.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,6 @@ export class BranchKeyStoreNode implements IBranchKeyStoreNode {
279279
'MUST supply a string branch key id'
280280
)
281281

282-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#getactivebranchkey
283-
//# To get the active version for the branch key id from the keystore
284-
//# this operation MUST call AWS DDB `GetItem`
285-
//# using the `branch-key-id` as the Partition Key and `"branch:ACTIVE"` value as the Sort Key.
286282
return await this._getBranchKeyMaterials(
287283
branchKeyId,
288284
BRANCH_KEY_ACTIVE_TYPE
@@ -307,9 +303,6 @@ export class BranchKeyStoreNode implements IBranchKeyStoreNode {
307303
'MUST supply a string branch key version'
308304
)
309305

310-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#getbranchkeyversion
311-
//# To get a branch key from the keystore this operation MUST call AWS DDB `GetItem`
312-
//# using the `branch-key-id` as the Partition Key and "branch:version:" + `branchKeyVersion` value as the Sort Key.
313306
return await this._getBranchKeyMaterials(
314307
branchKeyId,
315308
BRANCH_KEY_TYPE_PREFIX + branchKeyVersion

modules/branch-keystore-node/src/branch_keystore_helpers.ts

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,22 @@ export async function getBranchKeyItem(
8888
* if there are additional fields within the response item that
8989
* don't follow the proper custom encryption context key naming convention
9090
*/
91-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#getactivebranchkey
91+
//= aws-encryption-sdk-specification/framework/key-store/dynamodb-key-storage.md#getencryptedactivebranchkey
9292
//# The AWS DDB response MUST contain the fields defined in the [branch keystore record format](#record-format).
93-
//# If the record does not contain the defined fields, this operation MUST fail.
9493
export function validateBranchKeyRecord(item: BranchKeyItem): BranchKeyRecord {
95-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#record-format
94+
//= aws-encryption-sdk-specification/framework/key-store/dynamodb-key-storage.md#record-format
9695
//# 1. `branch-key-id` : Unique identifier for a branch key; represented as [AWS DDB String](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes)
9796
needs(
9897
BRANCH_KEY_IDENTIFIER_FIELD in item &&
9998
typeof item[BRANCH_KEY_IDENTIFIER_FIELD] === 'string',
10099
`Branch keystore record does not contain a ${BRANCH_KEY_IDENTIFIER_FIELD} field of type string`
101100
)
102101

103-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#record-format
102+
//= aws-encryption-sdk-specification/framework/key-store/dynamodb-key-storage.md#record-format
104103
//# 1. `type` : One of the following; represented as [AWS DDB String](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes)
105-
//# - The string literal `"beacon:ACTIVE"`. Then `enc` is the wrapped beacon key.
106-
//# - The string `"branch:version:"` + `version`, where `version` is the Branch Key Version. Then `enc` is the wrapped branch key.
107-
//# - The string literal `"branch:ACTIVE"`. Then `enc` is the wrapped beacon key of the active version.
104+
//# - The string literal `"beacon:ACTIVE"`. Then `enc` is the wrapped beacon key.
105+
//# - The string `"branch:version:"` + `version`, where `version` is the Branch Key Version. Then `enc` is the wrapped branch key.
106+
//# - The string literal `"branch:ACTIVE"`. Then `enc` is the wrapped beacon key of the active version. Then
108107
needs(
109108
TYPE_FIELD in item &&
110109
typeof item[TYPE_FIELD] === 'string' &&
@@ -114,7 +113,7 @@ export function validateBranchKeyRecord(item: BranchKeyItem): BranchKeyRecord {
114113
`Branch keystore record does not contain a valid ${TYPE_FIELD} field of type string`
115114
)
116115

117-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#record-format
116+
//= aws-encryption-sdk-specification/framework/key-store/dynamodb-key-storage.md#record-format
118117
//# 1. `version` : Only exists if `type` is the string literal `"branch:ACTIVE"`.
119118
//# Then it is the Branch Key Version. represented as [AWS DDB String](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes)
120119
if (item[TYPE_FIELD] === BRANCH_KEY_ACTIVE_TYPE) {
@@ -125,23 +124,23 @@ export function validateBranchKeyRecord(item: BranchKeyItem): BranchKeyRecord {
125124
)
126125
}
127126

128-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#record-format
127+
//= aws-encryption-sdk-specification/framework/key-store/dynamodb-key-storage.md#record-format
129128
//# 1. `enc` : Encrypted version of the key;
130129
//# represented as [AWS DDB Binary](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes)
131130
needs(
132131
BRANCH_KEY_FIELD in item && item[BRANCH_KEY_FIELD] instanceof Uint8Array,
133132
`Branch keystore record does not contain ${BRANCH_KEY_FIELD} field of type Uint8Array`
134133
)
135134

136-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#record-format
135+
//= aws-encryption-sdk-specification/framework/key-store/dynamodb-key-storage.md#record-format
137136
//# 1. `kms-arn`: The AWS KMS Key ARN used to generate the `enc` value.
138137
//# represented as [AWS DDB String](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes)
139138
needs(
140139
KMS_FIELD in item && typeof item[KMS_FIELD] === 'string',
141140
`Branch keystore record does not contain ${KMS_FIELD} field of type string`
142141
)
143142

144-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#record-format
143+
//= aws-encryption-sdk-specification/framework/key-store/dynamodb-key-storage.md#record-format
145144
//# 1. `create-time`: Timestamp in ISO 8601 format in UTC, to microsecond precision.
146145
//# Represented as [AWS DDB String](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes)
147146
needs(
@@ -150,7 +149,7 @@ export function validateBranchKeyRecord(item: BranchKeyItem): BranchKeyRecord {
150149
`Branch keystore record does not contain ${KEY_CREATE_TIME_FIELD} field of type string`
151150
)
152151

153-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#record-format
152+
//= aws-encryption-sdk-specification/framework/key-store/dynamodb-key-storage.md#record-format
154153
//# 1. `hierarchy-version`: Version of the hierarchical keyring;
155154
//# represented as [AWS DDB Number](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes)
156155
needs(
@@ -159,9 +158,9 @@ export function validateBranchKeyRecord(item: BranchKeyItem): BranchKeyRecord {
159158
`Branch keystore record does not contain ${HIERARCHY_VERSION_FIELD} field of type number`
160159
)
161160

162-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#record-format
163-
//# A branch key record MAY include [custom encryption context](#custom-encryption-context) key-value pairs.
164-
//# These attributes should be prefixed with `aws-crypto-ec:` the same way they are for [AWS KMS encryption context](#encryption-context).
161+
//= aws-encryption-sdk-specification/framework/key-store/dynamodb-key-storage.md#record-format
162+
//# A branch key record MAY include [custom encryption context](../branch-key-store.md#custom-encryption-context) key-value pairs.
163+
//# These attributes should be prefixed with `aws-crypto-ec:` the same way they are for [AWS KMS encryption context](../branch-key-store.md#encryption-context).
165164
for (const field in item) {
166165
if (!POTENTIAL_BRANCH_KEY_RECORD_FIELDS.includes(field)) {
167166
needs(
@@ -189,7 +188,7 @@ export function constructAuthenticatedEncryptionContext(
189188
): EncryptionContext {
190189
//= aws-encryption-sdk-specification/framework/branch-key-store.md#encryption-context
191190
//# This section describes how the AWS KMS encryption context is built
192-
//# from the DynamoDB items that store the branch keys.
191+
//# from an [encrypted hierarchical key](./key-store/key-storage.md#encryptedhierarchicalkey).
193192

194193
//# The following encryption context keys are shared:
195194

@@ -203,8 +202,10 @@ export function constructAuthenticatedEncryptionContext(
203202
//# - MUST have a `hierarchy-version`
204203
//# - MUST NOT have a `enc` attribute
205204

206-
//# Any additionally attributes on the DynamoDB item
205+
//# Any additionally attributes in the EncryptionContext
206+
//# of the [encrypted hierarchical key](./key-store/key-storage.md#encryptedhierarchicalkey)
207207
//# MUST be added to the encryption context.
208+
//#
208209

209210
// the encryption context is a string to string map, so serialize the branch
210211
// key record to this form

modules/branch-keystore-node/test/branch_keystore.test.ts

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,6 @@ describe('Test Branch keystore', () => {
4848
describe('Test constructor', () => {
4949
const KMS_CONFIGURATION = new SrkCompatibilityKmsConfig(KEY_ARN)
5050

51-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#initialization
52-
//= type=test
53-
//# The following inputs MAY be specified to create a KeyStore:
54-
//# - [ID](#keystore-id)
55-
//# - [AWS KMS Grant Tokens](#aws-kms-grant-tokens)
56-
//# - [DynamoDb Client](#dynamodb-client)
57-
//# - [KMS Client](#kms-client)
58-
//# The following inputs MUST be specified to create a KeyStore:
59-
//# - [Table Name](#table-name)
60-
//# - [AWS KMS Configuration](#aws-kms-configuration)
61-
//# - [Logical KeyStore Name](#logical-keystore-name)
6251
const BRANCH_KEYSTORE = new BranchKeyStoreNode({
6352
ddbTableName: DDB_TABLE_NAME,
6453
logicalKeyStoreName: LOGICAL_KEYSTORE_NAME,
@@ -306,21 +295,6 @@ describe('Test Branch keystore', () => {
306295
}
307296
})
308297

309-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#dynamodb-client
310-
//= type=test
311-
//# The DynamoDb Client used to put and get keys from the backing DDB table.
312-
//# If the AWS KMS Configuration is KMS Key ARN or KMS MRKey ARN,
313-
//# and no DynamoDb Client is provided,
314-
//# a new DynamoDb Client MUST be created
315-
//# with the region of the supplied KMS ARN.
316-
//# If the AWS KMS Configuration is Discovery,
317-
//# and no DynamoDb Client is provided,
318-
//# a new DynamoDb Client MUST be created
319-
//# with the default configuration.
320-
//# If the AWS KMS Configuration is MRDiscovery,
321-
//# and no DynamoDb Client is provided,
322-
//# a new DynamoDb Client MUST be created
323-
//# with the region configured in the MRDiscovery.
324298
it('Postcondition: If unprovided, the DDB client is configured', async () => {
325299
for (const ddbClient of falseyValues) {
326300
const { ddbClient: client } = new BranchKeyStoreNode({
@@ -336,24 +310,6 @@ describe('Test Branch keystore', () => {
336310
}
337311
})
338312

339-
//= aws-encryption-sdk-specification/framework/branch-key-store.md#kms-client
340-
//= type=test
341-
//# The KMS Client used when wrapping and unwrapping keys.
342-
//# If the AWS KMS Configuration is KMS Key ARN or KMS MRKey ARN,
343-
//# and no KMS Client is provided,
344-
//# a new KMS Client MUST be created
345-
//# with the region of the supplied KMS ARN.
346-
//# If the AWS KMS Configuration is Discovery,
347-
//# and no KMS Client is provided,
348-
//# a new KMS Client MUST be created
349-
//# with the default configuration.
350-
//# If the AWS KMS Configuration is MRDiscovery,
351-
//# and no KMS Client is provided,
352-
//# a new KMS Client MUST be created
353-
//# with the region configured in the MRDiscovery.
354-
//# On initialization the KeyStore SHOULD
355-
//# append a user agent string to the AWS KMS SDK Client with
356-
//# the value `aws-kms-hierarchy`.
357313
it('Postcondition: If unprovided, the KMS client is configured', async () => {
358314
for (const kmsClient of falseyValues) {
359315
const { kmsClient: client } = new BranchKeyStoreNode({

0 commit comments

Comments
 (0)