Use rpc id instead of key (#118)
* added logic to check e-mails thru SMPT server, very basic, no validation e-mails etc. * Revert "added logic to check e-mails thru SMPT server, very basic, no validation e-mails etc." This reverts commit 022a13cfd9ca24aad9e05f75489396936f14784a. * mixed up branches
This commit is contained in:
parent
81aa4788b4
commit
0cc4557e8d
@ -105,18 +105,18 @@ pub async fn get_subusers(
|
|||||||
.db_replica()
|
.db_replica()
|
||||||
.context("getting replica db for user's revert logs")?;
|
.context("getting replica db for user's revert logs")?;
|
||||||
|
|
||||||
let rpc_key: Ulid = params
|
let rpc_key: u64 = params
|
||||||
.remove("rpc_key")
|
.remove("key_id")
|
||||||
// TODO: map_err so this becomes a 500. routing must be bad
|
// TODO: map_err so this becomes a 500. routing must be bad
|
||||||
.ok_or(Web3ProxyError::BadRequest(
|
.ok_or(Web3ProxyError::BadRequest(
|
||||||
"You have not provided the 'rpc_key' whose access to modify".into(),
|
"You have not provided the 'rpc_key' whose access to modify".into(),
|
||||||
))?
|
))?
|
||||||
.parse()
|
.parse()
|
||||||
.context(format!("unable to parse rpc_key {:?}", params))?;
|
.context(format!("unable to parse key_id {:?}", params))?;
|
||||||
|
|
||||||
// Get the rpc key id
|
// Get the rpc key id
|
||||||
let rpc_key = rpc_key::Entity::find()
|
let rpc_key = rpc_key::Entity::find()
|
||||||
.filter(rpc_key::Column::SecretKey.eq(Uuid::from(rpc_key)))
|
.filter(rpc_key::Column::Id.eq(rpc_key))
|
||||||
.one(db_replica.as_ref())
|
.one(db_replica.as_ref())
|
||||||
.await?
|
.await?
|
||||||
.ok_or(Web3ProxyError::BadRequest(
|
.ok_or(Web3ProxyError::BadRequest(
|
||||||
@ -182,15 +182,14 @@ pub async fn modify_subuser(
|
|||||||
trace!("Parameters are: {:?}", params);
|
trace!("Parameters are: {:?}", params);
|
||||||
|
|
||||||
// Then, distinguish the endpoint to modify
|
// Then, distinguish the endpoint to modify
|
||||||
let rpc_key_to_modify: Ulid = params
|
let rpc_key_to_modify: u64 = params
|
||||||
.remove("rpc_key")
|
.remove("key_id")
|
||||||
// TODO: map_err so this becomes a 500. routing must be bad
|
// TODO: map_err so this becomes a 500. routing must be bad
|
||||||
.ok_or(Web3ProxyError::BadRequest(
|
.ok_or(Web3ProxyError::BadRequest(
|
||||||
"You have not provided the 'rpc_key' whose access to modify".into(),
|
"You have not provided the 'rpc_key' whose access to modify".into(),
|
||||||
))?
|
))?
|
||||||
.parse::<Ulid>()
|
.parse()
|
||||||
.context(format!("unable to parse rpc_key {:?}", params))?;
|
.context(format!("unable to get the key_id {:?}", params))?;
|
||||||
// let rpc_key_to_modify: Uuid = ulid::serde::ulid_as_uuid::deserialize(rpc_key_to_modify)?;
|
|
||||||
|
|
||||||
let subuser_address: Address = params
|
let subuser_address: Address = params
|
||||||
.remove("subuser_address")
|
.remove("subuser_address")
|
||||||
@ -247,7 +246,7 @@ pub async fn modify_subuser(
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let rpc_key_entity = rpc_key::Entity::find()
|
let rpc_key_entity = rpc_key::Entity::find()
|
||||||
.filter(rpc_key::Column::SecretKey.eq(Uuid::from(rpc_key_to_modify)))
|
.filter(rpc_key::Column::Id.eq(rpc_key_to_modify))
|
||||||
.one(db_replica.as_ref())
|
.one(db_replica.as_ref())
|
||||||
.await?
|
.await?
|
||||||
.ok_or(Web3ProxyError::BadRequest(
|
.ok_or(Web3ProxyError::BadRequest(
|
||||||
|
Loading…
Reference in New Issue
Block a user