Skip to content

Deprecate node 8 and 10 #645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'prettier',
],
ignorePatterns: ['node_modules/'],
ignorePatterns: ['node_modules/', '*.d.ts'],
rules: {
// These are the most useful linting rules.
// They rely on types so they are the slowest rules,
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ package.json.decrypt

# verdaccio
/verdaccio/storage
/storage

# local npx cache
/verdaccio/.npx
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.d.ts
12 changes: 8 additions & 4 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ version: 0.2
batch:
fast-fail: false
build-list:
- identifier: testNodejs10
buildspec: codebuild/nodejs10.yml
- identifier: testNodejsLatest
buildspec: codebuild/nodejs_latest.yml
env:
image: aws/codebuild/standard:5.0
- identifier: testNodejs12
buildspec: codebuild/nodejs12.yml
- identifier: testNodejs14
Expand All @@ -15,8 +17,10 @@ batch:
buildspec: codebuild/browser.yml
- identifier: compliance
buildspec: codebuild/compliance.yml
- identifier: testVectorsNodejs10
buildspec: codebuild/test_vectors/nodejs10.yml
- identifier: testVectorsNodejsLatest
buildspec: codebuild/test_vectors/nodejs_latest.yml
env:
image: aws/codebuild/standard:5.0
- identifier: testVectorsNodejs12
buildspec: codebuild/test_vectors/nodejs12.yml
- identifier: testVectorsNodejs14
Expand Down
3 changes: 2 additions & 1 deletion codebuild/nodejs10.yml → codebuild/nodejs_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ env:
phases:
install:
runtime-versions:
nodejs: 10
nodejs: latest
commands:
- node --version ; npm --version
- npm ci --unsafe-perm
- npm run build
build:
Expand Down
7 changes: 4 additions & 3 deletions codebuild/test_vectors/browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ version: 0.2
env:
variables:
NODE_OPTIONS: "--max-old-space-size=4096"
NPM_CONFIG_UNSAFE_PERM: true

phases:
install:
runtime-versions:
nodejs: latest
commands:
- npm ci --unsafe-perm
- npm ci
- npm run build
build:
commands:
- npm run verdaccio-publish
- npm run verdaccio-publish-browser-decrypt
- npm run verdaccio-publish-browser-encrypt
- npm run verdaccio-browser-decrypt
- npm run verdaccio-browser-encrypt
7 changes: 4 additions & 3 deletions codebuild/test_vectors/nodejs12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ version: 0.2
env:
variables:
NODE_OPTIONS: "--max-old-space-size=4096"
NPM_CONFIG_UNSAFE_PERM: true

phases:
install:
runtime-versions:
nodejs: 12
commands:
- npm ci --unsafe-perm
- npm ci
- npm run build
build:
commands:
- npm run verdaccio-publish
- npm run verdaccio-publish-node-decrypt
- npm run verdaccio-publish-node-encrypt
- npm run verdaccio-node-decrypt
- npm run verdaccio-node-encrypt
7 changes: 4 additions & 3 deletions codebuild/test_vectors/nodejs14.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ version: 0.2
env:
variables:
NODE_OPTIONS: "--max-old-space-size=4096"
NPM_CONFIG_UNSAFE_PERM: true

phases:
install:
runtime-versions:
nodejs: 14
commands:
- npm ci --unsafe-perm
- npm ci
- npm run build
build:
commands:
- npm run verdaccio-publish
- npm run verdaccio-publish-node-decrypt
- npm run verdaccio-publish-node-encrypt
- npm run verdaccio-node-decrypt
- npm run verdaccio-node-encrypt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ version: 0.2
env:
variables:
NODE_OPTIONS: "--max-old-space-size=4096"
NPM_CONFIG_UNSAFE_PERM: true

phases:
install:
runtime-versions:
nodejs: 10
nodejs: latest
commands:
- npm ci --unsafe-perm
- npm ci
- npm run build
build:
commands:
- npm run verdaccio-publish
- npm run verdaccio-publish-node-decrypt
- npm run verdaccio-publish-node-encrypt
- npm run verdaccio-node-decrypt
- npm run verdaccio-node-encrypt
72 changes: 42 additions & 30 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

// Karma configuration

const credentialsPromise = require('@aws-sdk/credential-provider-node').defaultProvider()()
const credentialsPromise =
require('@aws-sdk/credential-provider-node').defaultProvider()()
const webpack = require('webpack')

module.exports = function (config) {
process.on('infrastructure_error', (error) => {
Expand All @@ -20,62 +22,72 @@ module.exports = function (config) {

config.set({
basePath: '',
frameworks: ['mocha', 'chai'],
frameworks: [ 'mocha', 'chai', 'webpack'],
files: [
'modules/*-browser/test/**/*.ts',
'modules/web-crypto-backend/test/**/*.ts',
'modules/*-browser/build/module/test/*.js',
'modules/material-management/build/module/test/*.js',
'modules/raw-keyring/build/module/test/*.js',
'modules/kms-keyring/build/module/test/*.js',
// 'modules/cache-material/build/module/test/*.js',
'modules/serialize/build/module/test/*.js',
'modules/web-crypto-backend/build/module/test/*.js',
],
preprocessors: {
'modules/*-browser/test/**/*.ts': ['webpack', 'credentials'],
'modules/web-crypto-backend/test/**/*.ts': ['webpack', 'credentials'],
'modules/**/build/module/test/*.js': ['webpack', 'credentials'],
},
webpack: {
resolve: {
extensions: ['.ts', '.js'],
extensions: ['.js'],
},
mode: 'development',
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
options: {
logInfoToStdOut: true,
projectReferences: true,
configFile: `${__dirname}/tsconfig.module.json`,
},
},
],
exclude: /node_modules/,
// yauzl is only used in the node cli for browser integration
test: /yauzl/,
use: 'null-loader',
},
{
test: /\.ts$/,
exclude: [/\/test\//],
enforce: 'post',
test: /\.js/,
// msrcrypto.js is are outside dependances
// and should not be intremented or impact code coverage.
// fixtures.js is a test file, not an entry point
exclude: /(node_modules)|(msrcrypto.js)|(fixtures.js)/,
use: {
loader: 'istanbul-instrumenter-loader',
options: { esModules: true },
},
},
loader: "@jsdevtools/coverage-istanbul-loader",
options: {
// produceSourceMap: true
}
}
}
],
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
],
stats: {
colors: true,
modules: true,
reasons: true,
errorDetails: true,
},
devtool: 'inline-source-map',
node: {
fs: 'empty',
devtool: 'source-map',
resolve: {
fallback: {
fs: false,
crypto: false,
},
},
},
coverageIstanbulReporter: {
reports: ['json'],
dir: '.karma_output',
combineBrowserReports: true,
fixWebpackSourcePaths: true,
dir: '.karma_output',
skipFilesWithNoCoverage: true,
// verbose: true,
},
plugins: [
{
Expand Down
8 changes: 4 additions & 4 deletions modules/cache-material/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"tslib": "^2.2.0"
},
"sideEffects": false,
"main": "./build/main/index.js",
"module": "./build/module/index.js",
"types": "./build/main/index.d.ts",
"main": "./build/main/src/index.js",
"module": "./build/module/src/index.js",
"types": "./build/main/src/index.d.ts",
"files": [
"build/**/*"
"build/**/src/*"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ export function buildCryptographicMaterialsCacheKeyHelpers<
toUtf8: (input: Uint8Array) => string,
sha512: (...data: (Uint8Array | string)[]) => Promise<Uint8Array>
): CryptographicMaterialsCacheKeyHelpersInterface<S> {
const {
serializeEncryptionContext,
serializeEncryptedDataKey,
} = serializeFactory(fromUtf8)
const { serializeEncryptionContext, serializeEncryptedDataKey } =
serializeFactory(fromUtf8)

return {
buildEncryptionMaterialCacheKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,17 @@ export function getEncryptionMaterials<S extends SupportedAlgorithmSuites>({
this: CachingMaterialsManager<S>,
request: EncryptionRequest<S>
): Promise<EncryptionMaterial<S>> {
const {
suite,
encryptionContext,
plaintextLength,
commitmentPolicy,
} = request
const { suite, encryptionContext, plaintextLength, commitmentPolicy } =
request

/* Check for early return (Postcondition): If I can not cache the EncryptionMaterial, do not even look. */
if (
(suite && !suite.cacheSafe) ||
typeof plaintextLength !== 'number' ||
plaintextLength < 0
) {
const material = await this._backingMaterialsManager.getEncryptionMaterials(
request
)
const material =
await this._backingMaterialsManager.getEncryptionMaterials(request)
return material
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,22 +188,7 @@ describe('Cryptographic Material Functions', () => {

const nodeSuite = new NodeAlgorithmSuite(suiteId)
const udk128 = new Uint8Array([
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
])
const encryptTrace = {
keyNamespace: 'keyNamespace',
Expand Down Expand Up @@ -381,22 +366,7 @@ describe('Cryptographic Material Functions', () => {

const nodeSuite = new NodeAlgorithmSuite(suiteId)
const udk128 = new Uint8Array([
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
])
const encryptTrace = {
keyNamespace: 'keyNamespace',
Expand Down Expand Up @@ -472,22 +442,7 @@ describe('Cryptographic Material Functions', () => {

const nodeSuite = new NodeAlgorithmSuite(suiteId)
const udk128 = new Uint8Array([
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
])
const encryptTrace = {
keyNamespace: 'keyNamespace',
Expand Down
Loading