Merge pull request #1875

This commit is contained in:
larabr 2025-07-31 19:08:40 +02:00 committed by GitHub
commit 6b1da73b97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 9 additions and 12 deletions

8
package-lock.json generated
View File

@ -10,7 +10,7 @@
"license": "LGPL-3.0+",
"devDependencies": {
"@noble/ciphers": "^1.3.0",
"@noble/curves": "^1.9.2",
"@noble/curves": "^1.9.5",
"@noble/hashes": "^1.8.0",
"@openpgp/jsdoc": "^3.6.11",
"@openpgp/seek-bzip": "^1.0.5-git",
@ -971,9 +971,9 @@
}
},
"node_modules/@noble/curves": {
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.2.tgz",
"integrity": "sha512-HxngEd2XUcg9xi20JkwlLCtYwfoFw4JGkuZpT+WlsPD4gB/cxkvTD8fSsoAnphGZhFdZYKeQIPCuFlWPm1uE0g==",
"version": "1.9.5",
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.5.tgz",
"integrity": "sha512-IHiC8xU74NLKg7gNmwMbUVtqqZy9OWKphTAChESCgsXI5NTK6n3ewOFXrj4Dxal/Ml8D3msbPIHfpHLwv50Q2w==",
"dev": true,
"license": "MIT",
"dependencies": {

View File

@ -64,7 +64,7 @@
},
"devDependencies": {
"@noble/ciphers": "^1.3.0",
"@noble/curves": "^1.9.2",
"@noble/curves": "^1.9.5",
"@noble/hashes": "^1.8.0",
"@openpgp/jsdoc": "^3.6.11",
"@openpgp/seek-bzip": "^1.0.5-git",

View File

@ -61,8 +61,7 @@ export async function generate(algo) {
case enums.publicKey.x448: {
const x448 = await util.getNobleCurve(enums.publicKey.x448);
const k = x448.utils.randomPrivateKey();
const A = x448.getPublicKey(k);
const { secretKey: k, publicKey: A } = x448.keygen();
return { A, k };
}
default:
@ -246,10 +245,9 @@ export async function generateEphemeralEncryptionMaterial(algo, recipientA) {
}
case enums.publicKey.x448: {
const x448 = await util.getNobleCurve(enums.publicKey.x448);
const ephemeralSecretKey = x448.utils.randomPrivateKey();
const { secretKey: ephemeralSecretKey, publicKey: ephemeralPublicKey } = x448.keygen();
const sharedSecret = x448.getSharedSecret(ephemeralSecretKey, recipientA);
assertNonZeroArray(sharedSecret);
const ephemeralPublicKey = x448.getPublicKey(ephemeralSecretKey);
return { ephemeralPublicKey, sharedSecret };
}
default:

View File

@ -67,8 +67,7 @@ export async function generate(algo) {
case enums.publicKey.ed448: {
const ed448 = await util.getNobleCurve(enums.publicKey.ed448);
const seed = ed448.utils.randomPrivateKey();
const A = ed448.getPublicKey(seed);
const { secretKey: seed, publicKey: A } = ed448.keygen();
return { A, seed };
}
default:

View File

@ -297,7 +297,7 @@ export {
//////////////////////////
async function jsGenKeyPair(name) {
const nobleCurve = await util.getNobleCurve(enums.publicKey.ecdsa, name); // excluding curve25519Legacy, ecdh and ecdsa use the same curves
const privateKey = nobleCurve.utils.randomPrivateKey();
const { secretKey: privateKey } = nobleCurve.keygen();
const publicKey = nobleCurve.getPublicKey(privateKey, false);
return { publicKey, privateKey };
}