diff --git a/src/ssb.c b/src/ssb.c index 9059139d..9e92dcd5 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -1701,6 +1701,10 @@ bool tf_ssb_append_message_with_keys(tf_ssb_t* ssb, const char* author, const ui uint8_t signature[crypto_sign_BYTES]; unsigned long long siglen; bool valid = crypto_sign_detached(signature, &siglen, (const uint8_t*)json, len, private_key) == 0; + if (!valid) + { + tf_printf("crypto_sign_detached failed\n"); + } JS_FreeCString(context, json); JS_FreeValue(context, jsonval); @@ -1711,13 +1715,6 @@ bool tf_ssb_append_message_with_keys(tf_ssb_t* ssb, const char* author, const ui JSValue sigstr = JS_NewString(context, signature_base64); JS_SetPropertyStr(context, root, "signature", sigstr); - jsonval = JS_JSONStringify(context, root, JS_NULL, JS_NewInt32(context, 2)); - len = 0; - json = JS_ToCStringLen(context, &len, jsonval); - - JS_FreeCString(context, json); - JS_FreeValue(context, jsonval); - bool stored = false; char id[sodium_base64_ENCODED_LEN(crypto_hash_sha256_BYTES, sodium_base64_VARIANT_ORIGINAL) + 7 + 1]; if (valid && tf_ssb_verify_and_strip_signature(ssb->context, root, id, sizeof(id), NULL, 0, NULL))