From 2e8d15a5302e142a146203313d4b555d43530ab1 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Thu, 12 Dec 2024 00:51:53 +0100 Subject: [PATCH] build: fix @peculiar/webcrypto is no peer dependencies but dev dependencies (#959) * build: peculiar/webcrypto is no peer dependencies but dev dependencies Signed-off-by: David Dal Busco * fix: crypto polyfill type check --------- Signed-off-by: David Dal Busco Co-authored-by: Kai Peacock --- package-lock.json | 27 +++++++++++++++++++++++++-- packages/identity/package.json | 4 ++-- packages/identity/test-setup.ts | 2 +- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index ea1cd48fe..29f8021d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3739,6 +3739,7 @@ }, "node_modules/@peculiar/asn1-schema": { "version": "2.3.13", + "dev": true, "license": "MIT", "dependencies": { "asn1js": "^3.0.5", @@ -3771,6 +3772,7 @@ }, "node_modules/@peculiar/json-schema": { "version": "1.1.12", + "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.0" @@ -3781,6 +3783,9 @@ }, "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": { "@peculiar/asn1-schema": "^2.3.8", @@ -17999,6 +18004,7 @@ }, "node_modules/webcrypto-core": { "version": "1.8.0", + "dev": true, "license": "MIT", "dependencies": { "@peculiar/asn1-schema": "^2.3.8", @@ -19751,6 +19757,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", @@ -19765,8 +19772,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": { @@ -19783,6 +19789,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 0a05f3520..cf948f5ae 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", diff --git a/packages/identity/test-setup.ts b/packages/identity/test-setup.ts index b4bf8d099..6b95872a7 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;