Remove some unnecessary code.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4350 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-07-18 00:52:08 +00:00
parent a2542c658b
commit 68ca99e9d9

View File

@ -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))