diff options
Diffstat (limited to 'src/push/handlers/mod.rs')
| -rw-r--r-- | src/push/handlers/mod.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/push/handlers/mod.rs b/src/push/handlers/mod.rs index 05249c2..afa76e0 100644 --- a/src/push/handlers/mod.rs +++ b/src/push/handlers/mod.rs @@ -35,10 +35,14 @@ pub async fn echo( Json(echo): Json<Echo>, ) -> Result<(), crate::error::Internal> { // Look this up from a subscription record? Or get it from the client and trust? - let endpoint = "https://updates.push.services.mozilla.com/wpush/v1/..."; + let endpoint = echo.endpoint; // Get these from client: - let p256dh = "key_from_browser_as_base64"; - let auth = "auth_from_browser_as_base64"; + let p256dh = echo.keys.p256dh; + let auth = echo.keys.auth; + + println!("endpoint: {:?}", endpoint); + println!("p256dh: {:?}", p256dh); + println!("auth: {:?}", auth); // You would likely get this by deserializing a browser `pushSubscription` object. let subscription_info = SubscriptionInfo::new(endpoint, p256dh, auth); @@ -64,6 +68,15 @@ pub async fn echo( #[derive(serde::Deserialize)] +pub struct Keys { + pub p256dh: String, + pub auth: String, +} + +#[derive(serde::Deserialize)] pub struct Echo { pub msg: String, + pub endpoint: String, + pub expirationTime: Option<String>, + pub keys: Keys, } |
