mirror of
https://github.com/LemmyNet/activitypub-federation-rust
synced 2024-12-03 16:49:14 +00:00
Remove verify methods (fixes #15)
This commit is contained in:
parent
c260c0d5ba
commit
3233117e8b
15 changed files with 0 additions and 137 deletions
|
@ -38,14 +38,6 @@ impl ActivityHandler for Accept {
|
|||
self.actor.inner()
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
&self,
|
||||
_data: &Data<Self::DataType>,
|
||||
_request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn receive(
|
||||
self,
|
||||
_data: &Data<Self::DataType>,
|
||||
|
|
|
@ -50,15 +50,6 @@ impl ActivityHandler for CreateNote {
|
|||
self.actor.inner()
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
&self,
|
||||
data: &Data<Self::DataType>,
|
||||
request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
MyPost::verify(&self.object, self.id(), data, request_counter).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn receive(
|
||||
self,
|
||||
data: &Data<Self::DataType>,
|
||||
|
|
|
@ -47,14 +47,6 @@ impl ActivityHandler for Follow {
|
|||
self.actor.inner()
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
&self,
|
||||
_data: &Data<Self::DataType>,
|
||||
_request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Ignore clippy false positive: https://github.com/rust-lang/rust-clippy/issues/6446
|
||||
#[allow(clippy::await_holding_lock)]
|
||||
async fn receive(
|
||||
|
|
|
@ -64,15 +64,6 @@ impl ApubObject for MyPost {
|
|||
})
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
_apub: &Self::ApubType,
|
||||
_expected_domain: &Url,
|
||||
_data: &Self::DataType,
|
||||
_request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn from_apub(
|
||||
apub: Self::ApubType,
|
||||
data: &Self::DataType,
|
||||
|
|
|
@ -159,15 +159,6 @@ impl ApubObject for MyUser {
|
|||
})
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
_apub: &Self::ApubType,
|
||||
_expected_domain: &Url,
|
||||
_data: &Self::DataType,
|
||||
_request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn from_apub(
|
||||
apub: Self::ApubType,
|
||||
_data: &Self::DataType,
|
||||
|
|
|
@ -38,14 +38,6 @@ impl ActivityHandler for Accept {
|
|||
self.actor.inner()
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
&self,
|
||||
_data: &Data<Self::DataType>,
|
||||
_request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn receive(
|
||||
self,
|
||||
_data: &Data<Self::DataType>,
|
||||
|
|
|
@ -50,15 +50,6 @@ impl ActivityHandler for CreateNote {
|
|||
self.actor.inner()
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
&self,
|
||||
data: &Data<Self::DataType>,
|
||||
request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
MyPost::verify(&self.object, self.id(), data, request_counter).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn receive(
|
||||
self,
|
||||
data: &Data<Self::DataType>,
|
||||
|
|
|
@ -47,14 +47,6 @@ impl ActivityHandler for Follow {
|
|||
self.actor.inner()
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
&self,
|
||||
_data: &Data<Self::DataType>,
|
||||
_request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Ignore clippy false positive: https://github.com/rust-lang/rust-clippy/issues/6446
|
||||
#[allow(clippy::await_holding_lock)]
|
||||
async fn receive(
|
||||
|
|
|
@ -64,15 +64,6 @@ impl ApubObject for MyPost {
|
|||
})
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
_apub: &Self::ApubType,
|
||||
_expected_domain: &Url,
|
||||
_data: &Self::DataType,
|
||||
_request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn from_apub(
|
||||
apub: Self::ApubType,
|
||||
data: &Self::DataType,
|
||||
|
|
|
@ -159,15 +159,6 @@ impl ApubObject for MyUser {
|
|||
})
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
_apub: &Self::ApubType,
|
||||
_expected_domain: &Url,
|
||||
_data: &Self::DataType,
|
||||
_request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn from_apub(
|
||||
apub: Self::ApubType,
|
||||
_data: &Self::DataType,
|
||||
|
|
|
@ -42,9 +42,6 @@ where
|
|||
actor.public_key(),
|
||||
)?;
|
||||
|
||||
debug!("Verifying activity {}", activity.id().to_string());
|
||||
activity.verify(data, request_counter).await?;
|
||||
|
||||
debug!("Receiving activity {}", activity.id().to_string());
|
||||
activity.receive(data, request_counter).await?;
|
||||
Ok(HttpResponse::Ok().finish())
|
||||
|
|
|
@ -38,9 +38,6 @@ where
|
|||
|
||||
verify_signature(&headers, &method, &uri, actor.public_key())?;
|
||||
|
||||
debug!("Verifying activity {}", activity.id().to_string());
|
||||
activity.verify(data, request_counter).await?;
|
||||
|
||||
debug!("Receiving activity {}", activity.id().to_string());
|
||||
activity.receive(data, request_counter).await?;
|
||||
Ok(())
|
||||
|
|
|
@ -118,7 +118,6 @@ where
|
|||
|
||||
let res2 = res?;
|
||||
|
||||
Kind::verify(&res2, self.inner(), data, request_counter).await?;
|
||||
Kind::from_apub(res2, data, request_counter).await
|
||||
}
|
||||
}
|
||||
|
@ -216,15 +215,6 @@ mod tests {
|
|||
todo!()
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
_apub: &Self::ApubType,
|
||||
_expected_domain: &Url,
|
||||
_data: &Self::DataType,
|
||||
_request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
async fn from_apub(
|
||||
_apub: Self::ApubType,
|
||||
_data: &Self::DataType,
|
||||
|
|
|
@ -44,14 +44,6 @@ where
|
|||
self.inner.actor()
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
&self,
|
||||
data: &Data<Self::DataType>,
|
||||
request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
self.inner.verify(data, request_counter).await
|
||||
}
|
||||
|
||||
async fn receive(
|
||||
self,
|
||||
data: &Data<Self::DataType>,
|
||||
|
|
|
@ -16,15 +16,6 @@ pub trait ActivityHandler {
|
|||
/// `actor` field of activity
|
||||
fn actor(&self) -> &Url;
|
||||
|
||||
/// Verify that the activity is valid. If this method returns an error, the activity will be
|
||||
/// discarded. This is separate from receive(), so that it can be called recursively on nested
|
||||
/// objects, without storing something in the database by accident.
|
||||
async fn verify(
|
||||
&self,
|
||||
data: &Data<Self::DataType>,
|
||||
request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error>;
|
||||
|
||||
/// Receives the activity and stores its action in database.
|
||||
async fn receive(
|
||||
self,
|
||||
|
@ -50,14 +41,6 @@ where
|
|||
self.deref().actor()
|
||||
}
|
||||
|
||||
async fn verify(
|
||||
&self,
|
||||
data: &Data<Self::DataType>,
|
||||
request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error> {
|
||||
self.deref().verify(data, request_counter).await
|
||||
}
|
||||
|
||||
async fn receive(
|
||||
self,
|
||||
data: &Data<Self::DataType>,
|
||||
|
@ -100,16 +83,6 @@ pub trait ApubObject {
|
|||
/// Trait for converting an object or actor into the respective ActivityPub type.
|
||||
async fn into_apub(self, data: &Self::DataType) -> Result<Self::ApubType, Self::Error>;
|
||||
|
||||
/// Verify that the object is valid. If this method returns an error, it will be
|
||||
/// discarded. This is separate from from_apub(), so that it can be called recursively on nested
|
||||
/// objects, without storing something in the database by accident.
|
||||
async fn verify(
|
||||
apub: &Self::ApubType,
|
||||
expected_domain: &Url,
|
||||
data: &Self::DataType,
|
||||
request_counter: &mut i32,
|
||||
) -> Result<(), Self::Error>;
|
||||
|
||||
/// Converts an object from ActivityPub type to Lemmy internal type.
|
||||
///
|
||||
/// * `apub` The object to read from
|
||||
|
|
Loading…
Reference in a new issue