optional params like this do not work. need hashmap
This commit is contained in:
parent
e9abcf883f
commit
8a23efd048
@ -46,7 +46,7 @@ pub async fn user_login_get(
|
|||||||
ClientIp(ip): ClientIp,
|
ClientIp(ip): ClientIp,
|
||||||
// TODO: what does axum's error handling look like if the path fails to parse?
|
// TODO: what does axum's error handling look like if the path fails to parse?
|
||||||
// TODO: allow ENS names here?
|
// TODO: allow ENS names here?
|
||||||
Path((user_address, message_eip)): Path<(Address, Option<String>)>,
|
Path(mut params): Path<HashMap<String, String>>,
|
||||||
Query(query): Query<HashMap<String, String>>,
|
Query(query): Query<HashMap<String, String>>,
|
||||||
) -> FrontendResult {
|
) -> FrontendResult {
|
||||||
// give these named variables so that we drop them at the very end of this function
|
// give these named variables so that we drop them at the very end of this function
|
||||||
@ -69,6 +69,14 @@ pub async fn user_login_get(
|
|||||||
|
|
||||||
let expiration_time = issued_at.add(Duration::new(expire_seconds as i64, 0));
|
let expiration_time = issued_at.add(Duration::new(expire_seconds as i64, 0));
|
||||||
|
|
||||||
|
let user_address: Address = params
|
||||||
|
.remove("user_address")
|
||||||
|
// TODO: map_err so this becomes a 500. routing must be bad
|
||||||
|
.context("impossible")?
|
||||||
|
.parse()
|
||||||
|
// TODO: map_err so this becomes a 401
|
||||||
|
.context("bad input")?;
|
||||||
|
|
||||||
// TODO: get most of these from the app config
|
// TODO: get most of these from the app config
|
||||||
let message = Message {
|
let message = Message {
|
||||||
// TODO: should domain be llamanodes, or llamarpc, or the subdomain of llamarpc?
|
// TODO: should domain be llamanodes, or llamarpc, or the subdomain of llamarpc?
|
||||||
@ -100,7 +108,9 @@ pub async fn user_login_get(
|
|||||||
|
|
||||||
// there are multiple ways to sign messages and not all wallets support them
|
// there are multiple ways to sign messages and not all wallets support them
|
||||||
// TODO: default message eip from config?
|
// TODO: default message eip from config?
|
||||||
let message_eip = message_eip.unwrap_or_else(|| "eip4361".to_string());
|
let message_eip = params
|
||||||
|
.remove("message_eip")
|
||||||
|
.unwrap_or_else(|| "eip4361".to_string());
|
||||||
|
|
||||||
let message: String = match message_eip.as_str() {
|
let message: String = match message_eip.as_str() {
|
||||||
"eip191_bytes" => Bytes::from(message.eip191_bytes().unwrap()).to_string(),
|
"eip191_bytes" => Bytes::from(message.eip191_bytes().unwrap()).to_string(),
|
||||||
|
Loading…
Reference in New Issue
Block a user