From 1360dcefab139a7b461ea4c785536f941ef3491c Mon Sep 17 00:00:00 2001 From: Arjen van Veen <107098190+justAnIdentity@users.noreply.github.com> Date: Fri, 7 Jul 2023 14:56:57 +0200 Subject: [PATCH] Add refresh token (#7) * Add refresh token * Don't encode private key in proof of possession header --------- Co-authored-by: Jacob --- src/proof_of_possession.rs | 4 ++-- src/token.rs | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/proof_of_possession.rs b/src/proof_of_possession.rs index 4147ed5..24f21d4 100644 --- a/src/proof_of_possession.rs +++ b/src/proof_of_possession.rs @@ -88,12 +88,12 @@ impl ProofOfPossession { let (h_kid, h_jwk) = match (self.controller.vm.clone(), jwk.key_id.clone()) { (Some(did), _) => (Some(did), None), (None, Some(kid)) => (Some(kid), None), - (None, None) => (None, Some(jwk)), + (None, None) => (None, Some(jwk.to_public())), }; let header = Header { algorithm: alg, key_id: h_kid, - jwk: h_jwk.cloned(), + jwk: h_jwk, type_: Some(JWS_TYPE.to_string()), ..Default::default() }; diff --git a/src/token.rs b/src/token.rs index 73b0894..314cc2f 100644 --- a/src/token.rs +++ b/src/token.rs @@ -22,6 +22,13 @@ pub enum Request { #[serde(alias = "pin")] user_pin: Option, }, + #[serde(rename = "urn:ietf:params:oauth:grant-type:refresh_token")] + RefreshToken { + client_id: Option, + refresh_token: String, + #[serde(alias = "pin")] + user_pin: Option, + }, } #[derive(Debug, Default, Deserialize, Serialize)]