diff options
author | Felix <me@nutomic.com> | 2020-04-18 20:54:20 +0200 |
---|---|---|
committer | Felix <me@nutomic.com> | 2020-04-18 20:54:20 +0200 |
commit | 8daf72278d6c9fdd18ad2bf8c45ea4d25c428bad (patch) | |
tree | bdc2b3ad6e44d1a1ac092f14141e3d6ffdfcc3b8 /server/src/api/user.rs | |
parent | 0199b5f169d32d4ccd19751e12dcaa61a957e787 (diff) |
Add http signature to outgoing apub requests
Diffstat (limited to 'server/src/api/user.rs')
-rw-r--r-- | server/src/api/user.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/server/src/api/user.rs b/server/src/api/user.rs index fbdead53..35bdd33a 100644 --- a/server/src/api/user.rs +++ b/server/src/api/user.rs @@ -1,5 +1,6 @@ use super::*; -use crate::apub::{gen_keypair_str, make_apub_endpoint, EndpointType}; +use crate::apub::signatures::generate_actor_keypair; +use crate::apub::{make_apub_endpoint, EndpointType}; use crate::settings::Settings; use crate::{generate_random_string, send_email}; use bcrypt::verify; @@ -251,7 +252,7 @@ impl Perform<LoginResponse> for Oper<Register> { return Err(APIError::err("admin_already_created").into()); } - let (user_public_key, user_private_key) = gen_keypair_str(); + let keypair = generate_actor_keypair(); // Register the new user let user_form = UserForm { @@ -274,8 +275,8 @@ impl Perform<LoginResponse> for Oper<Register> { actor_id: make_apub_endpoint(EndpointType::User, &data.username).to_string(), bio: None, local: true, - private_key: Some(user_private_key), - public_key: Some(user_public_key), + private_key: Some(keypair.private_key), + public_key: Some(keypair.public_key), last_refreshed_at: None, }; @@ -295,7 +296,7 @@ impl Perform<LoginResponse> for Oper<Register> { } }; - let (community_public_key, community_private_key) = gen_keypair_str(); + let keypair = generate_actor_keypair(); // Create the main community if it doesn't exist let main_community: Community = match Community::read(&conn, 2) { @@ -314,8 +315,8 @@ impl Perform<LoginResponse> for Oper<Register> { updated: None, actor_id: make_apub_endpoint(EndpointType::Community, default_community_name).to_string(), local: true, - private_key: Some(community_private_key), - public_key: Some(community_public_key), + private_key: Some(keypair.private_key), + public_key: Some(keypair.public_key), last_refreshed_at: None, published: None, }; |