Skip to content

Commit bf93ce4

Browse files
committed
lint
1 parent 428e172 commit bf93ce4

10 files changed

+42
-36
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ export class BranchKeyStoreNode implements IBranchKeyStoreNode {
393393
//# by calling [GetKeyStorageInfo](./key-store/key-storage.md#getkeystorageinfo).
394394
keystoreTableName: this.storage.getKeyStorageInfo().name,
395395
logicalKeyStoreName: this.logicalKeyStoreName,
396-
grantTokens: !!this.grantTokens ? this.grantTokens.slice() : [],
396+
grantTokens: this.grantTokens ? this.grantTokens.slice() : [],
397397
kmsConfiguration: this.kmsConfiguration._config,
398398
}
399399
}

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ describe('Test Branch keystore', () => {
102102
logicalKeyStoreName: LOGICAL_KEYSTORE_NAME,
103103
kmsConfiguration: kmsConfiguration as any,
104104
})
105-
).to.throw(/Unexpected config shape|Config must be a `discovery` or an object./)
105+
).to.throw(
106+
/Unexpected config shape|Config must be a `discovery` or an object./
107+
)
106108
}
107109
})
108110

@@ -193,7 +195,7 @@ describe('Test Branch keystore', () => {
193195
return new BranchKeyStoreNode({
194196
storage: { ddbTableName: DDB_TABLE_NAME, ddbClient },
195197
logicalKeyStoreName: LOGICAL_KEYSTORE_NAME,
196-
kmsConfiguration: { identifier: KEY_ID},
198+
kmsConfiguration: { identifier: KEY_ID },
197199
keyManagement: { kmsClient },
198200
})
199201
}).to.throw(

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export const WELL_FORMED_MRK_ALIAS_ARN =
2525
'arn:aws:kms:us-west-2:123456789012:alias/mrk/my-mrk-alias'
2626

2727
describe('Test KmsKeyConfig class', () => {
28-
2928
it('Precondition: config must be a string or object', () => {
3029
for (const config of [null, undefined, 0]) {
3130
expect(() => supplySrkKmsConfig(config as any)).to.throw(
@@ -35,10 +34,10 @@ describe('Test KmsKeyConfig class', () => {
3534
})
3635
it('Precondition: ARN must be a string', () => {
3736
for (const arn of [null, undefined, 0, {}]) {
38-
expect(() => supplySrkKmsConfig({identifier: arn} as any)).to.throw(
37+
expect(() => supplySrkKmsConfig({ identifier: arn } as any)).to.throw(
3938
'ARN must be a string'
4039
)
41-
expect(() => supplySrkKmsConfig({mrkIdentifier: arn} as any)).to.throw(
40+
expect(() => supplySrkKmsConfig({ mrkIdentifier: arn } as any)).to.throw(
4241
'ARN must be a string'
4342
)
4443
}

modules/caching-materials-manager-node/src/caching_materials_manager_node.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ export class NodeCachingMaterialsManager
7070
//= aws-encryption-sdk-specification/framework/aws-kms/aws-kms-hierarchical-keyring.md#appendix-a-cache-entry-identifier-formulas
7171
//# When accessing the underlying cryptographic materials cache,
7272
//# the hierarchical keyring MUST use the formulas specified in this appendix
73-
//# in order to compute the [cache entry identifier](../cryptographic-materials-cache.md#cache-identifier).
73+
//# in order to compute the [cache entry identifier](../cryptographic-materials-cache.md#cache-identifier).

modules/kms-keyring-node/src/kms_hkeyring_node_helpers.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ export function getCacheEntryId(
8686
// get branch key id as a byte array
8787
const branchKeyIdAsBytes = stringToUtf8Bytes(branchKeyId)
8888

89-
var entryInfo
89+
let entryInfo
9090
//= aws-encryption-sdk-specification/framework/aws-kms/aws-kms-hierarchical-keyring.md#resource-suffix
9191
//# The aforementioned 4 definitions ([Resource Identifier](#resource-identifier),
9292
//# [Scope Identifier](#scope-identifier), [Partition ID](#partition-id-1), and
9393
//# [Resource Suffix](#resource-suffix)) MUST be appended together with the null byte, 0x00,
9494
//# and the SHA384 of the result should be taken as the final cache identifier.
9595

96-
if (!!versionAsBytes) {
96+
if (versionAsBytes) {
9797
//= aws-encryption-sdk-specification/framework/aws-kms/aws-kms-hierarchical-keyring.md#decryption-materials
9898
//# When the hierarchical keyring receives an OnDecrypt request,
9999
//# it MUST calculate the cache entry identifier as the

modules/kms-keyring-node/test/fixtures.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
import {
5-
BranchKeyStoreNode,
6-
} from '@aws-crypto/branch-keystore-node'
4+
import { BranchKeyStoreNode } from '@aws-crypto/branch-keystore-node'
75
import {
86
AlgorithmSuiteIdentifier,
97
EncryptionContext,
@@ -26,7 +24,7 @@ export const TEST_ESDK_ALG_SUITE = new NodeAlgorithmSuite(
2624
)
2725
export const TTL = 1 * 60000 * 10
2826
export const KEYSTORE = new BranchKeyStoreNode({
29-
storage: {ddbTableName: DDB_TABLE_NAME},
27+
storage: { ddbTableName: DDB_TABLE_NAME },
3028
logicalKeyStoreName: LOGICAL_KEYSTORE_NAME,
3129
kmsConfiguration: { identifier: KEY_ARN },
3230
})

modules/kms-keyring-node/test/kms_hkeyring_node.constructor.test.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
import {
5-
BranchKeyStoreNode,
6-
} from '@aws-crypto/branch-keystore-node'
4+
import { BranchKeyStoreNode } from '@aws-crypto/branch-keystore-node'
75
import {
86
DDB_TABLE_NAME,
97
LOGICAL_KEYSTORE_NAME,
@@ -26,7 +24,7 @@ const branchKeyId = BRANCH_KEY_ID
2624
const cacheLimitTtl = TTL
2725
const maxCacheSize = 1000
2826
const keyStore = new BranchKeyStoreNode({
29-
storage: {ddbTableName: DDB_TABLE_NAME},
27+
storage: { ddbTableName: DDB_TABLE_NAME },
3028
logicalKeyStoreName: LOGICAL_KEYSTORE_NAME,
3129
kmsConfiguration: { identifier: KEY_ARN },
3230
})

modules/kms-keyring-node/test/kms_hkeyring_node.edk-order.test.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ import {
3535
testOnDecryptError,
3636
testOnEncrypt,
3737
} from './kms_hkeyring_node.test'
38-
import { BranchKeyStoreNode, KeyStoreInfoOutput } from '@aws-crypto/branch-keystore-node'
38+
import {
39+
BranchKeyStoreNode,
40+
KeyStoreInfoOutput,
41+
} from '@aws-crypto/branch-keystore-node'
3942
chai.use(chaiAsPromised)
4043

4144
// an edk that can't even be destructured according to any alg suite
@@ -146,14 +149,14 @@ describe('KmsHierarchicalKeyRingNode: decrypt EDK order', () => {
146149
}
147150
})
148151

149-
keyStore.getKeyStoreInfo.callsFake(function(): KeyStoreInfoOutput {
152+
keyStore.getKeyStoreInfo.callsFake(function (): KeyStoreInfoOutput {
150153
return {
151-
keystoreId: "keyStoreId",
152-
keystoreTableName: "keystoreTableName",
153-
logicalKeyStoreName: "logicalKeyStoreName",
154+
keystoreId: 'keyStoreId',
155+
keystoreTableName: 'keystoreTableName',
156+
logicalKeyStoreName: 'logicalKeyStoreName',
154157
grantTokens: [],
155158
// This is not used by any tests
156-
kmsConfiguration: null as any
159+
kmsConfiguration: null as any,
157160
}
158161
})
159162
})

modules/kms-keyring-node/test/kms_hkeyring_node.ondecrypt.test.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ import { expect } from 'chai'
3434
import Sinon from 'sinon'
3535
import { KMSClient } from '@aws-sdk/client-kms'
3636
import { DynamoDBClient } from '@aws-sdk/client-dynamodb'
37-
import { BranchKeyStoreNode, KeyStoreInfoOutput } from '@aws-crypto/branch-keystore-node'
37+
import {
38+
BranchKeyStoreNode,
39+
KeyStoreInfoOutput,
40+
} from '@aws-crypto/branch-keystore-node'
3841

3942
const branchKeyIdA = BRANCH_KEY_ID_A
4043
const branchKeyIdB = BRANCH_KEY_ID_B
@@ -130,14 +133,14 @@ describe('KmsHierarchicalKeyRingNode: onDecrypt', () => {
130133
}
131134
})
132135

133-
keyStore.getKeyStoreInfo.callsFake(function(): KeyStoreInfoOutput {
136+
keyStore.getKeyStoreInfo.callsFake(function (): KeyStoreInfoOutput {
134137
return {
135-
keystoreId: "keyStoreId",
136-
keystoreTableName: "keystoreTableName",
137-
logicalKeyStoreName: "logicalKeyStoreName",
138+
keystoreId: 'keyStoreId',
139+
keystoreTableName: 'keystoreTableName',
140+
logicalKeyStoreName: 'logicalKeyStoreName',
138141
grantTokens: [],
139142
// This is not used by any tests
140-
kmsConfiguration: null as any
143+
kmsConfiguration: null as any,
141144
}
142145
})
143146
})
@@ -595,7 +598,7 @@ describe('KmsHierarchicalKeyRingNode: onDecrypt', () => {
595598

596599
it('CMC evictions occur due to capacity', async () => {
597600
const maxCacheSize = 1
598-
601+
599602
const hkr = new KmsHierarchicalKeyRingNode({
600603
branchKeyIdSupplier,
601604
keyStore,

modules/kms-keyring-node/test/kms_hkeyring_node.onencrypt.test.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ import {
2828
testOnEncrypt,
2929
testOnEncryptError,
3030
} from './kms_hkeyring_node.test'
31-
import { BranchKeyStoreNode, KeyStoreInfoOutput } from '@aws-crypto/branch-keystore-node'
31+
import {
32+
BranchKeyStoreNode,
33+
KeyStoreInfoOutput,
34+
} from '@aws-crypto/branch-keystore-node'
3235
chai.use(chaiAsPromised)
3336

3437
const branchKeyIdA = BRANCH_KEY_ID_A
@@ -85,14 +88,14 @@ describe('KmsHierarchicalKeyRingNode: onEncrypt', () => {
8588
}
8689
})
8790

88-
keyStore.getKeyStoreInfo.callsFake(function(): KeyStoreInfoOutput {
91+
keyStore.getKeyStoreInfo.callsFake(function (): KeyStoreInfoOutput {
8992
return {
90-
keystoreId: "keyStoreId",
91-
keystoreTableName: "keystoreTableName",
92-
logicalKeyStoreName: "logicalKeyStoreName",
93+
keystoreId: 'keyStoreId',
94+
keystoreTableName: 'keystoreTableName',
95+
logicalKeyStoreName: 'logicalKeyStoreName',
9396
grantTokens: [],
9497
// This is not used by any tests
95-
kmsConfiguration: null as any
98+
kmsConfiguration: null as any,
9699
}
97100
})
98101
})

0 commit comments

Comments
 (0)