From 3e49ba1a926d9b32f68c0fd157aee9263a5e5aec Mon Sep 17 00:00:00 2001 From: Frederik Rothenberger Date: Tue, 24 Sep 2024 15:51:46 +0200 Subject: [PATCH] Update agent-js (#2624) * Update agent-js `npm update` clashes with incompatible peer dependencies due to agent-js being on version 1.x.x but `@dfinity/utils` wanting 2.x.x. Hence agent-js and related dependencies are upgraded. * Switch to new way of creating HttpAgents * Bump auth client in using-dev-build --- demos/using-dev-build/package-lock.json | 248 ++++++++++++------ demos/using-dev-build/package.json | 2 +- demos/using-dev-build/webapp/index.ts | 2 +- demos/vc_issuer/app/issuer.ts | 15 +- package-lock.json | 76 +++--- package.json | 12 +- .../flows/verifiableCredentials/vcIssuer.ts | 11 +- .../test-e2e/verifiableCredentials/utils.ts | 6 +- src/frontend/src/utils/iiConnection.ts | 15 +- 9 files changed, 234 insertions(+), 153 deletions(-) diff --git a/demos/using-dev-build/package-lock.json b/demos/using-dev-build/package-lock.json index d50e82125a..ed3558f39d 100644 --- a/demos/using-dev-build/package-lock.json +++ b/demos/using-dev-build/package-lock.json @@ -8,7 +8,7 @@ "name": "@dfinity/internet-identity-e2e-tests", "version": "1.0.0", "dependencies": { - "@dfinity/auth-client": "^0.15.5" + "@dfinity/auth-client": "^2.1.1" }, "devDependencies": { "@types/mocha": "^10.0.6", @@ -176,6 +176,7 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -187,75 +188,105 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "node_modules/@dfinity/agent": { - "version": "0.15.5", - "resolved": "https://registry.npmjs.org/@dfinity/agent/-/agent-0.15.5.tgz", - "integrity": "sha512-Ytn8eo0Gk8QkaCX2X+CS1NYOdCr0ZjanqFyKbR5rY7LGQoVaNzdVHJufzheuTFMhTZs6i/OtaG2BQug4cNIocw==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@dfinity/agent/-/agent-2.1.1.tgz", + "integrity": "sha512-9+XPFc9PrXM0kmaqZOOVW3eXBGaWzOjnnbEa55J1NBuDA6+X2jAyE51I62zXr1oFwMeKj7ykOEFd5MOmnMEijA==", + "license": "Apache-2.0", "peer": true, "dependencies": { + "@noble/curves": "^1.4.0", + "@noble/hashes": "^1.3.1", "base64-arraybuffer": "^0.2.0", - "bignumber.js": "^9.0.0", "borc": "^2.1.1", - "js-sha256": "0.9.0", - "simple-cbor": "^0.4.1", - "ts-node": "^10.8.2" + "buffer": "^6.0.3", + "simple-cbor": "^0.4.1" }, "peerDependencies": { - "@dfinity/candid": "^0.15.5", - "@dfinity/principal": "^0.15.5" + "@dfinity/candid": "^2.1.1", + "@dfinity/principal": "^2.1.1" + } + }, + "node_modules/@dfinity/agent/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" } }, "node_modules/@dfinity/auth-client": { - "version": "0.15.5", - "resolved": "https://registry.npmjs.org/@dfinity/auth-client/-/auth-client-0.15.5.tgz", - "integrity": "sha512-G8IAmG+A3YR+poySTGI9ObR88RPxxkd56B5DaEtJltSZxFjEziBLOakRlj1D0dLFqbY7j7JlsJ2Erzm0gyQXmQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@dfinity/auth-client/-/auth-client-2.1.1.tgz", + "integrity": "sha512-yvP3g9Y4ZnBw7GVy37ICFKt+2pZ3BAtOqbia5OSnaMRXgpgmfIvvyxFbMIrIDzLQJM+EuEmm1ZomXCyeFWDqyw==", + "license": "Apache-2.0", "dependencies": { "idb": "^7.0.2" }, "peerDependencies": { - "@dfinity/agent": "^0.15.5", - "@dfinity/identity": "^0.15.5", - "@dfinity/principal": "^0.15.5" + "@dfinity/agent": "^2.1.1", + "@dfinity/identity": "^2.1.1", + "@dfinity/principal": "^2.1.1" } }, "node_modules/@dfinity/candid": { - "version": "0.15.5", - "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-0.15.5.tgz", - "integrity": "sha512-SWf70AuFJ+SphvOHPiyCXE2s5b63c8U/UVGIRhnxSR/xi8iiP3tjPL6Cfe+TPsuXQShX8pPJBJhKC9O20cua2Q==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-2.1.1.tgz", + "integrity": "sha512-RVcTKko8wLys2yW84e9Fu/AcJkZOdH7U/Rlm3Pgcx81fnfm74hxKCoecTYD+awbD2HSlVJRB/Uo7NoAoE/N+gQ==", + "license": "Apache-2.0", "peer": true, - "dependencies": { - "ts-node": "^10.8.2" + "peerDependencies": { + "@dfinity/principal": "^2.1.1" } }, "node_modules/@dfinity/identity": { - "version": "0.15.5", - "resolved": "https://registry.npmjs.org/@dfinity/identity/-/identity-0.15.5.tgz", - "integrity": "sha512-Lli8I86y/3AGf3e5yXTQtFNij/1YrGWlgPDxMsmyzBQjkiUh8PLQYPNGbq7uH410gG+vvmBBJy7h/vEl3ECALA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@dfinity/identity/-/identity-2.1.1.tgz", + "integrity": "sha512-Imls2yplJG8KUM4WRW3PHHaC1zJR/xGy6usXpkwJSV3zQVWuxTL0+myM20pTa3qO9RFawPDBtnu1/e14KJZ7Kw==", + "license": "Apache-2.0", "peer": true, "dependencies": { - "borc": "^2.1.1", - "js-sha256": "^0.9.0", - "tweetnacl": "^1.0.1" + "@noble/curves": "^1.2.0", + "@noble/hashes": "^1.3.1", + "borc": "^2.1.1" }, "peerDependencies": { - "@dfinity/agent": "^0.15.5", - "@dfinity/principal": "^0.15.5", + "@dfinity/agent": "^2.1.1", + "@dfinity/principal": "^2.1.1", "@peculiar/webcrypto": "^1.4.0" } }, "node_modules/@dfinity/principal": { - "version": "0.15.5", - "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-0.15.5.tgz", - "integrity": "sha512-K+oIH/zAuZf6JxQAZrPzkkGL+hPn96/CnFzjWNqwHADZjBShr9m1n2Sv/68hKoND5p/uMNVIAV0km39A03Se6g==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-2.1.1.tgz", + "integrity": "sha512-XKoQRgL7S7MRPwabY6z2wJ1Mn0WQqe9ZQIMK2wtRq48f5nL1m0rZejf8kR9JsZCNCYK6ss4b09FCRNGC20J8Bg==", + "license": "Apache-2.0", "peer": true, "dependencies": { - "js-sha256": "^0.9.0", - "ts-node": "^10.8.2" + "@noble/hashes": "^1.3.1" } }, "node_modules/@esbuild/aix-ppc64": { @@ -844,6 +875,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true, "engines": { "node": ">=6.0.0" } @@ -874,7 +906,8 @@ "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.14", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.17", @@ -900,21 +933,52 @@ "node": ">= 0.4" } }, + "node_modules/@noble/curves": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", + "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@noble/hashes": "1.5.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", + "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "license": "MIT", + "peer": true, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@peculiar/asn1-schema": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.3.6.tgz", - "integrity": "sha512-izNRxPoaeJeg/AyH8hER6s+H7p4itk+03QCa4sbxI3lNdseQYCuxzgsuNK8bTXChtLTjpJz6NmXKA73qLa3rCA==", + "version": "2.3.13", + "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.3.13.tgz", + "integrity": "sha512-3Xq3a01WkHRZL8X04Zsfg//mGaA21xlL4tlVn4v2xGT0JStiztATRkMwa5b+f/HXmY2smsiLXYK46Gwgzvfg3g==", + "license": "MIT", "peer": true, "dependencies": { "asn1js": "^3.0.5", - "pvtsutils": "^1.3.2", - "tslib": "^2.4.0" + "pvtsutils": "^1.3.5", + "tslib": "^2.6.2" } }, "node_modules/@peculiar/json-schema": { "version": "1.1.12", "resolved": "https://registry.npmjs.org/@peculiar/json-schema/-/json-schema-1.1.12.tgz", "integrity": "sha512-coUfuoMeIB7B8/NMekxaDzLhaYmp0HZNPEjYRm9goRou8UZIC3z21s0sL9AWoCw4EG876QyO3kYrc61WNF9B/w==", + "license": "MIT", "peer": true, "dependencies": { "tslib": "^2.0.0" @@ -924,16 +988,17 @@ } }, "node_modules/@peculiar/webcrypto": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/@peculiar/webcrypto/-/webcrypto-1.4.3.tgz", - "integrity": "sha512-VtaY4spKTdN5LjJ04im/d/joXuvLbQdgy5Z4DXF4MFZhQ+MTrejbNMkfZBp1Bs3O5+bFqnJgyGdPuZQflvIa5A==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@peculiar/webcrypto/-/webcrypto-1.5.0.tgz", + "integrity": "sha512-BRs5XUAwiyCDQMsVA9IDvDa7UBR9gAvPHgugOeGng3YN6vJ9JYonyDc0lNczErgtCWtucjR5N7VtaonboD/ezg==", + "license": "MIT", "peer": true, "dependencies": { - "@peculiar/asn1-schema": "^2.3.6", + "@peculiar/asn1-schema": "^2.3.8", "@peculiar/json-schema": "^1.1.12", - "pvtsutils": "^1.3.2", - "tslib": "^2.5.0", - "webcrypto-core": "^1.7.7" + "pvtsutils": "^1.3.5", + "tslib": "^2.6.2", + "webcrypto-core": "^1.8.0" }, "engines": { "node": ">=10.12.0" @@ -1217,22 +1282,26 @@ "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true }, "node_modules/@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true }, "node_modules/@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true }, "node_modules/@tsconfig/node16": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==" + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", + "dev": true }, "node_modules/@types/estree": { "version": "1.0.5", @@ -1280,6 +1349,7 @@ "version": "20.11.19", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "dev": true, "dependencies": { "undici-types": "~5.26.4" } @@ -1675,6 +1745,7 @@ "version": "8.8.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -1686,6 +1757,7 @@ "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, "engines": { "node": ">=0.4.0" } @@ -1829,7 +1901,8 @@ "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true }, "node_modules/argparse": { "version": "2.0.1", @@ -1850,6 +1923,7 @@ "version": "3.0.5", "resolved": "https://registry.npmjs.org/asn1js/-/asn1js-3.0.5.tgz", "integrity": "sha512-FVnvrKJwpt9LP2lAMl8qZswRNm3T4q9CON+bxldk2iwk3FFpuwhx2FfinyitizWHsVYyaY+y5JzDR0rCMV5yTQ==", + "license": "BSD-3-Clause", "peer": true, "dependencies": { "pvtsutils": "^1.3.2", @@ -1983,9 +2057,10 @@ } }, "node_modules/bignumber.js": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz", - "integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "license": "MIT", "peer": true, "engines": { "node": "*" @@ -2034,6 +2109,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/borc/-/borc-2.1.2.tgz", "integrity": "sha512-Sy9eoUi4OiKzq7VovMn246iTo17kzuyHJKomCfpWMlI6RpfN1gk95w7d7gH264nApVLg0HZfcpz62/g4VH1Y4w==", + "license": "MIT", "peer": true, "dependencies": { "bignumber.js": "^9.0.0", @@ -2469,7 +2545,8 @@ "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true }, "node_modules/cross-fetch": { "version": "4.0.0", @@ -2671,6 +2748,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/delimit-stream/-/delimit-stream-0.1.0.tgz", "integrity": "sha512-a02fiQ7poS5CnjiJBAsjGLPp5EwVoGHNeu9sziBd9huppRfsAFIpv5zNLv0V1gbop53ilngAf5Kf331AwcoRBQ==", + "license": "BSD-2-Clause", "peer": true }, "node_modules/dequal": { @@ -3954,6 +4032,7 @@ "version": "0.4.7", "resolved": "https://registry.npmjs.org/iso-url/-/iso-url-0.4.7.tgz", "integrity": "sha512-27fFRDnPAMnHGLq36bWTpKET+eiXct3ENlCcdcMdk+mjXrb2kw3mhBUg1B7ewAC0kVzlOPhADzQgz1SE6Tglog==", + "license": "MIT", "peer": true, "engines": { "node": ">=10" @@ -4398,12 +4477,6 @@ "node": ">=8" } }, - "node_modules/js-sha256": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", - "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==", - "peer": true - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -4447,6 +4520,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/json-text-sequence/-/json-text-sequence-0.1.1.tgz", "integrity": "sha512-L3mEegEWHRekSHjc7+sc8eJhba9Clq1PZ8kMkzf8OxElhXc8O4TS5MwcVlj9aEbm5dr81N90WHC5nAz3UO971w==", + "license": "MIT", "peer": true, "dependencies": { "delimit-stream": "0.1.0" @@ -4772,7 +4846,8 @@ "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true }, "node_modules/merge-stream": { "version": "2.0.0", @@ -5853,18 +5928,20 @@ } }, "node_modules/pvtsutils": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.3.2.tgz", - "integrity": "sha512-+Ipe2iNUyrZz+8K/2IOo+kKikdtfhRKzNpQbruF2URmqPtoqAs8g3xS7TJvFF2GcPXjh7DkqMnpVveRFq4PgEQ==", + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.3.5.tgz", + "integrity": "sha512-ARvb14YB9Nm2Xi6nBq1ZX6dAM0FsJnuk+31aUp4TrcZEdKUlSqOqsxJHUPJDNE3qiIp+iUPEIeR6Je/tgV7zsA==", + "license": "MIT", "peer": true, "dependencies": { - "tslib": "^2.4.0" + "tslib": "^2.6.1" } }, "node_modules/pvutils": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.1.3.tgz", "integrity": "sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ==", + "license": "MIT", "peer": true, "engines": { "node": ">=6.0.0" @@ -6470,6 +6547,7 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/simple-cbor/-/simple-cbor-0.4.1.tgz", "integrity": "sha512-rijcxtwx2b4Bje3sqeIqw5EeW7UlOIC4YfOdwqIKacpvRQ/D78bWg/4/0m5e0U91oKvlGh7LlJuZCu07ISCC7w==", + "license": "ISC", "peer": true }, "node_modules/slash": { @@ -6832,6 +6910,7 @@ "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -6874,20 +6953,16 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, "engines": { "node": ">=0.3.1" } }, "node_modules/tslib": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", - "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" - }, - "node_modules/tweetnacl": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", - "peer": true + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "license": "0BSD" }, "node_modules/type-fest": { "version": "0.21.3", @@ -6905,6 +6980,7 @@ "version": "5.0.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -6926,7 +7002,8 @@ "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==" + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true }, "node_modules/universalify": { "version": "2.0.1", @@ -7002,7 +7079,8 @@ "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true }, "node_modules/validate-npm-package-license": { "version": "3.0.4", @@ -7175,16 +7253,17 @@ } }, "node_modules/webcrypto-core": { - "version": "1.7.7", - "resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-1.7.7.tgz", - "integrity": "sha512-7FjigXNsBfopEj+5DV2nhNpfic2vumtjjgPmeDKk45z+MJwXKKfhPB7118Pfzrmh4jqOMST6Ch37iPAHoImg5g==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-1.8.0.tgz", + "integrity": "sha512-kR1UQNH8MD42CYuLzvibfakG5Ew5seG85dMMoAM/1LqvckxaF6pUiidLuraIu4V+YCIFabYecUZAW0TuxAoaqw==", + "license": "MIT", "peer": true, "dependencies": { - "@peculiar/asn1-schema": "^2.3.6", + "@peculiar/asn1-schema": "^2.3.8", "@peculiar/json-schema": "^1.1.12", "asn1js": "^3.0.1", - "pvtsutils": "^1.3.2", - "tslib": "^2.4.0" + "pvtsutils": "^1.3.5", + "tslib": "^2.6.2" } }, "node_modules/webdriver": { @@ -7536,6 +7615,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, "engines": { "node": ">=6" } diff --git a/demos/using-dev-build/package.json b/demos/using-dev-build/package.json index a1c5817471..8d9d623a95 100644 --- a/demos/using-dev-build/package.json +++ b/demos/using-dev-build/package.json @@ -25,6 +25,6 @@ "vite": "^5.2.14" }, "dependencies": { - "@dfinity/auth-client": "^0.15.5" + "@dfinity/auth-client": "^2.1.1" } } diff --git a/demos/using-dev-build/webapp/index.ts b/demos/using-dev-build/webapp/index.ts index 5bb78a9885..7d616ade27 100644 --- a/demos/using-dev-build/webapp/index.ts +++ b/demos/using-dev-build/webapp/index.ts @@ -61,7 +61,7 @@ document.getElementById("loginBtn")?.addEventListener("click", async () => { // At this point we're authenticated, and we can get the identity from the auth client: const identity = authClient.getIdentity(); // Using the identity obtained from the auth client, we can create an agent to interact with the IC. - const agent = new HttpAgent({ identity }); + const agent = await HttpAgent.create({ identity, shouldFetchRootKey: true }); // Using the interface description of our webapp, we create an actor that we use to call the service methods. const webapp: _SERVICE = Actor.createActor(webapp_idl, { agent, diff --git a/demos/vc_issuer/app/issuer.ts b/demos/vc_issuer/app/issuer.ts index 31ed00a26e..71fe0478f8 100644 --- a/demos/vc_issuer/app/issuer.ts +++ b/demos/vc_issuer/app/issuer.ts @@ -9,18 +9,17 @@ export class VcIssuer { public constructor(readonly canisterId: string) {} createActor = async (): Promise> => { - const agent = new HttpAgent(); - - // XXX: we always fetch the rootkey. - // Although this isn't necessary/recommended on mainnet, - // we do this for simplicity. - await agent.fetchRootKey(); + const agent = await HttpAgent.create({ + // XXX: we always fetch the rootkey. + // Although this isn't necessary/recommended on mainnet, + // we do this for simplicity. + shouldFetchRootKey: true, + }); - const actor = Actor.createActor<_SERVICE>(vc_issuer_idl, { + return Actor.createActor<_SERVICE>(vc_issuer_idl, { agent, canisterId: this.canisterId, }); - return actor; }; addEmployee = async ({ diff --git a/package-lock.json b/package-lock.json index 677086a774..3e4f33e886 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,13 +16,13 @@ "src/sig-verifier-js" ], "dependencies": { - "@dfinity/agent": "^1.3.0", - "@dfinity/auth-client": "^1.3.0", - "@dfinity/candid": "^1.3.0", - "@dfinity/identity": "^1.3.0", + "@dfinity/agent": "^2.1.1", + "@dfinity/auth-client": "^2.1.1", + "@dfinity/candid": "^2.1.1", + "@dfinity/identity": "^2.1.1", "@dfinity/internet-identity-vc-api": "*", - "@dfinity/principal": "^1.3.0", - "@dfinity/utils": "^2.2.0", + "@dfinity/principal": "^2.1.1", + "@dfinity/utils": "^2.5.0", "bip39": "^3.0.4", "buffer": "^6.0.3", "dompurify": "^3.1.3", @@ -842,9 +842,10 @@ } }, "node_modules/@dfinity/agent": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@dfinity/agent/-/agent-1.3.0.tgz", - "integrity": "sha512-gFc2CqjWURv/Th+vxwHIb7Y39TpRZccjyRm8c51LtyAGLYSpSwJDWbzM/y66h++DSSc3A+1DjN/dRT+6ik3xLw==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@dfinity/agent/-/agent-2.1.1.tgz", + "integrity": "sha512-9+XPFc9PrXM0kmaqZOOVW3eXBGaWzOjnnbEa55J1NBuDA6+X2jAyE51I62zXr1oFwMeKj7ykOEFd5MOmnMEijA==", + "license": "Apache-2.0", "dependencies": { "@noble/curves": "^1.4.0", "@noble/hashes": "^1.3.1", @@ -854,43 +855,46 @@ "simple-cbor": "^0.4.1" }, "peerDependencies": { - "@dfinity/candid": "^1.3.0", - "@dfinity/principal": "^1.3.0" + "@dfinity/candid": "^2.1.1", + "@dfinity/principal": "^2.1.1" } }, "node_modules/@dfinity/auth-client": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@dfinity/auth-client/-/auth-client-1.3.0.tgz", - "integrity": "sha512-/1Xn+acHckLh9GlImBRsIEjej0nbD+B0hsoOM8gyimrRrcoxqlSwn+rzjlR2fbVf++rTRRwsQgShG/gfCEXJig==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@dfinity/auth-client/-/auth-client-2.1.1.tgz", + "integrity": "sha512-yvP3g9Y4ZnBw7GVy37ICFKt+2pZ3BAtOqbia5OSnaMRXgpgmfIvvyxFbMIrIDzLQJM+EuEmm1ZomXCyeFWDqyw==", + "license": "Apache-2.0", "dependencies": { "idb": "^7.0.2" }, "peerDependencies": { - "@dfinity/agent": "^1.3.0", - "@dfinity/identity": "^1.3.0", - "@dfinity/principal": "^1.3.0" + "@dfinity/agent": "^2.1.1", + "@dfinity/identity": "^2.1.1", + "@dfinity/principal": "^2.1.1" } }, "node_modules/@dfinity/candid": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-1.3.0.tgz", - "integrity": "sha512-tt5NYfpv8C+3iKS3Awbi+NAIxjwjIRUOLT+1ys/xpA+6DNEqwgfU8WZu0+bKnf/xlASCyJXUmoMzQ6I01GBp9A==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-2.1.1.tgz", + "integrity": "sha512-RVcTKko8wLys2yW84e9Fu/AcJkZOdH7U/Rlm3Pgcx81fnfm74hxKCoecTYD+awbD2HSlVJRB/Uo7NoAoE/N+gQ==", + "license": "Apache-2.0", "peerDependencies": { - "@dfinity/principal": "^1.3.0" + "@dfinity/principal": "^2.1.1" } }, "node_modules/@dfinity/identity": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@dfinity/identity/-/identity-1.3.0.tgz", - "integrity": "sha512-DAqb+dYV20wqJBfMv6RFEyDNPg8FSUVPjK3kXP/gXEDM+w2Viq4/oQdMqm0lWTK8t4+TuxvUS74ULAS7wCYuVQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@dfinity/identity/-/identity-2.1.1.tgz", + "integrity": "sha512-Imls2yplJG8KUM4WRW3PHHaC1zJR/xGy6usXpkwJSV3zQVWuxTL0+myM20pTa3qO9RFawPDBtnu1/e14KJZ7Kw==", + "license": "Apache-2.0", "dependencies": { "@noble/curves": "^1.2.0", "@noble/hashes": "^1.3.1", "borc": "^2.1.1" }, "peerDependencies": { - "@dfinity/agent": "^1.3.0", - "@dfinity/principal": "^1.3.0", + "@dfinity/agent": "^2.1.1", + "@dfinity/principal": "^2.1.1", "@peculiar/webcrypto": "^1.4.0" } }, @@ -907,9 +911,10 @@ "link": true }, "node_modules/@dfinity/principal": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-1.3.0.tgz", - "integrity": "sha512-04Ly9/VxztgmSk3LeUv1H+aA/8zCfed5gzgydVKBv9U0pk2lcCjUOMhv3G+1UCUSd8GwzrWaSwIsrzrAcHZm/g==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-2.1.1.tgz", + "integrity": "sha512-XKoQRgL7S7MRPwabY6z2wJ1Mn0WQqe9ZQIMK2wtRq48f5nL1m0rZejf8kR9JsZCNCYK6ss4b09FCRNGC20J8Bg==", + "license": "Apache-2.0", "dependencies": { "@noble/hashes": "^1.3.1" } @@ -919,13 +924,14 @@ "link": true }, "node_modules/@dfinity/utils": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-2.2.0.tgz", - "integrity": "sha512-vOBjmP4z03yBSP3xGxPBWXiAqaHBoNccfsQPvXS92pHsQrfosfWPPfiUg9xkFRvqn1SnUMaskWmlOq2Q3rOE/w==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-2.5.0.tgz", + "integrity": "sha512-M4kVOdJvpJJdXrB3CgF4nXkDGOGCo0KeR5Z6QznNPpPwlz9FEThvVWZz+6y9Fs6ksWg1G8Oj7Fxbul5BMn2iAg==", + "license": "Apache-2.0", "peerDependencies": { - "@dfinity/agent": "^1.2.1", - "@dfinity/candid": "^1.2.1", - "@dfinity/principal": "^1.2.1" + "@dfinity/agent": "^2.0.0", + "@dfinity/candid": "^2.0.0", + "@dfinity/principal": "^2.0.0" } }, "node_modules/@emmetio/abbreviation": { diff --git a/package.json b/package.json index e9082d43f3..2007ca7735 100644 --- a/package.json +++ b/package.json @@ -56,13 +56,13 @@ "webdriverio": "^8.39.0" }, "dependencies": { - "@dfinity/agent": "^1.3.0", - "@dfinity/auth-client": "^1.3.0", - "@dfinity/candid": "^1.3.0", - "@dfinity/identity": "^1.3.0", + "@dfinity/agent": "^2.1.1", + "@dfinity/auth-client": "^2.1.1", + "@dfinity/candid": "^2.1.1", + "@dfinity/identity": "^2.1.1", "@dfinity/internet-identity-vc-api": "*", - "@dfinity/principal": "^1.3.0", - "@dfinity/utils": "^2.2.0", + "@dfinity/principal": "^2.1.1", + "@dfinity/utils": "^2.5.0", "bip39": "^3.0.4", "buffer": "^6.0.3", "dompurify": "^3.1.3", diff --git a/src/frontend/src/flows/verifiableCredentials/vcIssuer.ts b/src/frontend/src/flows/verifiableCredentials/vcIssuer.ts index 28ae387c73..381ab10877 100644 --- a/src/frontend/src/flows/verifiableCredentials/vcIssuer.ts +++ b/src/frontend/src/flows/verifiableCredentials/vcIssuer.ts @@ -22,20 +22,17 @@ export class VcIssuer { createActor = async ( identity?: Identity ): Promise> => { - const agent = new HttpAgent({ + const agent = await HttpAgent.create({ host: inferHost(), identity, + // Only fetch the root key when we're not in prod + shouldFetchRootKey: features.FETCH_ROOT_KEY, }); - // Only fetch the root key when we're not in prod - if (features.FETCH_ROOT_KEY) { - await agent.fetchRootKey(); - } - const actor = Actor.createActor<_SERVICE>(vc_issuer_idl, { + return Actor.createActor<_SERVICE>(vc_issuer_idl, { agent, canisterId: this.canisterId, }); - return actor; }; prepareCredential = async ({ diff --git a/src/frontend/src/test-e2e/verifiableCredentials/utils.ts b/src/frontend/src/test-e2e/verifiableCredentials/utils.ts index 33ab72bf5d..ffde6a9f90 100644 --- a/src/frontend/src/test-e2e/verifiableCredentials/utils.ts +++ b/src/frontend/src/test-e2e/verifiableCredentials/utils.ts @@ -339,8 +339,10 @@ export const addEmployeeToIssuer = async ({ const createIssuerActor = async ( issuerCanisterId: string ): Promise> => { - const agent = new HttpAgent({ host: REPLICA_URL }); - await agent.fetchRootKey(); + const agent = await HttpAgent.create({ + host: REPLICA_URL, + shouldFetchRootKey: true, + }); return Actor.createActor<_SERVICE>(vc_issuer_idl, { agent: agent, canisterId: issuerCanisterId, diff --git a/src/frontend/src/utils/iiConnection.ts b/src/frontend/src/utils/iiConnection.ts index d73dc84325..cd069a78be 100644 --- a/src/frontend/src/utils/iiConnection.ts +++ b/src/frontend/src/utils/iiConnection.ts @@ -3,6 +3,7 @@ */ import { idlFactory as internet_identity_idl } from "$generated/internet_identity_idl"; import { + _SERVICE, AddTentativeDeviceResponse, AnchorCredentials, Challenge, @@ -28,7 +29,6 @@ import { UserNumber, VerifyTentativeDeviceResponse, WebAuthnCredential, - _SERVICE, } from "$generated/internet_identity_types"; import { fromMnemonicWithoutValidation } from "$src/crypto/ed25519"; import { features } from "$src/features"; @@ -53,7 +53,7 @@ import { import { Principal } from "@dfinity/principal"; import { isNullish, nonNullish } from "@dfinity/utils"; import { MultiWebAuthnIdentity } from "./multiWebAuthnIdentity"; -import { RecoveryDevice, isRecoveryDevice } from "./recoveryDevice"; +import { isRecoveryDevice, RecoveryDevice } from "./recoveryDevice"; import { isWebAuthnCancel } from "./webAuthnErrorUtils"; /* @@ -384,20 +384,17 @@ export class Connection { createActor = async ( delegationIdentity?: DelegationIdentity ): Promise> => { - const agent = new HttpAgent({ + const agent = await HttpAgent.create({ identity: delegationIdentity, host: inferHost(), + // Only fetch the root key when we're not in prod + shouldFetchRootKey: features.FETCH_ROOT_KEY, }); - // Only fetch the root key when we're not in prod - if (features.FETCH_ROOT_KEY) { - await agent.fetchRootKey(); - } - const actor = Actor.createActor<_SERVICE>(internet_identity_idl, { + return Actor.createActor<_SERVICE>(internet_identity_idl, { agent, canisterId: this.canisterId, }); - return actor; }; requestFEDelegation = async (