Skip to content

Commit

Permalink
pull main
Browse files Browse the repository at this point in the history
  • Loading branch information
ash-burnt committed Aug 12, 2024
2 parents 4dfbbdf + 3fe5e8e commit b01e76e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
14 changes: 7 additions & 7 deletions contracts/account/src/auth/jwt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use crate::error::ContractError::{InvalidSignatureDetail, InvalidToken};
use crate::error::ContractResult;
use base64::engine::general_purpose::URL_SAFE_NO_PAD;
use base64::Engine as _;
use cosmos_sdk_proto::traits::MessageExt;
use cosmos_sdk_proto::xion::v1::jwk::QueryValidateJwtRequest;
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{Binary, Deps, to_json_binary};
use cosmwasm_std::{Binary, Deps};
use serde::{Deserialize, Serialize};
use std::str;

Expand Down Expand Up @@ -43,13 +44,12 @@ pub fn verify(
sig_bytes: String::from_utf8(sig_bytes.into())?,
// tx_hash: challenge,
};
let grpc_query = cosmwasm_std::GrpcQuery{
path: String::from("/xion.jwk.v1.Query/ValidateJWT"),
data: to_json_binary(&query)?,
};

deps.querier
.query::<QueryValidateJWTResponse>(&grpc_query.into())?;
let query_bz = query.to_bytes()?;
deps.querier.query_grpc(
String::from("/xion.jwk.v1.Query/ValidateJWT".to_string()),

Check failure on line 50 in contracts/account/src/auth/jwt.rs

View workflow job for this annotation

GitHub Actions / Lints

useless conversion to the same type: `std::string::String`
Binary::new(query_bz),
)?;

// at this point we have validated the JWT. Any custom claims on it's body
// can follow
Expand Down
13 changes: 8 additions & 5 deletions contracts/account/src/auth/passkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ pub fn register(deps: Deps, addr: Addr, rp: String, data: Binary) -> ContractRes
};

let query_bz = query.to_bytes()?;
let query_response = deps
.querier
.query_grpc(String::from("path"), Binary::new(query_bz))?;
let query_response = deps.querier.query_grpc(
String::from("/xion.v1.Query/WebAuthNVerifyRegister"),
Binary::new(query_bz),
)?;
let query_response = QueryWebAuthNVerifyRegisterResponse::decode(query_response.as_slice())?;
Ok(Binary::new(query_response.credential))
}
Expand Down Expand Up @@ -71,8 +72,10 @@ pub fn verify(
};

let query_bz = query.to_bytes()?;
deps.querier
.query_grpc(String::from("path"), Binary::new(query_bz))?;
deps.querier.query_grpc(
String::from("/xion.v1.Query/WebAuthNVerifyAuthenticate"),
Binary::new(query_bz),
)?;

Ok(true)
}

0 comments on commit b01e76e

Please sign in to comment.