forked from cory/tildefriends
Yikes. I broke appending?
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4351 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
11
src/ssb.c
11
src/ssb.c
@ -1683,8 +1683,7 @@ bool tf_ssb_append_message_with_keys(tf_ssb_t* ssb, const char* author, const ui
|
||||
{
|
||||
JS_SetPropertyStr(context, root, "previous", JS_NULL);
|
||||
}
|
||||
JSValue authorstr = JS_NewString(context, author);
|
||||
JS_SetPropertyStr(context, root, "author", authorstr);
|
||||
JS_SetPropertyStr(context, root, "author", JS_NewString(context, author));
|
||||
JS_SetPropertyStr(context, root, "sequence", JS_NewInt64(context, previous_sequence + 1));
|
||||
|
||||
int64_t now = (int64_t)time(NULL);
|
||||
@ -1706,9 +1705,6 @@ bool tf_ssb_append_message_with_keys(tf_ssb_t* ssb, const char* author, const ui
|
||||
tf_printf("crypto_sign_detached failed\n");
|
||||
}
|
||||
|
||||
JS_FreeCString(context, json);
|
||||
JS_FreeValue(context, jsonval);
|
||||
|
||||
char signature_base64[crypto_sign_BYTES * 2];
|
||||
tf_base64_encode(signature, sizeof(signature), signature_base64, sizeof(signature_base64));
|
||||
strcat(signature_base64, ".sig.ed25519");
|
||||
@ -1733,6 +1729,8 @@ bool tf_ssb_append_message_with_keys(tf_ssb_t* ssb, const char* author, const ui
|
||||
else
|
||||
{
|
||||
tf_printf("Failed to verify message signature.\n");
|
||||
tf_printf("json = %s\n", json);
|
||||
tf_printf("sig = %s\n", signature_base64);
|
||||
}
|
||||
|
||||
if (!stored && out_id && out_id_size)
|
||||
@ -1740,6 +1738,9 @@ bool tf_ssb_append_message_with_keys(tf_ssb_t* ssb, const char* author, const ui
|
||||
*out_id = '\0';
|
||||
}
|
||||
|
||||
JS_FreeCString(context, json);
|
||||
JS_FreeValue(context, jsonval);
|
||||
|
||||
JS_FreeValue(context, root);
|
||||
return stored;
|
||||
}
|
||||
|
Reference in New Issue
Block a user