Page MenuHomePhabricator

D10764.diff
No OneTemporary

D10764.diff

diff --git a/services/identity/src/constants.rs b/services/identity/src/constants.rs
--- a/services/identity/src/constants.rs
+++ b/services/identity/src/constants.rs
@@ -48,8 +48,7 @@
pub const USERS_TABLE_DEVICES_MAP_DEVICE_TYPE_ATTRIBUTE_NAME: &str =
"deviceType";
pub const USERS_TABLE_WALLET_ADDRESS_ATTRIBUTE: &str = "walletAddress";
-pub const USERS_TABLE_DEVICES_MAP_SOCIAL_PROOF_ATTRIBUTE_NAME: &str =
- "socialProof";
+pub const USERS_TABLE_SOCIAL_PROOF_ATTRIBUTE_NAME: &str = "socialProof";
pub const USERS_TABLE_DEVICELIST_TIMESTAMP_ATTRIBUTE_NAME: &str =
"deviceListTimestamp";
pub const USERS_TABLE_USERNAME_INDEX: &str = "username-index";
diff --git a/services/identity/src/database.rs b/services/identity/src/database.rs
--- a/services/identity/src/database.rs
+++ b/services/identity/src/database.rs
@@ -16,7 +16,10 @@
use std::str::FromStr;
use std::sync::Arc;
-use crate::reserved_users::UserDetail;
+use crate::{
+ constants::USERS_TABLE_SOCIAL_PROOF_ATTRIBUTE_NAME,
+ ddb_utils::EthereumIdentity, reserved_users::UserDetail,
+};
use crate::{
ddb_utils::{
create_one_time_key_partition_key, into_one_time_put_requests, Identifier,
@@ -192,12 +195,15 @@
code_version: u64,
access_token_creation_time: DateTime<Utc>,
) -> Result<String, Error> {
- let social_proof = Some(social_proof);
+ let wallet_identity = EthereumIdentity {
+ wallet_address,
+ social_proof: social_proof.clone(),
+ };
let user_id = self
.add_user_to_users_table(
flattened_device_key_upload.clone(),
None,
- Some(wallet_address),
+ Some(wallet_identity),
user_id,
)
.await?;
@@ -206,7 +212,7 @@
.add_device(
&user_id,
flattened_device_key_upload,
- social_proof,
+ Some(social_proof),
code_version,
access_token_creation_time,
)
@@ -219,7 +225,7 @@
&self,
flattened_device_key_upload: FlattenedDeviceKeyUpload,
username_and_password_file: Option<(String, Blob)>,
- wallet_address: Option<String>,
+ wallet_identity: Option<EthereumIdentity>,
user_id: Option<String>,
) -> Result<String, Error> {
let user_id = user_id.unwrap_or_else(generate_uuid);
@@ -239,10 +245,14 @@
);
}
- if let Some(address) = wallet_address {
+ if let Some(eth_identity) = wallet_identity {
user.insert(
USERS_TABLE_WALLET_ADDRESS_ATTRIBUTE.to_string(),
- AttributeValue::S(address),
+ AttributeValue::S(eth_identity.wallet_address),
+ );
+ user.insert(
+ USERS_TABLE_SOCIAL_PROOF_ATTRIBUTE_NAME.to_string(),
+ AttributeValue::S(eth_identity.social_proof),
);
}
diff --git a/services/identity/src/ddb_utils.rs b/services/identity/src/ddb_utils.rs
--- a/services/identity/src/ddb_utils.rs
+++ b/services/identity/src/ddb_utils.rs
@@ -7,8 +7,8 @@
use std::iter::IntoIterator;
use crate::constants::{
- USERS_TABLE_DEVICES_MAP_SOCIAL_PROOF_ATTRIBUTE_NAME,
- USERS_TABLE_USERNAME_ATTRIBUTE, USERS_TABLE_WALLET_ADDRESS_ATTRIBUTE,
+ USERS_TABLE_SOCIAL_PROOF_ATTRIBUTE_NAME, USERS_TABLE_USERNAME_ATTRIBUTE,
+ USERS_TABLE_WALLET_ADDRESS_ATTRIBUTE,
};
#[derive(Copy, Clone, Debug)]
@@ -100,7 +100,7 @@
let wallet_address_result =
value.take_attr(USERS_TABLE_WALLET_ADDRESS_ATTRIBUTE);
let social_proof_result =
- value.take_attr(USERS_TABLE_DEVICES_MAP_SOCIAL_PROOF_ATTRIBUTE_NAME);
+ value.take_attr(USERS_TABLE_SOCIAL_PROOF_ATTRIBUTE_NAME);
if let (Ok(wallet_address), Ok(social_proof)) =
(wallet_address_result, social_proof_result)

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 6, 3:16 PM (21 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2431253
Default Alt Text
D10764.diff (3 KB)

Event Timeline