forked from cory/tildefriends
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.
This commit is contained in:
12
src/main.c
12
src/main.c
@ -1161,17 +1161,19 @@ static int _tf_command_verify(const char* file, int argc, char* argv[])
|
||||
const char* identity = NULL;
|
||||
const char* default_db_path = _get_db_path();
|
||||
const char* db_path = default_db_path;
|
||||
int64_t sequence = 0;
|
||||
bool show_usage = false;
|
||||
|
||||
while (!show_usage)
|
||||
{
|
||||
static const struct option k_options[] = {
|
||||
{ "id", required_argument, NULL, 'i' },
|
||||
{ "sequence", required_argument, NULL, 's' },
|
||||
{ "db-path", required_argument, NULL, 'd' },
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ 0 },
|
||||
};
|
||||
int c = getopt_long(argc, argv, "i:d:h", k_options, NULL);
|
||||
int c = getopt_long(argc, argv, "i:s:d:h", k_options, NULL);
|
||||
if (c == -1)
|
||||
{
|
||||
break;
|
||||
@ -1187,6 +1189,9 @@ static int _tf_command_verify(const char* file, int argc, char* argv[])
|
||||
case 'i':
|
||||
identity = optarg;
|
||||
break;
|
||||
case 's':
|
||||
sequence = atoll(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
db_path = optarg;
|
||||
break;
|
||||
@ -1198,6 +1203,7 @@ static int _tf_command_verify(const char* file, int argc, char* argv[])
|
||||
tf_printf("\n%s import [options] [paths...]\n\n", file);
|
||||
tf_printf("options:\n");
|
||||
tf_printf(" -i, --identity identity Identity to verify.\n");
|
||||
tf_printf(" -s, --sequence sequence Sequence number to debug.\n");
|
||||
tf_printf(" -d, --db-path db_path SQLite database path (default: %s).\n", default_db_path);
|
||||
tf_printf(" -h, --help Show this usage information.\n");
|
||||
tf_free((void*)default_db_path);
|
||||
@ -1209,7 +1215,7 @@ static int _tf_command_verify(const char* file, int argc, char* argv[])
|
||||
if (identity)
|
||||
{
|
||||
tf_printf("Verifying %s...\n", identity);
|
||||
verified = tf_ssb_db_verify(ssb, identity, true);
|
||||
verified = tf_ssb_db_verify(ssb, identity, sequence, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1222,7 +1228,7 @@ static int _tf_command_verify(const char* file, int argc, char* argv[])
|
||||
{
|
||||
const char* identity = (const char*)sqlite3_column_text(statement, 0);
|
||||
tf_printf("Verifying %s...", identity);
|
||||
if (tf_ssb_db_verify(ssb, identity, true))
|
||||
if (tf_ssb_db_verify(ssb, identity, sequence, true))
|
||||
{
|
||||
tf_printf("success.\n");
|
||||
}
|
||||
|
Reference in New Issue
Block a user