Rename enums.curve.x25519Legacy to .curve25519Legacy

To keep name aligned with the spec.
This commit is contained in:
larabr 2023-10-19 15:41:02 +02:00
parent 410dbcf1d5
commit fe420d0bf9
5 changed files with 8 additions and 8 deletions

4
openpgp.d.ts vendored
View File

@ -834,9 +834,9 @@ export namespace enums {
/** @deprecated use `ed25519Legacy` instead */
ed25519 = 'ed25519',
ed25519Legacy = 'ed25519',
/** @deprecated use `x25519Legacy` instead */
/** @deprecated use `curve25519Legacy` instead */
curve25519 = 'curve25519',
x25519Legacy = 'curve25519',
curve25519Legacy = 'curve25519',
secp256k1 = 'secp256k1',
brainpoolP256r1 = 'brainpoolP256r1',
brainpoolP384r1 = 'brainpoolP384r1',

View File

@ -54,10 +54,10 @@ export default {
'2B06010401DA470F01': 'ed25519',
/** Curve25519 - deprecated by crypto-refresh (replaced by standaone X25519 algo) */
'x25519Legacy': 'curve25519',
'curve25519Legacy': 'curve25519',
'X25519': 'curve25519',
'cv25519': 'curve25519',
/** @deprecated use `x25519Legacy` instead */
/** @deprecated use `curve25519Legacy` instead */
'curve25519': 'curve25519',
'Curve25519': 'curve25519',
'1.3.6.1.4.1.3029.1.5.1': 'curve25519',

View File

@ -333,8 +333,8 @@ export function sanitizeKeyOptions(options, subkeyDefaults = {}) {
} catch (e) {
throw new Error('Unknown curve');
}
if (options.curve === enums.curve.ed25519Legacy || options.curve === enums.curve.x25519Legacy) {
options.curve = options.sign ? enums.curve.ed25519Legacy : enums.curve.x25519Legacy;
if (options.curve === enums.curve.ed25519Legacy || options.curve === enums.curve.curve25519Legacy) {
options.curve = options.sign ? enums.curve.ed25519Legacy : enums.curve.curve25519Legacy;
}
if (options.sign) {
options.algorithm = options.curve === enums.curve.ed25519Legacy ? enums.publicKey.eddsaLegacy : enums.publicKey.ecdsa;

View File

@ -296,7 +296,7 @@ n9/quqtmyOtYOA6gXNCw0Fal3iANKBmsPmYI
})).to.be.eventually.rejectedWith(/ecdh keys are considered too weak/);
await expect(openpgp.encrypt({
message, encryptionKeys: [key], config: { rejectCurves: new Set([openpgp.enums.curve.x25519Legacy]) }
message, encryptionKeys: [key], config: { rejectCurves: new Set([openpgp.enums.curve.curve25519Legacy]) }
})).to.be.eventually.rejectedWith(/Support for ecdh keys using curve curve25519 is disabled/);
const echdEncrypted = await openpgp.encrypt({

View File

@ -4070,7 +4070,7 @@ XvmoLueOOShu01X/kaylMqaT8w==
const subkey = newPrivateKey.subkeys[total];
expect(subkey).to.exist;
expect(subkey.getAlgorithmInfo().algorithm).to.be.equal('ecdh');
expect(subkey.getAlgorithmInfo().curve).to.be.equal(openpgp.enums.curve.x25519Legacy);
expect(subkey.getAlgorithmInfo().curve).to.be.equal(openpgp.enums.curve.curve25519Legacy);
await subkey.verify();
});