From 734743884f21491efce9392e129d612735e85282 Mon Sep 17 00:00:00 2001 From: Liran Cohen Date: Tue, 27 Aug 2024 16:54:45 -0400 Subject: [PATCH] Upgrade dwn-server and dwn-sdk-js (#853) - upgrade `dwn-sdk-js` to `v0.4.6` - upgrade `dwn-server` to `v0.4.8` - added `sinon.restore()` in some places it may have been missing to eliminate cause of intermittent browser failures. --- .changeset/gold-tools-yell.md | 5 +++ .changeset/warm-starfishes-beam.md | 8 +++++ package.json | 2 +- packages/agent/package.json | 2 +- packages/api/package.json | 2 +- packages/credentials/tests/jwt.spec.ts | 5 +++ .../credentials/tests/ssi-validator.spec.ts | 1 + .../tests/verifiable-credential.spec.ts | 4 +++ packages/crypto-aws-kms/tests/utils.spec.ts | 4 +++ .../crypto/tests/local-key-manager.spec.ts | 4 +++ packages/dev-env/docker-compose.yaml | 2 +- packages/dids/tests/bearer-did.spec.ts | 4 +++ packages/dids/tests/methods/did-dht.spec.ts | 1 + packages/dids/tests/methods/did-ion.spec.ts | 1 + packages/dids/tests/methods/did-web.spec.ts | 4 +++ .../resolver/resolver-cache-level.spec.ts | 1 + pnpm-lock.yaml | 36 +++++++++---------- 17 files changed, 64 insertions(+), 22 deletions(-) create mode 100644 .changeset/gold-tools-yell.md create mode 100644 .changeset/warm-starfishes-beam.md diff --git a/.changeset/gold-tools-yell.md b/.changeset/gold-tools-yell.md new file mode 100644 index 000000000..146303c84 --- /dev/null +++ b/.changeset/gold-tools-yell.md @@ -0,0 +1,5 @@ +--- +"@web5/api": patch +--- + +Upgrade `agent` to refelcy the newest `dwn-sdk-js` and `dwn-server` diff --git a/.changeset/warm-starfishes-beam.md b/.changeset/warm-starfishes-beam.md new file mode 100644 index 000000000..de8f4fd84 --- /dev/null +++ b/.changeset/warm-starfishes-beam.md @@ -0,0 +1,8 @@ +--- +"@web5/agent": patch +"@web5/identity-agent": patch +"@web5/proxy-agent": patch +"@web5/user-agent": patch +--- + +Upgrade `dwn-sdk-js` version and `dwn-server` dependency diff --git a/package.json b/package.json index 83b76c01a..12c283353 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "@changesets/cli": "^2.27.5", "@npmcli/package-json": "5.0.0", "@typescript-eslint/eslint-plugin": "7.9.0", - "@web5/dwn-server": "0.4.7", + "@web5/dwn-server": "0.4.8", "audit-ci": "^7.0.1", "eslint-plugin-mocha": "10.4.3", "globals": "^13.24.0", diff --git a/packages/agent/package.json b/packages/agent/package.json index 8d44de2be..eb67702d6 100644 --- a/packages/agent/package.json +++ b/packages/agent/package.json @@ -71,7 +71,7 @@ "dependencies": { "@noble/ciphers": "0.5.3", "@scure/bip39": "1.2.2", - "@tbd54566975/dwn-sdk-js": "0.4.5", + "@tbd54566975/dwn-sdk-js": "0.4.6", "@web5/common": "1.0.0", "@web5/crypto": "workspace:*", "@web5/dids": "1.1.0", diff --git a/packages/api/package.json b/packages/api/package.json index da1048f58..22e311d31 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -85,7 +85,7 @@ }, "devDependencies": { "@playwright/test": "1.45.3", - "@tbd54566975/dwn-sdk-js": "0.4.5", + "@tbd54566975/dwn-sdk-js": "0.4.6", "@types/chai": "4.3.6", "@types/eslint": "8.56.10", "@types/mocha": "10.0.1", diff --git a/packages/credentials/tests/jwt.spec.ts b/packages/credentials/tests/jwt.spec.ts index 8e718a0e2..0fd423038 100644 --- a/packages/credentials/tests/jwt.spec.ts +++ b/packages/credentials/tests/jwt.spec.ts @@ -12,6 +12,11 @@ import { VerifiableCredential } from '../src/verifiable-credential.js'; import sinon from 'sinon'; describe('Jwt', () => { + + after(() => { + sinon.restore(); + }); + describe('parse()', () => { it('throws error if JWT doesnt contain 3 parts', async () => { expect(() => diff --git a/packages/credentials/tests/ssi-validator.spec.ts b/packages/credentials/tests/ssi-validator.spec.ts index 17ed40f61..20d7a3d13 100644 --- a/packages/credentials/tests/ssi-validator.spec.ts +++ b/packages/credentials/tests/ssi-validator.spec.ts @@ -89,6 +89,7 @@ describe('SsiValidator', () => { afterEach(() => { fetchStub.restore(); + sinon.restore(); }); it('should throw an error if credential schema is missing', async () => { diff --git a/packages/credentials/tests/verifiable-credential.spec.ts b/packages/credentials/tests/verifiable-credential.spec.ts index 9218afab2..3fd606704 100644 --- a/packages/credentials/tests/verifiable-credential.spec.ts +++ b/packages/credentials/tests/verifiable-credential.spec.ts @@ -19,6 +19,10 @@ describe('Verifiable Credential Tests', () => { ) {} } + after(() => { + sinon.restore(); + }); + beforeEach(async () => { issuerDid = await DidJwk.create(); }); diff --git a/packages/crypto-aws-kms/tests/utils.spec.ts b/packages/crypto-aws-kms/tests/utils.spec.ts index 59d3732c6..4790fa571 100644 --- a/packages/crypto-aws-kms/tests/utils.spec.ts +++ b/packages/crypto-aws-kms/tests/utils.spec.ts @@ -7,6 +7,10 @@ import { Convert } from '@web5/common'; import { mockEcdsaSecp256k1 } from './fixtures/mock-ecdsa-secp256k1.js'; describe('AWS KMS Utils', () => { + after(() => { + sinon.restore(); + }); + describe('convertSpkiToPublicKey()', () => { it('converts DER-encoded SPKI public key to JWK', () => { // Setup. diff --git a/packages/crypto/tests/local-key-manager.spec.ts b/packages/crypto/tests/local-key-manager.spec.ts index c3f434802..e8032b196 100644 --- a/packages/crypto/tests/local-key-manager.spec.ts +++ b/packages/crypto/tests/local-key-manager.spec.ts @@ -11,6 +11,10 @@ import { LocalKeyManager } from '../src/local-key-manager.js'; describe('LocalKeyManager', () => { let keyManager: LocalKeyManager; + after(() => { + sinon.restore(); + }); + beforeEach(() => { keyManager = new LocalKeyManager(); }); diff --git a/packages/dev-env/docker-compose.yaml b/packages/dev-env/docker-compose.yaml index 541bc2415..5b4e854ad 100644 --- a/packages/dev-env/docker-compose.yaml +++ b/packages/dev-env/docker-compose.yaml @@ -3,6 +3,6 @@ version: "3.98" services: dwn-server: container_name: dwn-server - image: ghcr.io/tbd54566975/dwn-server:0.4.6 + image: ghcr.io/tbd54566975/dwn-server:0.4.8 ports: - "3000:3000" diff --git a/packages/dids/tests/bearer-did.spec.ts b/packages/dids/tests/bearer-did.spec.ts index 01b914ee0..db0790bb8 100644 --- a/packages/dids/tests/bearer-did.spec.ts +++ b/packages/dids/tests/bearer-did.spec.ts @@ -11,6 +11,10 @@ import { BearerDid } from '../src/bearer-did.js'; describe('BearerDid', () => { let portableDid: PortableDid; + after(() => { + sinon.restore(); + }); + beforeEach(() => { portableDid = { uri : 'did:jwk:eyJjcnYiOiJFZDI1NTE5Iiwia3R5IjoiT0tQIiwieCI6Im80MHNoWnJzY28tQ2ZFcWs2bUZzWGZjUDk0bHkzQXozZ204NFB6QVVzWG8iLCJraWQiOiJCRHAweGltODJHc3dseG5QVjhUUHRCZFV3ODB3a0dJRjhnakZidzF4NWlRIiwiYWxnIjoiRWREU0EifQ', diff --git a/packages/dids/tests/methods/did-dht.spec.ts b/packages/dids/tests/methods/did-dht.spec.ts index 5e2e39af9..110bf325d 100644 --- a/packages/dids/tests/methods/did-dht.spec.ts +++ b/packages/dids/tests/methods/did-dht.spec.ts @@ -45,6 +45,7 @@ describe('DidDht', () => { afterEach(() => { fetchStub.restore(); + sinon.restore(); }); describe('create()', () => { diff --git a/packages/dids/tests/methods/did-ion.spec.ts b/packages/dids/tests/methods/did-ion.spec.ts index 2e64d5f87..9e8a1a9cd 100644 --- a/packages/dids/tests/methods/did-ion.spec.ts +++ b/packages/dids/tests/methods/did-ion.spec.ts @@ -40,6 +40,7 @@ describe('DidIon', () => { afterEach(() => { fetchStub.restore(); + sinon.restore(); }); describe('create', () => { diff --git a/packages/dids/tests/methods/did-web.spec.ts b/packages/dids/tests/methods/did-web.spec.ts index 24f1681f2..b33b05485 100644 --- a/packages/dids/tests/methods/did-web.spec.ts +++ b/packages/dids/tests/methods/did-web.spec.ts @@ -23,6 +23,10 @@ const fetchOkResponse = (response: any) => ({ }); describe('DidWeb', () => { + after(() => { + sinon.restore(); + }); + describe('resolve()', () => { it(`returns a 'notFound' error if the HTTP GET response is not status code 200`, async () => { // Setup stub so that a mocked response is returned rather than calling over the network. diff --git a/packages/dids/tests/resolver/resolver-cache-level.spec.ts b/packages/dids/tests/resolver/resolver-cache-level.spec.ts index 623535749..beeadc694 100644 --- a/packages/dids/tests/resolver/resolver-cache-level.spec.ts +++ b/packages/dids/tests/resolver/resolver-cache-level.spec.ts @@ -23,6 +23,7 @@ describe('DidResolverCacheLevel', () => { after(() => { clock.restore(); + sinon.restore(); }); describe('constructor', () => { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ebf0fabad..bdf87df58 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,8 +32,8 @@ importers: specifier: 7.9.0 version: 7.9.0(@typescript-eslint/parser@7.14.1(eslint@9.7.0)(typescript@5.5.4))(eslint@9.7.0)(typescript@5.5.4) '@web5/dwn-server': - specifier: 0.4.7 - version: 0.4.7 + specifier: 0.4.8 + version: 0.4.8 audit-ci: specifier: ^7.0.1 version: 7.1.0 @@ -56,8 +56,8 @@ importers: specifier: 1.2.2 version: 1.2.2 '@tbd54566975/dwn-sdk-js': - specifier: 0.4.5 - version: 0.4.5 + specifier: 0.4.6 + version: 0.4.6 '@web5/common': specifier: 1.0.0 version: 1.0.0 @@ -184,8 +184,8 @@ importers: specifier: 1.45.3 version: 1.45.3 '@tbd54566975/dwn-sdk-js': - specifier: 0.4.5 - version: 0.4.5 + specifier: 0.4.6 + version: 0.4.6 '@types/chai': specifier: 4.3.6 version: 4.3.6 @@ -2100,12 +2100,12 @@ packages: '@sphereon/ssi-types@0.26.0': resolution: {integrity: sha512-r4JQIN7rnPunEv0HvCFC1ZCc9qlWcegYvhJbMJqSvyFE6VhmT5NNdH9jNV9QetgMa0yo5r3k+TnHNv3nH58Dmg==} - '@tbd54566975/dwn-sdk-js@0.4.5': - resolution: {integrity: sha512-UGcq9PX32oQ3sB9LfQms82Ce5secNJXUUe+W163Am2vOAAjJ8AyFG9CaIrXO8HMyEO1yZ7l3bBv57tYM9Zf70A==} + '@tbd54566975/dwn-sdk-js@0.4.6': + resolution: {integrity: sha512-eTd9v2ioT+hYrmob28OgxyLgOPAqJosb8rIAHDpFzEjYlQZSxCEohIZysMrLgWIcSLljyViSFr06mDelRPgGPg==} engines: {node: '>= 18'} - '@tbd54566975/dwn-sql-store@0.6.5': - resolution: {integrity: sha512-ZPdz7Ck7NMNCIOuZv+oxfxrw5lZJI/SukcLVd7PMseWZvT28D/gRcHgt0MfizeE9jLv9+ONI+0k8uc/O2NILyw==} + '@tbd54566975/dwn-sql-store@0.6.6': + resolution: {integrity: sha512-LY8it9npYjI/Kx/aK94gR6/1AfptmRGagUuXOfprm/lUcK3uJ79EReOq8zk7CXyTK66+GAu+oGFzuCoo12EJ1g==} engines: {node: '>=18'} '@tootallnate/quickjs-emscripten@0.23.0': @@ -2503,8 +2503,8 @@ packages: resolution: {integrity: sha512-M9EfsEYcOtYuEvUQjow4vpxXbD0Sz5H8EuDXMtwuvP4UdYL0ATl+60F8+8HDmwPFeUy6M2wxuoixrLDwSRFwZA==} engines: {node: '>=18.0.0'} - '@web5/dwn-server@0.4.7': - resolution: {integrity: sha512-ZCs1Ztc3wiywMEeINAIED/u5CA0qfuH8sr8gDeot1lBvu1viXMu1Ua8YqKc6CABPLXtWFmy5vuXIsf72TD5KHw==} + '@web5/dwn-server@0.4.8': + resolution: {integrity: sha512-Mr+Oq8XTZN133gnQYjhN07sbjVkfdlhsigQhDqThX9ghf2Kk3kiakb+5tlwYgsFCyj8O6sW+UM07443xZS3qLA==} hasBin: true '@webassemblyjs/ast@1.12.1': @@ -7356,7 +7356,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@tbd54566975/dwn-sdk-js@0.4.5': + '@tbd54566975/dwn-sdk-js@0.4.6': dependencies: '@ipld/dag-cbor': 9.0.3 '@js-temporal/polyfill': 0.4.4 @@ -7389,10 +7389,10 @@ snapshots: - encoding - supports-color - '@tbd54566975/dwn-sql-store@0.6.5': + '@tbd54566975/dwn-sql-store@0.6.6': dependencies: '@ipld/dag-cbor': 9.0.5 - '@tbd54566975/dwn-sdk-js': 0.4.5 + '@tbd54566975/dwn-sdk-js': 0.4.6 kysely: 0.26.3 multiformats: 12.0.1 readable-stream: 4.4.2 @@ -8342,10 +8342,10 @@ snapshots: level: 8.0.1 ms: 2.1.3 - '@web5/dwn-server@0.4.7': + '@web5/dwn-server@0.4.8': dependencies: - '@tbd54566975/dwn-sdk-js': 0.4.5 - '@tbd54566975/dwn-sql-store': 0.6.5 + '@tbd54566975/dwn-sdk-js': 0.4.6 + '@tbd54566975/dwn-sql-store': 0.6.6 '@web5/crypto': 1.0.3 better-sqlite3: 8.7.0 body-parser: 1.20.2