quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

commit 36e7fabe75facc704e0e53e882a0f5c0cb6625c9
parent 0a1a78ec1ca6ff2fb02dc87a47109df0272cbd06
Author: Florian Dold <florian@dold.me>
Date:   Tue,  3 Jun 2025 20:45:58 +0200

avoid magic number, call it seed

In the core Taler / GNUnet code base, we (somewhat incorrectly) use
the name "private key" for what libsodium calls "secret seed".

Issue: https://bugs.taler.net/n/9952

Diffstat:
Mtart_module.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tart_module.c b/tart_module.c @@ -542,7 +542,8 @@ static JSValue js_talercrypto_eddsa_key_get_public(JSContext *ctx, JSValue this_ unsigned char pk[crypto_sign_PUBLICKEYBYTES]; unsigned char sk[crypto_sign_SECRETKEYBYTES]; - buf = expect_fixed_buffer(ctx, argv[0], 32, "eddsa private key"); + buf = expect_fixed_buffer(ctx, argv[0], crypto_sign_SEEDBYTES, + "eddsa private key seed"); if (!buf) { goto exception; @@ -566,7 +567,7 @@ static JSValue js_talercrypto_ecdhe_key_get_public(JSContext *ctx, JSValue this_ uint8_t *buf; unsigned char pk[crypto_scalarmult_BYTES]; - buf = expect_fixed_buffer(ctx, argv[0], 32, "ecdh private key"); + buf = expect_fixed_buffer(ctx, argv[0], crypto_sign_SEEDBYTES, "ecdh private key seed"); if (!buf) { goto exception; @@ -610,7 +611,7 @@ static JSValue js_talercrypto_eddsa_sign(JSContext *ctx, JSValue this_val, return JS_EXCEPTION; } if (seed_size != 32) { - return JS_ThrowTypeError(ctx, "invalid private key size"); + return JS_ThrowTypeError(ctx, "invalid private key seed size"); } if (0 != crypto_sign_seed_keypair(pk, sk, seed)) {