From 37e08296e3c2f611eb8f5ed18f1616971f813643 Mon Sep 17 00:00:00 2001 From: Lautaro Bustos Date: Wed, 31 May 2023 12:52:02 -0300 Subject: [PATCH] fix: encoded vals (#9) * fix: encoded jsons * chore: bump --- Cargo.toml | 2 +- src/ws_signed_headers.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 04f1385..6f0ed0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dcl-crypto-middleware-rs" -version = "0.2.0" +version = "0.2.1" description = "Utils to authenticate Decentraland users on Rust services" repository = "https://github.com/decentraland/dcl-crypto-middleware-rs" readme = "./README.md" diff --git a/src/ws_signed_headers.rs b/src/ws_signed_headers.rs index 7aa0e67..deae123 100644 --- a/src/ws_signed_headers.rs +++ b/src/ws_signed_headers.rs @@ -40,7 +40,14 @@ pub async fn authenticate_dcl_user_with_signed_headers< { let signed_headers = signed_headers .iter() - .map(|(key, value)| (key.to_owned(), value.to_string())) + .map(|(key, value)| { + let val = match value { + Value::Object(_) | Value::Number(_) => value.to_string(), + Value::String(s) => s.to_owned(), + _ => "".to_string(), + }; + (key.to_owned(), val) + }) .collect::>(); signed_fetch::verify(