From 6270fd8118dbb664b137fb7f26f406e24c39b65a Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 10 Jun 2024 16:56:21 -0400 Subject: [PATCH] We don't need to go to the DB to get our public key. --- src/httpd.js.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/httpd.js.c b/src/httpd.js.c index d6cc1e5d..5f46037a 100644 --- a/src/httpd.js.c +++ b/src/httpd.js.c @@ -1153,11 +1153,6 @@ static bool _string_property_equals(JSContext* context, JSValue object, const ch return equals; } -static void _public_key_visit(const char* identity, void* user_data) -{ - snprintf(user_data, k_id_base64_len, "%s", identity); -} - static JSValue _authenticate_jwt(JSContext* context, const char* jwt) { if (!jwt) @@ -1202,7 +1197,7 @@ static JSValue _authenticate_jwt(JSContext* context, const char* jwt) tf_task_t* task = tf_task_get(context); tf_ssb_t* ssb = tf_task_get_ssb(task); char public_key_b64[k_id_base64_len] = { 0 }; - tf_ssb_db_identity_visit(ssb, ":admin", _public_key_visit, public_key_b64); + tf_ssb_whoami(ssb, public_key_b64, sizeof(public_key_b64)); const char* payload = jwt + dot[0] + 1; size_t payload_length = dot[1] - dot[0] - 1;