2020-04-10 13:50:40 +00:00
|
|
|
// For this example, we'll use the Extensible trait, the Extension trait, the Actor trait, and
|
|
|
|
// the Person type
|
|
|
|
use activitystreams::{actor::Actor, ext::Extension};
|
2020-04-17 15:33:55 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2020-04-10 13:50:40 +00:00
|
|
|
|
|
|
|
// The following is taken from here:
|
|
|
|
// https://docs.rs/activitystreams/0.5.0-alpha.17/activitystreams/ext/index.html
|
|
|
|
|
2020-04-17 15:33:55 +00:00
|
|
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
2020-04-10 13:50:40 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
pub struct PublicKey {
|
|
|
|
pub id: String,
|
|
|
|
pub owner: String,
|
|
|
|
pub public_key_pem: String,
|
|
|
|
}
|
|
|
|
|
2020-04-17 15:33:55 +00:00
|
|
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
2020-04-10 13:50:40 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
pub struct PublicKeyExtension {
|
|
|
|
pub public_key: PublicKey,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl PublicKey {
|
|
|
|
pub fn to_ext(&self) -> PublicKeyExtension {
|
|
|
|
PublicKeyExtension {
|
|
|
|
public_key: self.to_owned(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T> Extension<T> for PublicKeyExtension where T: Actor {}
|