Tests: fix flaky elliptic curve test in Node

`genKeyPair()` does not pad the returned values. This caused random test failures in Node
as some secret keys are 1 byte short.
This commit is contained in:
larabr 2023-12-08 14:46:41 +01:00
parent ff4181ad5a
commit 90a2af9fe2

View File

@ -242,7 +242,7 @@ export default () => describe('Elliptic Curve Cryptography @lightweight', functi
const curves = ['secp256k1' , 'p256', 'p384', 'p521', 'brainpoolP256r1', 'brainpoolP384r1', 'brainpoolP512r1'];
curves.forEach(curveName => it(`${curveName} - Sign and verify message`, async function () {
const curve = new elliptic_curves.CurveWithOID(curveName);
const { publicKey: keyPublic, privateKey: keyPrivate } = await curve.genKeyPair();
const { Q: keyPublic, secret: keyPrivate } = await elliptic_curves.generate(curveName);
const message = new Uint8Array([
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF