Use internal tweetnacl SHA-512 implementation

Instead of relying on externally provided one (no async loading supported)
This commit is contained in:
larabr 2023-10-12 13:56:02 +02:00
parent 7295a2e7b3
commit a56a4a16e8
8 changed files with 14 additions and 20 deletions

14
package-lock.json generated
View File

@ -17,7 +17,7 @@
"@openpgp/noble-curves": "^1.2.1-0",
"@openpgp/noble-hashes": "^1.3.3-0",
"@openpgp/seek-bzip": "^1.0.5-git",
"@openpgp/tweetnacl": "^1.0.3",
"@openpgp/tweetnacl": "^1.0.4-1",
"@openpgp/web-stream-tools": "^0.0.14",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-commonjs": "^24.0.1",
@ -663,9 +663,9 @@
}
},
"node_modules/@openpgp/tweetnacl": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@openpgp/tweetnacl/-/tweetnacl-1.0.3.tgz",
"integrity": "sha512-KGXNhU/mRg+uTsLGva55V340jwbX2pC8LndjOVI2oQ8vewPVTS2KnDOIXQ8O6KyT/c9Qy16KUQ5mwewe72m1Yw==",
"version": "1.0.4-1",
"resolved": "https://registry.npmjs.org/@openpgp/tweetnacl/-/tweetnacl-1.0.4-1.tgz",
"integrity": "sha512-coYo04Op1+g4h6yE6q0GglGdvWkdfvpQWKmR9nDIrW+LqdTtwHFXIyIQGs5cosR4tCajxRn9aF/+WK207zxFrg==",
"dev": true
},
"node_modules/@openpgp/web-stream-tools": {
@ -8010,9 +8010,9 @@
}
},
"@openpgp/tweetnacl": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@openpgp/tweetnacl/-/tweetnacl-1.0.3.tgz",
"integrity": "sha512-KGXNhU/mRg+uTsLGva55V340jwbX2pC8LndjOVI2oQ8vewPVTS2KnDOIXQ8O6KyT/c9Qy16KUQ5mwewe72m1Yw==",
"version": "1.0.4-1",
"resolved": "https://registry.npmjs.org/@openpgp/tweetnacl/-/tweetnacl-1.0.4-1.tgz",
"integrity": "sha512-coYo04Op1+g4h6yE6q0GglGdvWkdfvpQWKmR9nDIrW+LqdTtwHFXIyIQGs5cosR4tCajxRn9aF/+WK207zxFrg==",
"dev": true
},
"@openpgp/web-stream-tools": {

View File

@ -67,7 +67,7 @@
"@openpgp/jsdoc": "^3.6.11",
"@openpgp/noble-hashes": "^1.3.3-0",
"@openpgp/seek-bzip": "^1.0.5-git",
"@openpgp/tweetnacl": "^1.0.3",
"@openpgp/tweetnacl": "^1.0.4-1",
"@openpgp/web-stream-tools": "^0.0.14",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-commonjs": "^24.0.1",

View File

@ -20,7 +20,7 @@
* @module crypto/public_key/elliptic/ecdh
*/
import nacl from '@openpgp/tweetnacl/nacl-fast-light';
import nacl from '@openpgp/tweetnacl';
import { CurveWithOID, jwkToRawPublic, rawPublicToJWK, privateToJWK, validateStandardParams, getNobleCurve } from './oid_curves';
import * as aesKW from '../../aes_kw';
import { getRandomBytes } from '../../random';

View File

@ -3,7 +3,7 @@
* @module crypto/public_key/elliptic/ecdh
*/
import x25519 from '@openpgp/tweetnacl/nacl-fast-light';
import x25519 from '@openpgp/tweetnacl';
import { x448 } from '@openpgp/noble-curves/ed448';
import * as aesKW from '../../aes_kw';
import { getRandomBytes } from '../../random';

View File

@ -21,7 +21,7 @@
*/
import { sha512 } from '@openpgp/noble-hashes/sha512';
import ed25519 from '@openpgp/tweetnacl/nacl-fast-light';
import ed25519 from '@openpgp/tweetnacl';
import { ed448 } from '@openpgp/noble-curves/ed448';
import util from '../../../util';
import enums from '../../../enums';

View File

@ -21,14 +21,11 @@
* @module crypto/public_key/elliptic/eddsa_legacy
*/
import { sha512 } from '@openpgp/noble-hashes/sha512';
import nacl from '@openpgp/tweetnacl/nacl-fast-light';
import nacl from '@openpgp/tweetnacl';
import util from '../../../util';
import enums from '../../../enums';
import hash from '../../hash';
nacl.hash = bytes => sha512(bytes);
/**
* Sign a message using the provided legacy EdDSA key
* @param {module:type/oid} oid - Elliptic curve object identifier

View File

@ -19,7 +19,7 @@
* @fileoverview Wrapper of an instance of an Elliptic Curve
* @module crypto/public_key/elliptic/curve
*/
import nacl from '@openpgp/tweetnacl/nacl-fast-light';
import nacl from '@openpgp/tweetnacl';
import { p256 } from '@openpgp/noble-curves/p256';
import { p384 } from '@openpgp/noble-curves/p384';
import { p521 } from '@openpgp/noble-curves/p521';

View File

@ -3,7 +3,6 @@
* @module crypto/public_key
*/
import nacl from '@openpgp/tweetnacl/nacl-fast-light';
import * as rsa from './rsa';
import * as elgamal from './elgamal';
import * as elliptic from './elliptic';
@ -17,7 +16,5 @@ export default {
/** @see module:crypto/public_key/elliptic */
elliptic: elliptic,
/** @see module:crypto/public_key/dsa */
dsa: dsa,
/** @see tweetnacl */
nacl: nacl
dsa: dsa
};