diff options
author | Dessalines <tyhou13@gmx.com> | 2020-04-24 22:34:51 -0400 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-04-24 22:34:51 -0400 |
commit | b5a5b307a0bc6d920fa7418c6dc2e535380b3071 (patch) | |
tree | d9ee3619fa545e06d839cc7b4c44215f7702748a /server/src/apub/mod.rs | |
parent | df9135f41042148e13cc3d9803dd935d1d11fb7a (diff) |
Adding get_public_key_ext() to ActorType trait.
Diffstat (limited to 'server/src/apub/mod.rs')
-rw-r--r-- | server/src/apub/mod.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/src/apub/mod.rs b/server/src/apub/mod.rs index 05792968..9c02d107 100644 --- a/server/src/apub/mod.rs +++ b/server/src/apub/mod.rs @@ -141,6 +141,8 @@ pub trait FromApub { pub trait ActorType { fn actor_id(&self) -> String; + fn public_key(&self) -> String; + fn get_inbox_url(&self) -> String { format!("{}/inbox", &self.actor_id()) } @@ -157,4 +159,13 @@ pub trait ActorType { fn get_liked_url(&self) -> String { format!("{}/liked", &self.actor_id()) } + + fn get_public_key_ext(&self) -> PublicKeyExtension { + PublicKey { + id: format!("{}#main-key", self.actor_id()), + owner: self.actor_id(), + public_key_pem: self.public_key(), + } + .to_ext() + } } |