From e33771c0c37ae3f68a82f317d6829e9368620b01 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Sat, 7 Dec 2024 08:58:35 +0100 Subject: [PATCH 1/2] build: peculiar/webcrypto is no peer dependencies but dev dependencies Signed-off-by: David Dal Busco --- package-lock.json | 25 +++++++++++++++++++++++-- packages/identity/package.json | 4 ++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8c7416e3..82eb82fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3348,6 +3348,7 @@ }, "node_modules/@peculiar/asn1-schema": { "version": "2.3.13", + "dev": true, "license": "MIT", "dependencies": { "asn1js": "^3.0.5", @@ -3380,6 +3381,7 @@ }, "node_modules/@peculiar/json-schema": { "version": "1.1.12", + "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.0" @@ -3390,6 +3392,7 @@ }, "node_modules/@peculiar/webcrypto": { "version": "1.5.0", + "dev": true, "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", @@ -16967,6 +16970,7 @@ }, "node_modules/webcrypto-core": { "version": "1.8.0", + "dev": true, "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", @@ -18719,6 +18723,7 @@ "borc": "^2.1.1" }, "devDependencies": { + "@peculiar/webcrypto": "^1.4.0", "@types/jest": "^29.5.5", "@typescript-eslint/eslint-plugin": "^5.30.5", "@typescript-eslint/parser": "^5.30.5", @@ -18733,8 +18738,7 @@ }, "peerDependencies": { "@dfinity/agent": "^2.1.3", - "@dfinity/principal": "^2.1.3", - "@peculiar/webcrypto": "^1.4.0" + "@dfinity/principal": "^2.1.3" } }, "packages/identity-secp256k1": { @@ -18751,6 +18755,23 @@ "bs58check": "^3.0.1" } }, + "packages/identity/node_modules/@peculiar/webcrypto": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@peculiar/webcrypto/-/webcrypto-1.4.0.tgz", + "integrity": "sha512-U58N44b2m3OuTgpmKgf0LPDOmP3bhwNz01vAnj1mBwxBASRhptWYK+M3zG+HBkDqGQM+bFsoIihTW8MdmPXEqg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@peculiar/asn1-schema": "^2.1.6", + "@peculiar/json-schema": "^1.1.12", + "pvtsutils": "^1.3.2", + "tslib": "^2.4.0", + "webcrypto-core": "^1.7.4" + }, + "engines": { + "node": ">=10.12.0" + } + }, "packages/identity/node_modules/@typescript-eslint/eslint-plugin": { "version": "5.62.0", "dev": true, diff --git a/packages/identity/package.json b/packages/identity/package.json index 0a05f352..cf948f5a 100644 --- a/packages/identity/package.json +++ b/packages/identity/package.json @@ -46,8 +46,7 @@ }, "peerDependencies": { "@dfinity/agent": "^2.1.3", - "@dfinity/principal": "^2.1.3", - "@peculiar/webcrypto": "^1.4.0" + "@dfinity/principal": "^2.1.3" }, "dependencies": { "@noble/curves": "^1.2.0", @@ -55,6 +54,7 @@ "borc": "^2.1.1" }, "devDependencies": { + "@peculiar/webcrypto": "^1.4.0", "@types/jest": "^29.5.5", "@typescript-eslint/eslint-plugin": "^5.30.5", "@typescript-eslint/parser": "^5.30.5", From 8fda9e0a354ee9fbb58c18f046c4e4815805636a Mon Sep 17 00:00:00 2001 From: Kai Peacock Date: Mon, 9 Dec 2024 10:49:35 -0800 Subject: [PATCH 2/2] fix: crypto polyfill type check --- package-lock.json | 2 ++ packages/identity/test-setup.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 82eb82fb..b51e0de4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3392,6 +3392,8 @@ }, "node_modules/@peculiar/webcrypto": { "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@peculiar/webcrypto/-/webcrypto-1.5.0.tgz", + "integrity": "sha512-BRs5XUAwiyCDQMsVA9IDvDa7UBR9gAvPHgugOeGng3YN6vJ9JYonyDc0lNczErgtCWtucjR5N7VtaonboD/ezg==", "dev": true, "license": "MIT", "dependencies": { diff --git a/packages/identity/test-setup.ts b/packages/identity/test-setup.ts index b4bf8d09..6b95872a 100644 --- a/packages/identity/test-setup.ts +++ b/packages/identity/test-setup.ts @@ -8,7 +8,7 @@ // Node.js in a similar way. import { Crypto } from '@peculiar/webcrypto'; -global.crypto = new Crypto(); +global.crypto = new Crypto() as globalThis.Crypto; global.TextEncoder = require('text-encoding').TextEncoder; global.TextDecoder = require('text-encoding').TextDecoder; global.MessageChannel = require('worker_threads').MessageChannel;