From 7f1cb20a205062870b2d5d674b0a5ac09cb320ff Mon Sep 17 00:00:00 2001 From: Milad Raeisi Date: Mon, 11 Nov 2024 18:49:59 +0400 Subject: [PATCH] Update packages --- package-lock.json | 46 +++++++++++++---------------------- package.json | 6 ++--- src/app/services/utilities.ts | 17 ++++++++----- 3 files changed, 31 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0695d41..a306e11 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "@ngneat/cashew": "^4.1.0", "@ngneat/transloco": "6.0.4", "@noble/hashes": "^1.5.0", - "@noble/secp256k1": "1.7.1", + "@noble/secp256k1": "2.1.0", "@types/qrcode": "^1.5.5", "@webbtc/webln-types": "^3.0.0", "@zxing/library": "^0.21.3", @@ -57,7 +57,7 @@ "luxon": "3.5.0", "moment": "^2.30.1", "ng-apexcharts": "1.12.0", - "ngx-indexed-db": "^19.0.1", + "ngx-indexed-db": "^19.1.0", "ngx-infinite-scroll": "^18.0.0", "ngx-quill": "26.0.9", "nostr-tools": "^2.10.1", @@ -96,7 +96,7 @@ "karma-jasmine": "5.1.0", "karma-jasmine-html-reporter": "2.1.0", "lodash": "4.17.21", - "postcss": "8.4.47", + "postcss": "8.4.48", "prettier": "^3.3.3", "prettier-plugin-organize-imports": "4.1.0", "prettier-plugin-tailwindcss": "0.6.8", @@ -4329,16 +4329,13 @@ } }, "node_modules/@noble/secp256k1": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", - "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "license": "MIT" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-2.1.0.tgz", + "integrity": "sha512-XLEQQNdablO0XZOIniFQimiXsZDNwaYgL96dZwC54Q30imSbAOFf3NKtepc+cXyuZf5Q1HCgbqgZ2UFFuHVcEw==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", @@ -4397,15 +4394,6 @@ "node": ">=16" } }, - "node_modules/@nostr-dev-kit/ndk/node_modules/@noble/secp256k1": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-2.1.0.tgz", - "integrity": "sha512-XLEQQNdablO0XZOIniFQimiXsZDNwaYgL96dZwC54Q30imSbAOFf3NKtepc+cXyuZf5Q1HCgbqgZ2UFFuHVcEw==", - "license": "MIT", - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "node_modules/@npmcli/agent": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-2.2.2.tgz", @@ -12547,9 +12535,9 @@ } }, "node_modules/ngx-indexed-db": { - "version": "19.0.1", - "resolved": "https://registry.npmjs.org/ngx-indexed-db/-/ngx-indexed-db-19.0.1.tgz", - "integrity": "sha512-p6OWHJjseJXNKuGISU7yXsX7co0Z4EH3KJ3KVFzSiE8NjEZ6/upFqM87z9UOOa3/Ie+8M1D1VZqafVB8HydZQw==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/ngx-indexed-db/-/ngx-indexed-db-19.1.0.tgz", + "integrity": "sha512-QFLjrslVp1v2UTYer3q3H4rceQ29u4sMTD/GwHNyYnlhbx/O7wThrRJBac+Wo5tmxzc1e9vOFkWxo9XkpIXILw==", "license": "ISC", "dependencies": { "tslib": "^2.0.0" @@ -16607,9 +16595,9 @@ } }, "node_modules/postcss": { - "version": "8.4.47", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", - "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", + "version": "8.4.48", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.48.tgz", + "integrity": "sha512-GCRK8F6+Dl7xYniR5a4FYbpBzU8XnZVeowqsQFYdcXuSbChgiks7qybSkbvnaeqv0G0B+dd9/jJgH8kkLDQeEA==", "funding": [ { "type": "opencollective", @@ -16627,7 +16615,7 @@ "license": "MIT", "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.1.0", + "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, "engines": { diff --git a/package.json b/package.json index a824318..8ae1386 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@ngneat/cashew": "^4.1.0", "@ngneat/transloco": "6.0.4", "@noble/hashes": "^1.5.0", - "@noble/secp256k1": "1.7.1", + "@noble/secp256k1": "2.1.0", "@types/qrcode": "^1.5.5", "@webbtc/webln-types": "^3.0.0", "@zxing/library": "^0.21.3", @@ -65,7 +65,7 @@ "luxon": "3.5.0", "moment": "^2.30.1", "ng-apexcharts": "1.12.0", - "ngx-indexed-db": "^19.0.1", + "ngx-indexed-db": "^19.1.0", "ngx-infinite-scroll": "^18.0.0", "ngx-quill": "26.0.9", "nostr-tools": "^2.10.1", @@ -104,7 +104,7 @@ "karma-jasmine": "5.1.0", "karma-jasmine-html-reporter": "2.1.0", "lodash": "4.17.21", - "postcss": "8.4.47", + "postcss": "8.4.48", "prettier": "^3.3.3", "prettier-plugin-organize-imports": "4.1.0", "prettier-plugin-tailwindcss": "0.6.8", diff --git a/src/app/services/utilities.ts b/src/app/services/utilities.ts index 5e56ee4..55167f4 100644 --- a/src/app/services/utilities.ts +++ b/src/app/services/utilities.ts @@ -164,12 +164,14 @@ export class Utilities { return value; } - private hexToArray(value: string) { - return secp.utils.hexToBytes(value); + private hexToArray(value: string): Uint8Array { + return new Uint8Array(value.match(/.{1,2}/g)?.map(byte => parseInt(byte, 16)) || []); } - arrayToHex(value: Uint8Array) { - return secp.utils.bytesToHex(value); + arrayToHex(value: Uint8Array): string { + return Array.from(value) + .map(byte => byte.toString(16).padStart(2, '0')) + .join(''); } convertFromBech32(address: any) { @@ -191,10 +193,13 @@ export class Utilities { return new TextDecoder().decode(Uint8Array.from(buf)); } - keyToHex(publicKey: Uint8Array) { - return secp.utils.bytesToHex(publicKey); + keyToHex(publicKey: Uint8Array): string { + return Array.from(publicKey) + .map(byte => byte.toString(16).padStart(2, '0')) + .join(''); } + sanitizeLUD06(url?: string) { // Do not allow http prefix. if (!url) {