No more secrets in ~/.config, and speed up some tests.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4002 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-10-14 12:27:34 +00:00
parent 70866e03c8
commit f53ce584e3
10 changed files with 66 additions and 199 deletions

View File

@ -815,6 +815,24 @@ int tf_ssb_db_identity_get_count_for_user(tf_ssb_t* ssb, const char* user)
return count;
}
bool tf_ssb_db_identity_create(tf_ssb_t* ssb, const char* user, uint8_t* out_public_key, uint8_t* out_private_key)
{
int count = tf_ssb_db_identity_get_count_for_user(ssb, user);
if (count < 16)
{
char public[512];
char private[512];
tf_ssb_generate_keys_buffer(public, sizeof(public), private, sizeof(private));
if (tf_ssb_db_identity_add(ssb, user, public, private))
{
tf_ssb_id_str_to_bin(out_public_key, public);
tf_ssb_id_str_to_bin(out_private_key, private);
return true;
}
}
return false;
}
bool tf_ssb_db_identity_add(tf_ssb_t* ssb, const char* user, const char* public_key, const char* private_key)
{
bool added = false;