summaryrefslogtreecommitdiffstats
path: root/server/src/api/community.rs
diff options
context:
space:
mode:
authorFelix <me@nutomic.com>2020-04-18 20:54:20 +0200
committerFelix <me@nutomic.com>2020-04-18 20:54:20 +0200
commit8daf72278d6c9fdd18ad2bf8c45ea4d25c428bad (patch)
treebdc2b3ad6e44d1a1ac092f14141e3d6ffdfcc3b8 /server/src/api/community.rs
parent0199b5f169d32d4ccd19751e12dcaa61a957e787 (diff)
Add http signature to outgoing apub requests
Diffstat (limited to 'server/src/api/community.rs')
-rw-r--r--server/src/api/community.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/src/api/community.rs b/server/src/api/community.rs
index 40d8afe3..30c8aa20 100644
--- a/server/src/api/community.rs
+++ b/server/src/api/community.rs
@@ -1,6 +1,7 @@
use super::*;
use crate::apub::activities::follow_community;
-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 diesel::PgConnection;
use std::str::FromStr;
@@ -200,7 +201,7 @@ impl Perform<CommunityResponse> for Oper<CreateCommunity> {
}
// When you create a community, make sure the user becomes a moderator and a follower
- let (community_public_key, community_private_key) = gen_keypair_str();
+ let keypair = generate_actor_keypair();
let community_form = CommunityForm {
name: data.name.to_owned(),
@@ -214,8 +215,8 @@ impl Perform<CommunityResponse> for Oper<CreateCommunity> {
updated: None,
actor_id: make_apub_endpoint(EndpointType::Community, &data.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,
};