From a77cf7baaf63c2caec1dc1cb24ada4a380e64c90 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 14 Feb 2024 16:01:10 -0600 Subject: [PATCH 1/5] chore: update node version for version managers --- .node-version | 2 +- .nvmrc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.node-version b/.node-version index e6db45a9..a9d08739 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -18.14.0 +18.19.0 diff --git a/.nvmrc b/.nvmrc index e6db45a9..a9d08739 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.14.0 +18.19.0 From 44087ca03160c9aae4fe3d18c4d83d7349ae6547 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 14 Feb 2024 16:02:28 -0600 Subject: [PATCH 2/5] chore: update node types --- package-lock.json | 16 ++++++++++++---- package.json | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index a44231d2..7b8e34de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,7 @@ "@types/callback-to-async-iterator": "^1.1.4", "@types/elliptic": "^6.4.14", "@types/jest": "^28.1.3", - "@types/node": "^18.14.0", + "@types/node": "^18.19.0", "@typescript-eslint/eslint-plugin": "^6.7.2", "@typescript-eslint/parser": "^6.7.2", "@xmtp/rollup-plugin-resolve-extensions": "^1.0.0", @@ -5234,9 +5234,12 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.15.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", - "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==" + "version": "18.19.15", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.15.tgz", + "integrity": "sha512-AMZ2UWx+woHNfM11PyAEQmfSxi05jm9OlkxczuHeEqmvwPkYj6MWv44gbzDPefYOLysTOFyI3ziiy2ONmUZfpA==", + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@types/normalize-package-data": { "version": "2.4.1", @@ -20794,6 +20797,11 @@ "node": ">=14.0" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, "node_modules/unicorn-magic": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", diff --git a/package.json b/package.json index 2855fa8a..e9b39918 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "@types/callback-to-async-iterator": "^1.1.4", "@types/elliptic": "^6.4.14", "@types/jest": "^28.1.3", - "@types/node": "^18.14.0", + "@types/node": "^18.19.0", "@typescript-eslint/eslint-plugin": "^6.7.2", "@typescript-eslint/parser": "^6.7.2", "@xmtp/rollup-plugin-resolve-extensions": "^1.0.0", From 429a129528ea75f90f253171f3bde9bad7747046 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 14 Feb 2024 16:04:18 -0600 Subject: [PATCH 3/5] build: upgrade checkout and setup-node actions --- .github/workflows/build.yml | 4 ++-- .github/workflows/lint.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f099d078..01a23ca3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,8 +9,8 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' - run: npm ci diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6575f1c6..90e5d004 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,8 +9,8 @@ jobs: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' - run: npm ci diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd51cfbf..b6c4f27e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,11 +19,11 @@ jobs: issues: write steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' - name: Install dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7408436a..ca91d786 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,8 +12,8 @@ jobs: matrix: env: ['node', 'jsdom'] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' - run: npm ci From ad5607a01eb62e521e65ca159f3308b83bd708fc Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 14 Feb 2024 16:05:04 -0600 Subject: [PATCH 4/5] test: update static compressed bytes --- test/Client.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Client.test.ts b/test/Client.test.ts index ae4eab11..a270727a 100644 --- a/test/Client.test.ts +++ b/test/Client.test.ts @@ -190,10 +190,10 @@ describe('encodeContent', () => { const compressed = Uint8Array.from([ 10, 18, 10, 8, 120, 109, 116, 112, 46, 111, 114, 103, 18, 4, 116, 101, 120, 116, 24, 1, 18, 17, 10, 8, 101, 110, 99, 111, 100, 105, 110, 103, 18, - 5, 85, 84, 70, 45, 56, 40, 0, 34, 45, 120, 156, 51, 52, 48, 209, 49, 52, - 48, 4, 98, 11, 8, 54, 52, 212, 49, 54, 2, 82, 150, 96, 166, 161, 161, 9, - 84, 202, 0, 44, 60, 170, 122, 84, 245, 168, 106, 218, 171, 6, 0, 139, 43, - 173, 229, + 5, 85, 84, 70, 45, 56, 40, 0, 34, 48, 120, 156, 51, 52, 48, 209, 49, 52, + 48, 212, 49, 52, 176, 128, 96, 67, 67, 29, 99, 35, 29, 67, 67, 75, 48, + 211, 208, 208, 4, 42, 101, 0, 22, 30, 85, 61, 170, 122, 84, 53, 237, 85, + 3, 0, 139, 43, 173, 229, ]) const payload = await c.encodeContent(uncompressed, { From b623ec5d8e187c530dc58df604245c349fd7416a Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Wed, 14 Feb 2024 16:05:31 -0600 Subject: [PATCH 5/5] fix: use Uint8Array instead of ArrayBuffer --- src/crypto/encryption.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/encryption.ts b/src/crypto/encryption.ts index 0e9460ac..8398cd8f 100644 --- a/src/crypto/encryption.ts +++ b/src/crypto/encryption.ts @@ -2,7 +2,7 @@ import { ciphertext } from '@xmtp/proto' import Ciphertext, { AESGCMNonceSize, KDFSaltSize } from './Ciphertext' import crypto from './crypto' -const hkdfNoInfo = new ArrayBuffer(0) +const hkdfNoInfo = new Uint8Array().buffer // This is a variation of https://github.com/paulmillr/noble-secp256k1/blob/main/index.ts#L1378-L1388 // that uses `digest('SHA-256', bytes)` instead of `digest('SHA-256', bytes.buffer)`