Point to official noble-hashes and noble-curve libs

This commit is contained in:
larabr 2024-05-02 19:03:50 +02:00 committed by larabr
parent d1a24d1758
commit ec52bdea83
6 changed files with 57 additions and 93 deletions

View File

@ -102,7 +102,7 @@ module.exports = {
'import/no-unassigned-import': 'error',
'import/no-unresolved': ['error', {
// esm exports not supported: https://github.com/import-js/eslint-plugin-import/issues/1810
ignore: ['openpgp', '@openpgp/noble-hashes', '@openpgp/web-stream-tools', '@openpgp/asmcrypto.js']
ignore: ['openpgp', '@noble/hashes', '@openpgp/web-stream-tools', '@openpgp/asmcrypto.js']
}],
'import/prefer-default-export': 'off',

120
package-lock.json generated
View File

@ -9,10 +9,10 @@
"version": "6.0.0-beta.0",
"license": "LGPL-3.0+",
"devDependencies": {
"@noble/curves": "^1.3.0",
"@noble/hashes": "^1.3.3",
"@openpgp/asmcrypto.js": "^3.1.0",
"@openpgp/jsdoc": "^3.6.11",
"@openpgp/noble-curves": "^1.3.0",
"@openpgp/noble-hashes": "^1.3.3",
"@openpgp/seek-bzip": "^1.0.5-git",
"@openpgp/tweetnacl": "^1.0.4-1",
"@openpgp/web-stream-tools": "~0.1.1",
@ -762,6 +762,30 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"node_modules/@noble/curves": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.0.tgz",
"integrity": "sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==",
"dev": true,
"dependencies": {
"@noble/hashes": "1.4.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@noble/hashes": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz",
"integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==",
"dev": true,
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@ -832,34 +856,6 @@
"node": ">=12.0.0"
}
},
"node_modules/@openpgp/noble-curves": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@openpgp/noble-curves/-/noble-curves-1.3.0.tgz",
"integrity": "sha512-6QjsDyzTc5AZMC3CDRcp2L/VuxIcfxFT4kCWAV/gk4OcjWtgh49S5M7pjkOzYzjhpapu5HYIWkuUdTxDC5WXEw==",
"dev": true,
"dependencies": {
"@openpgp/noble-hashes": "1.3.3"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@openpgp/noble-hashes": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/@openpgp/noble-hashes/-/noble-hashes-1.3.3.tgz",
"integrity": "sha512-CPDNePrQTQrL5Fxd/K3B53Gty4xbNVxnMSUdDmYjW5tTpRqOlme0INYTnnQqoE/XUdIlq5fByOMDuDWR5JpXZw==",
"dev": true,
"dependencies": {
"@types/bn.js": "^4.11.6",
"bn.js": "^4.11.8"
},
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@openpgp/seek-bzip": {
"version": "1.0.5-git",
"resolved": "https://registry.npmjs.org/@openpgp/seek-bzip/-/seek-bzip-1.0.5-git.tgz",
@ -1346,15 +1342,6 @@
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
"dev": true
},
"node_modules/@types/bn.js": {
"version": "4.11.6",
"resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz",
"integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/chai": {
"version": "4.3.14",
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.14.tgz",
@ -1865,12 +1852,6 @@
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
"dev": true
},
"node_modules/bn.js": {
"version": "4.12.0",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz",
"integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==",
"dev": true
},
"node_modules/body-parser": {
"version": "1.20.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
@ -8441,6 +8422,21 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"@noble/curves": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.0.tgz",
"integrity": "sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==",
"dev": true,
"requires": {
"@noble/hashes": "1.4.0"
}
},
"@noble/hashes": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz",
"integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==",
"dev": true
},
"@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@ -8496,25 +8492,6 @@
"underscore": "~1.13.2"
}
},
"@openpgp/noble-curves": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@openpgp/noble-curves/-/noble-curves-1.3.0.tgz",
"integrity": "sha512-6QjsDyzTc5AZMC3CDRcp2L/VuxIcfxFT4kCWAV/gk4OcjWtgh49S5M7pjkOzYzjhpapu5HYIWkuUdTxDC5WXEw==",
"dev": true,
"requires": {
"@openpgp/noble-hashes": "1.3.3"
}
},
"@openpgp/noble-hashes": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/@openpgp/noble-hashes/-/noble-hashes-1.3.3.tgz",
"integrity": "sha512-CPDNePrQTQrL5Fxd/K3B53Gty4xbNVxnMSUdDmYjW5tTpRqOlme0INYTnnQqoE/XUdIlq5fByOMDuDWR5JpXZw==",
"dev": true,
"requires": {
"@types/bn.js": "^4.11.6",
"bn.js": "^4.11.8"
}
},
"@openpgp/seek-bzip": {
"version": "1.0.5-git",
"resolved": "https://registry.npmjs.org/@openpgp/seek-bzip/-/seek-bzip-1.0.5-git.tgz",
@ -8806,15 +8783,6 @@
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
"dev": true
},
"@types/bn.js": {
"version": "4.11.6",
"resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz",
"integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/chai": {
"version": "4.3.14",
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.14.tgz",
@ -9223,12 +9191,6 @@
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
"dev": true
},
"bn.js": {
"version": "4.12.0",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz",
"integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==",
"dev": true
},
"body-parser": {
"version": "1.20.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",

View File

@ -62,10 +62,10 @@
"postversion": "git push && git push --tags && npm publish"
},
"devDependencies": {
"@noble/curves": "^1.3.0",
"@noble/hashes": "^1.3.3",
"@openpgp/asmcrypto.js": "^3.1.0",
"@openpgp/jsdoc": "^3.6.11",
"@openpgp/noble-curves": "^1.3.0",
"@openpgp/noble-hashes": "^1.3.3",
"@openpgp/seek-bzip": "^1.0.5-git",
"@openpgp/tweetnacl": "^1.0.4-1",
"@openpgp/web-stream-tools": "~0.1.1",

View File

@ -86,7 +86,9 @@ export default Object.assign([
{ file: 'dist/node/openpgp.min.mjs', format: 'es', banner, intro, plugins: [terser(terserOptions)], sourcemap: true }
].map(options => ({ ...options, inlineDynamicImports: true })),
plugins: [
resolve(),
resolve({
exportConditions: ['node'] // needed for resolution of noble-curves import of '@noble/crypto' in Node 16 and 18
}),
typescript(),
commonjs(),
replace({

View File

@ -4,11 +4,11 @@
* which share a lot of code anyway.
*/
import { sha1 } from '@openpgp/noble-hashes/sha1';
import { sha224, sha256 } from '@openpgp/noble-hashes/sha256';
import { sha384, sha512 } from '@openpgp/noble-hashes/sha512';
import { sha3_256, sha3_512 } from '@openpgp/noble-hashes/sha3';
import { ripemd160 } from '@openpgp/noble-hashes/ripemd160';
import { sha1 } from '@noble/hashes/sha1';
import { sha224, sha256 } from '@noble/hashes/sha256';
import { sha384, sha512 } from '@noble/hashes/sha512';
import { sha3_256, sha3_512 } from '@noble/hashes/sha3';
import { ripemd160 } from '@noble/hashes/ripemd160';
export const nobleHashes = new Map(Object.entries({
sha1,

View File

@ -4,14 +4,14 @@
* which share a lot of code anyway.
*/
import { p256 as nistP256 } from '@openpgp/noble-curves/p256';
import { p384 as nistP384 } from '@openpgp/noble-curves/p384';
import { p521 as nistP521 } from '@openpgp/noble-curves/p521';
import { brainpoolP256r1 } from '@openpgp/noble-curves/brainpoolP256r1';
import { brainpoolP384r1 } from '@openpgp/noble-curves/brainpoolP384r1';
import { brainpoolP512r1 } from '@openpgp/noble-curves/brainpoolP512r1';
import { x448, ed448 } from '@openpgp/noble-curves/ed448';
import { secp256k1 } from '@openpgp/noble-curves/secp256k1';
import { p256 as nistP256 } from '@noble/curves/p256';
import { p384 as nistP384 } from '@noble/curves/p384';
import { p521 as nistP521 } from '@noble/curves/p521';
import { x448, ed448 } from '@noble/curves/ed448';
import { secp256k1 } from '@noble/curves/secp256k1';
export const nobleCurves = new Map(Object.entries({
nistP256,