Rename sequence_before_author => flags. #29

This commit is contained in:
2024-03-13 19:40:09 -04:00
parent 9de33d06d2
commit 537a8654fa
5 changed files with 50 additions and 41 deletions

View File

@ -1003,14 +1003,13 @@ static bool _tf_ssb_verify_and_strip_signature_internal(JSContext* context, JSVa
return verified;
}
bool tf_ssb_verify_and_strip_signature(
JSContext* context, JSValue val, char* out_id, size_t out_id_size, char* out_signature, size_t out_signature_size, bool* out_sequence_before_author)
bool tf_ssb_verify_and_strip_signature(JSContext* context, JSValue val, char* out_id, size_t out_id_size, char* out_signature, size_t out_signature_size, int* out_flags)
{
if (_tf_ssb_verify_and_strip_signature_internal(context, val, out_id, out_id_size, out_signature, out_signature_size))
{
if (out_sequence_before_author)
if (out_flags)
{
*out_sequence_before_author = false;
*out_flags = 0;
}
return true;
}
@ -1028,9 +1027,9 @@ bool tf_ssb_verify_and_strip_signature(
JS_FreeValue(context, reordered);
if (result)
{
if (out_sequence_before_author)
if (out_flags)
{
*out_sequence_before_author = true;
*out_flags = k_tf_ssb_message_flag_sequence_before_author;
}
return true;
}
@ -3562,11 +3561,11 @@ void tf_ssb_verify_strip_and_store_message(tf_ssb_t* ssb, JSValue value, tf_ssb_
.user_data = user_data,
};
char signature[crypto_sign_BYTES + 128] = { 0 };
bool sequence_before_author = false;
if (tf_ssb_verify_and_strip_signature(context, value, async->id, sizeof(async->id), signature, sizeof(signature), &sequence_before_author))
int flags = 0;
if (tf_ssb_verify_and_strip_signature(context, value, async->id, sizeof(async->id), signature, sizeof(signature), &flags))
{
async->verified = true;
tf_ssb_db_store_message(ssb, context, async->id, value, signature, sequence_before_author, _tf_ssb_verify_strip_and_store_callback, async);
tf_ssb_db_store_message(ssb, context, async->id, value, signature, flags, _tf_ssb_verify_strip_and_store_callback, async);
}
else
{