From c428394bb6f0a0e8f6523a1024bdbf30a5f6c2f6 Mon Sep 17 00:00:00 2001 From: Christophe Diederichs Date: Tue, 23 May 2023 17:28:44 +0100 Subject: [PATCH] fix minor api mismatch --- crypto_sign_ed25519.js | 6 +++--- package.json | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/crypto_sign_ed25519.js b/crypto_sign_ed25519.js index a08b677..b0c2760 100644 --- a/crypto_sign_ed25519.js +++ b/crypto_sign_ed25519.js @@ -190,7 +190,7 @@ function _crypto_sign_ed25519_verify_detached(sig, m, pk, prehashed) { ec.ge25519_double_scalarmult_vartime(R, h, A, sig.subarray(32)) ec.ge25519_tobytes(rcheck, R) - return crypto_verify_32(rcheck, 0, sig, 0) === 0 + return crypto_verify_32(rcheck, 0, sig, 0) } function crypto_sign_ed25519_verify_detached (sig, m, pk) { @@ -199,12 +199,12 @@ function crypto_sign_ed25519_verify_detached (sig, m, pk) { function crypto_sign_ed25519_open (m, sm, pk) { if (sm.byteLength < 64 || sm.byteLength - 64 > crypto_sign_ed25519_MESSAGEBYTES_MAX) { - throw new Error('Bad signature.') + return false } if (!crypto_sign_ed25519_verify_detached(sm, sm.subarray(64), pk)) { if (m.byteLength) m.fill(0) - throw new Error('Bad signature.') + return false } if (m.byteLength) { diff --git a/package.json b/package.json index a64fa02..1bd9fb5 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,8 @@ "xsalsa20": "^1.0.0" }, "devDependencies": { - "browser-run": "^4.0.2", - "browserify": "^14.1.0", "brittle": "^3.2.1", + "browser-run": "^4.0.2", "browserify": "^16.5.1", "sodium-native": "^3.4.1", "standard": "^15.0.1"