Oops on the Extension
This commit is contained in:
		
							parent
							
								
									39cfcf1373
								
							
						
					
					
						commit
						f7e733c500
					
				
					 2 changed files with 20 additions and 2 deletions
				
			
		
							
								
								
									
										20
									
								
								src/apub.rs
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								src/apub.rs
									
										
									
									
									
								
							|  | @ -15,7 +15,11 @@ pub struct PublicKey { | |||
|     pub public_key_pem: String, | ||||
| } | ||||
| 
 | ||||
| impl<T> Extension<T> for PublicKey where T: Actor {} | ||||
| #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] | ||||
| #[serde(rename_all = "camelCase")] | ||||
| pub struct PublicKeyExtension { | ||||
|     pub public_key: PublicKey, | ||||
| } | ||||
| 
 | ||||
| #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, PropRefs)] | ||||
| #[serde(rename_all = "camelCase")] | ||||
|  | @ -86,6 +90,20 @@ pub struct Endpoints { | |||
|     shared_inbox: Option<XsdAnyUri>, | ||||
| } | ||||
| 
 | ||||
| impl PublicKey { | ||||
|     pub fn to_ext(self) -> PublicKeyExtension { | ||||
|         self.into() | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl From<PublicKey> for PublicKeyExtension { | ||||
|     fn from(public_key: PublicKey) -> Self { | ||||
|         PublicKeyExtension { public_key } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl<T> Extension<T> for PublicKeyExtension where T: Actor {} | ||||
| 
 | ||||
| impl ValidObjects { | ||||
|     pub fn id(&self) -> &XsdAnyUri { | ||||
|         match self { | ||||
|  |  | |||
|  | @ -81,7 +81,7 @@ async fn actor_route(state: web::Data<State>) -> Result<impl Responder, MyError> | |||
|         public_key_pem: state.settings.public_key.to_pem_pkcs8()?, | ||||
|     }; | ||||
| 
 | ||||
|     Ok(ok(application.extend(public_key))) | ||||
|     Ok(ok(application.extend(public_key.to_ext()))) | ||||
| } | ||||
| 
 | ||||
| #[actix_rt::main] | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue