verify: Add an option to dump a specific message in the format that its signature validates as well as a hex representation of the bytes for good measure.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 31m2s

This commit is contained in:
2025-04-13 13:28:48 -04:00
parent a8bba324ca
commit d6926569c6
6 changed files with 45 additions and 12 deletions

View File

@ -34,6 +34,14 @@ enum
k_max_private_message_recipients = 8,
};
/**
** Flags affecting signature verification.
*/
typedef enum _tf_ssb_verify_flags_t
{
k_tf_ssb_verify_flag_debug = 1,
} tf_ssb_verify_flags_t;
/**
** The type of change to a set of connections.
*/
@ -446,6 +454,7 @@ bool tf_ssb_id_bin_to_str(char* str, size_t str_size, const uint8_t* bin);
** Verify a message's signature and remove the signature if successful.
** @param context A JS context.
** @param val The message.
** @param verify_flags Verification options of type tf_ssb_verify_flags_t.
** @param[out] out_id A buffer to receive the message's identity.
** @param out_id_size The size of out_id.
** @param[out] out_signature A buffer to receive the message's signature.
@ -453,7 +462,8 @@ bool tf_ssb_id_bin_to_str(char* str, size_t str_size, const uint8_t* bin);
** @param[out] out_flags tf_ssb_message_flags_t describing the message.
** @return True if the signature is valid and was successfully extracted.
*/
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);
bool tf_ssb_verify_and_strip_signature(
JSContext* context, JSValue val, int verify_flags, char* out_id, size_t out_id_size, char* out_signature, size_t out_signature_size, int* out_flags);
/**
** Determine the message identifier.