@@ -8,10 +8,10 @@ use serde::{Deserialize, Serialize};
88use crate :: {
99 agents:: Agent ,
1010 email:: { EmailAddress , MailAction , MailMessage } ,
11- endpoints:: Endpoint ,
11+ endpoints:: { Endpoint , HandleGetContext } ,
1212 errors:: AtomicResult ,
1313 plugins:: utils:: return_success,
14- urls, Db , Resource , Storelike ,
14+ urls, Resource , Storelike ,
1515} ;
1616
1717pub fn request_email_add_pubkey ( ) -> Endpoint {
@@ -21,6 +21,7 @@ pub fn request_email_add_pubkey() -> Endpoint {
2121 description : "Requests an email to add a new PublicKey to an Agent." . to_string ( ) ,
2222 shortname : "request-pubkey-reset" . to_string ( ) ,
2323 handle : Some ( handle_request_email_pubkey) ,
24+ handle_post : None ,
2425 }
2526}
2627
@@ -31,6 +32,7 @@ pub fn confirm_add_pubkey() -> Endpoint {
3132 description : "Confirms a token to add a new Public Key." . to_string ( ) ,
3233 shortname : "request-pubkey-reset" . to_string ( ) ,
3334 handle : Some ( handle_confirm_add_pubkey) ,
35+ handle_post : None ,
3436 }
3537}
3638
@@ -39,11 +41,12 @@ struct AddPubkeyToken {
3941 agent : String ,
4042}
4143
42- pub fn handle_request_email_pubkey (
43- url : url:: Url ,
44- store : & Db ,
45- _for_agent : Option < & str > ,
46- ) -> AtomicResult < Resource > {
44+ pub fn handle_request_email_pubkey ( context : HandleGetContext ) -> AtomicResult < Resource > {
45+ let HandleGetContext {
46+ subject : url,
47+ store,
48+ for_agent : _,
49+ } = context;
4750 let mut email_option: Option < EmailAddress > = None ;
4851 for ( k, v) in url. query_pairs ( ) {
4952 if let "email" = k. as_ref ( ) {
@@ -96,12 +99,13 @@ pub fn handle_request_email_pubkey(
9699 return_success ( )
97100}
98101
99- #[ tracing:: instrument( skip( store) ) ]
100- pub fn handle_confirm_add_pubkey (
101- url : url:: Url ,
102- store : & Db ,
103- for_agent : Option < & str > ,
104- ) -> AtomicResult < Resource > {
102+ #[ tracing:: instrument]
103+ pub fn handle_confirm_add_pubkey ( context : HandleGetContext ) -> AtomicResult < Resource > {
104+ let HandleGetContext {
105+ subject : url,
106+ store,
107+ for_agent : _,
108+ } = context;
105109 let mut token_opt: Option < String > = None ;
106110 let mut pubkey_option = None ;
107111
0 commit comments