From 0cc4557e8d2e0d3cebaa4a06675124a6ccf36941 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 12 Jun 2023 04:14:02 +0200 Subject: [PATCH] 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 --- web3_proxy/src/frontend/users/subuser.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/web3_proxy/src/frontend/users/subuser.rs b/web3_proxy/src/frontend/users/subuser.rs index 35352518..ec1e8d4f 100644 --- a/web3_proxy/src/frontend/users/subuser.rs +++ b/web3_proxy/src/frontend/users/subuser.rs @@ -105,18 +105,18 @@ pub async fn get_subusers( .db_replica() .context("getting replica db for user's revert logs")?; - let rpc_key: Ulid = params - .remove("rpc_key") + let rpc_key: u64 = params + .remove("key_id") // TODO: map_err so this becomes a 500. routing must be bad .ok_or(Web3ProxyError::BadRequest( "You have not provided the 'rpc_key' whose access to modify".into(), ))? .parse() - .context(format!("unable to parse rpc_key {:?}", params))?; + .context(format!("unable to parse key_id {:?}", params))?; // Get the rpc key id 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()) .await? .ok_or(Web3ProxyError::BadRequest( @@ -182,15 +182,14 @@ pub async fn modify_subuser( trace!("Parameters are: {:?}", params); // Then, distinguish the endpoint to modify - let rpc_key_to_modify: Ulid = params - .remove("rpc_key") + let rpc_key_to_modify: u64 = params + .remove("key_id") // TODO: map_err so this becomes a 500. routing must be bad .ok_or(Web3ProxyError::BadRequest( "You have not provided the 'rpc_key' whose access to modify".into(), ))? - .parse::() - .context(format!("unable to parse rpc_key {:?}", params))?; - // let rpc_key_to_modify: Uuid = ulid::serde::ulid_as_uuid::deserialize(rpc_key_to_modify)?; + .parse() + .context(format!("unable to get the key_id {:?}", params))?; let subuser_address: Address = params .remove("subuser_address") @@ -247,7 +246,7 @@ pub async fn modify_subuser( .await?; 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()) .await? .ok_or(Web3ProxyError::BadRequest(