Skip to content

Commit 1d74248

Browse files
authored
feat!: Remove AWS SDK V2 Dependency (#1180)
* feat!: Drop Support & Dependency on AWS SDK V2 BREAKING CHANGE: The AWS Encryption SDK for JavaScript: - requires the AWS SDK for JavaScript V3's kms-client (if using the KMS Keyring). - no longer requires the AWS SDK V2 - no longer tests against nor supports NodeJS 12 or 14
1 parent c97442a commit 1d74248

22 files changed

+21611
-3827
lines changed

buildspec.yml

+18-14
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,46 @@ version: 0.2
33
batch:
44
fast-fail: false
55
build-list:
6-
- identifier: testNodejsLatest
7-
buildspec: codebuild/nodejs_latest.yml
6+
- identifier: testNodejs20
7+
buildspec: codebuild/nodejs20.yml
88
env:
99
image: aws/codebuild/standard:5.0
10-
- identifier: testNodejs14
11-
buildspec: codebuild/nodejs14.yml
10+
- identifier: testNodejs18
11+
buildspec: codebuild/nodejs18.yml
1212
env:
1313
image: aws/codebuild/standard:5.0
1414
- identifier: testNodejs16
1515
buildspec: codebuild/nodejs16.yml
1616
env:
1717
image: aws/codebuild/standard:5.0
18-
- identifier: testBrowser
19-
buildspec: codebuild/browser.yml
18+
- identifier: testBrowser18
19+
buildspec: codebuild/browser18.yml
2020
env:
2121
image: aws/codebuild/standard:5.0
2222
- identifier: compliance
2323
buildspec: codebuild/compliance.yml
2424
env:
2525
image: aws/codebuild/standard:5.0
26-
- identifier: testVectorsNodejsLatest
27-
buildspec: codebuild/test_vectors/nodejs_latest.yml
26+
- identifier: testVectorsNodejs16
27+
buildspec: codebuild/test_vectors/nodejs16.yml
2828
env:
2929
variables:
3030
PUBLISH_LOCAL: "true"
3131
image: aws/codebuild/standard:5.0
32-
- identifier: testVectorsNodejs14
33-
buildspec: codebuild/test_vectors/nodejs14.yml
32+
- identifier: testVectorsNodejs18
33+
buildspec: codebuild/test_vectors/nodejs18.yml
3434
env:
35+
variables:
36+
PUBLISH_LOCAL: "true"
3537
image: aws/codebuild/standard:5.0
36-
- identifier: testVectorsNodejs16
37-
buildspec: codebuild/test_vectors/nodejs16.yml
38+
- identifier: testVectorsNodejs20
39+
buildspec: codebuild/test_vectors/nodejs20.yml
3840
env:
41+
variables:
42+
PUBLISH_LOCAL: "true"
3943
image: aws/codebuild/standard:5.0
40-
- identifier: testVectorsBrowser
41-
buildspec: codebuild/test_vectors/browser.yml
44+
- identifier: testVectorsBrowser18
45+
buildspec: codebuild/test_vectors/browser18.yml
4246
env:
4347
variables:
4448
PUBLISH_LOCAL: "true"
File renamed without changes.

codebuild/compliance.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ env:
66

77
phases:
88
install:
9-
runtime-versions:
10-
nodejs: latest
119
commands:
10+
- n 18
1211
- npm ci --unsafe-perm
1312
build:
1413
commands:

codebuild/nodejs14.yml renamed to codebuild/nodejs18.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ env:
66

77
phases:
88
install:
9-
runtime-versions:
10-
nodejs: 14
119
commands:
10+
- n 18
11+
- node -v
12+
- npm -v
1213
- npm ci --unsafe-perm
1314
- npm run build
1415
build:
1516
commands:
17+
- npm -v
18+
- node -v
1619
- npm run coverage-node

codebuild/nodejs_latest.yml renamed to codebuild/nodejs20.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ env:
77
phases:
88
install:
99
commands:
10-
- n 18
10+
- n 20
1111
- node --version ; npm --version
1212
- npm ci --unsafe-perm
1313
- npm run build

codebuild/release/prod-release.yml

+14-14
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ batch:
99
buildspec: codebuild/compliance.yml
1010

1111
# Unit Tests
12-
- identifier: testNodejsLatest
13-
buildspec: codebuild/nodejs_latest.yml
12+
- identifier: testNodejs20
13+
buildspec: codebuild/nodejs20.yml
1414
env:
1515
image: aws/codebuild/standard:5.0
16-
- identifier: testBrowser
17-
buildspec: codebuild/browser.yml
16+
- identifier: testBrowser18
17+
buildspec: codebuild/browser18.yml
1818

1919
# Integration Tests
20-
- identifier: testVectorsNodejsLatest
21-
buildspec: codebuild/test_vectors/nodejs_latest.yml
20+
- identifier: testVectorsNodejs20
21+
buildspec: codebuild/test_vectors/nodejs20.yml
2222
env:
2323
variables:
2424
PUBLISH_LOCAL: "true"
2525
image: aws/codebuild/standard:5.0
26-
- identifier: testVectorsBrowser
27-
buildspec: codebuild/test_vectors/browser.yml
26+
- identifier: testVectorsBrowser18
27+
buildspec: codebuild/test_vectors/browser18.yml
2828
env:
2929
variables:
3030
PUBLISH_LOCAL: "true"
@@ -34,10 +34,10 @@ batch:
3434
- identifier: version
3535
depend-on:
3636
- compliance
37-
- testNodejsLatest
38-
- testBrowser
39-
- testVectorsNodejsLatest
40-
- testVectorsBrowser
37+
- testNodejs20
38+
- testBrowser18
39+
- testVectorsNodejs20
40+
- testVectorsBrowser18
4141
buildspec: codebuild/release/version.yml
4242

4343
# Publish the release to npm
@@ -50,15 +50,15 @@ batch:
5050
- identifier: validateNodejs
5151
depend-on:
5252
- publish
53-
buildspec: codebuild/test_vectors/nodejs_latest.yml
53+
buildspec: codebuild/test_vectors/nodejs20.yml
5454
env:
5555
variables:
5656
PUBLISH_LOCAL: "false"
5757
image: aws/codebuild/standard:5.0
5858
- identifier: validateBrowser
5959
depend-on:
6060
- publish
61-
buildspec: codebuild/test_vectors/browser.yml
61+
buildspec: codebuild/test_vectors/browser18.yml
6262
env:
6363
variables:
6464
PUBLISH_LOCAL: "false"

codebuild/release/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ phases:
1818
- npm install otplib --no-save
1919
- npm run build
2020
runtime-versions:
21-
nodejs: 14
21+
nodejs: 16
2222
pre_build:
2323
commands:
2424
- git checkout $BRANCH

codebuild/release/version.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ phases:
1313
commands:
1414
- npm ci --unsafe-perm
1515
runtime-versions:
16-
nodejs: 14
16+
nodejs: 16
1717
pre_build:
1818
commands:
1919
- git config --global user.name "aws-crypto-tools-ci-bot"

codebuild/test_vectors/browser.yml renamed to codebuild/test_vectors/browser18.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ phases:
99
install:
1010
commands:
1111
- n 18
12-
- npm ci
12+
- npm ci --unsafe-perm
1313
- |-
1414
if [ "$PUBLISH_LOCAL" = "true" ]; then
1515
npm run build

codebuild/test_vectors/nodejs12.yml

-19
This file was deleted.

codebuild/test_vectors/nodejs14.yml

-19
This file was deleted.

codebuild/test_vectors/nodejs16.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ phases:
99
install:
1010
commands:
1111
- n 16
12-
- node -v
13-
- npm -v
1412
- npm ci --unsafe-perm
15-
- npm run build
13+
- |-
14+
if [ "$PUBLISH_LOCAL" = "true" ]; then
15+
npm run build
16+
fi
1617
build:
1718
commands:
18-
- npm -v
1919
- node -v
20-
- npm run verdaccio-publish
20+
- |-
21+
if [ "$PUBLISH_LOCAL" = "true" ]; then
22+
npm run verdaccio-publish
23+
fi
2124
- npm run verdaccio-node-decrypt
2225
- npm run verdaccio-node-encrypt

codebuild/test_vectors/nodejs_latest.yml renamed to codebuild/test_vectors/nodejs18.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ phases:
99
install:
1010
commands:
1111
- n 18
12-
- npm ci
12+
- npm ci --unsafe-perm
1313
- |-
1414
if [ "$PUBLISH_LOCAL" = "true" ]; then
1515
npm run build
1616
fi
1717
build:
1818
commands:
19+
- node -v
1920
- |-
2021
if [ "$PUBLISH_LOCAL" = "true" ]; then
2122
npm run verdaccio-publish

codebuild/test_vectors/nodejs20.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 0.2
2+
3+
env:
4+
variables:
5+
NODE_OPTIONS: "--max-old-space-size=4096"
6+
NPM_CONFIG_UNSAFE_PERM: true
7+
8+
phases:
9+
install:
10+
commands:
11+
- n 20
12+
- npm ci --unsafe-perm
13+
- |-
14+
if [ "$PUBLISH_LOCAL" = "true" ]; then
15+
npm run build
16+
fi
17+
build:
18+
commands:
19+
- node -v
20+
- |-
21+
if [ "$PUBLISH_LOCAL" = "true" ]; then
22+
npm run verdaccio-publish
23+
fi
24+
- npm run verdaccio-node-decrypt
25+
- npm run verdaccio-node-encrypt

modules/integration-browser/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
"dependencies": {
2020
"@aws-crypto/client-browser": "file:../client-browser",
2121
"@aws-crypto/integration-vectors": "file:../integration-vectors",
22-
"@aws-sdk/credential-provider-node": "^3.11.0",
23-
"@aws-sdk/karma-credential-loader": "3.38.0",
24-
"@aws-sdk/util-base64-browser": "^3.10.0",
25-
"@aws-sdk/util-utf8-browser": "3.23.0",
22+
"@aws-sdk/credential-provider-node": "^3.362.0",
23+
"@aws-sdk/karma-credential-loader": "^3.38.0",
24+
"@aws-sdk/util-base64-browser": "^3.209.0",
25+
"@aws-sdk/util-utf8-browser": "^3.23.0",
2626
"@trust/keyto": "^1.0.1",
2727
"@types/got": "^9.6.9",
2828
"@types/stream-to-promise": "^2.2.0",

modules/kms-keyring-browser/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@aws-crypto/kms-keyring": "file:../kms-keyring",
2323
"@aws-crypto/material-management-browser": "file:../material-management-browser",
2424
"@aws-crypto/web-crypto-backend": "file:../web-crypto-backend",
25-
"aws-sdk": "^2.1360.0",
25+
"@aws-sdk/client-kms": "^3.363.0",
2626
"tslib": "^2.2.0"
2727
},
2828
"sideEffects": false,

modules/kms-keyring-browser/src/kms_keyring_browser.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
KeyringWebCrypto,
2424
Newable,
2525
} from '@aws-crypto/material-management-browser'
26-
import { KMS } from 'aws-sdk'
26+
import { KMS, KMSClientConfig } from '@aws-sdk/client-kms'
2727
import { version } from './version'
2828
const getKmsClient = getClient(KMS, {
2929
customUserAgent: `AwsEncryptionSdkJavascriptBrowser/${version}`,
@@ -33,10 +33,7 @@ const cacheKmsClients = cacheClients(getKmsClient)
3333
export type KmsKeyringWebCryptoInput = Partial<
3434
KmsKeyringInput<AwsEsdkKMSInterface>
3535
>
36-
export type KMSWebCryptoConstructible = KMSConstructible<
37-
KMS,
38-
KMS.ClientConfiguration
39-
>
36+
export type KMSWebCryptoConstructible = KMSConstructible<KMS, KMSClientConfig>
4037
export type KmsWebCryptoClientSupplier = KmsClientSupplier<AwsEsdkKMSInterface>
4138

4239
export class KmsKeyringBrowser extends KmsKeyringClass<

modules/kms-keyring-node/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"dependencies": {
2222
"@aws-crypto/kms-keyring": "file:../kms-keyring",
2323
"@aws-crypto/material-management-node": "file:../material-management-node",
24-
"aws-sdk": "^2.1360.0",
24+
"@aws-sdk/client-kms": "^3.362.0",
2525
"tslib": "^2.2.0"
2626
},
2727
"sideEffects": false,

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

+2-5
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,15 @@ import {
1818
Newable,
1919
NodeAlgorithmSuite,
2020
} from '@aws-crypto/material-management-node'
21-
import { KMS } from 'aws-sdk'
21+
import { KMS, KMSClientConfig } from '@aws-sdk/client-kms'
2222
import { version } from './version'
2323
const getKmsClient = getClient(KMS, {
2424
customUserAgent: `AwsEncryptionSdkJavascriptNodejs/${version}`,
2525
})
2626
const cacheKmsClients = cacheClients(getKmsClient)
2727

2828
export type KmsKeyringNodeInput = Partial<KmsKeyringInput<AwsEsdkKMSInterface>>
29-
export type KMSNodeConstructible = KMSConstructible<
30-
KMS,
31-
KMS.ClientConfiguration
32-
>
29+
export type KMSNodeConstructible = KMSConstructible<KMS, KMSClientConfig>
3330
export type KmsNodeClientSupplier = KmsClientSupplier<AwsEsdkKMSInterface>
3431

3532
export class KmsKeyringNode extends KmsKeyringClass<

0 commit comments

Comments
 (0)