Changeset View
Changeset View
Standalone View
Standalone View
services/identity/src/database.rs
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | ) -> Result<String, Error> { | ||||
let user_id = generate_uuid(); | let user_id = generate_uuid(); | ||||
let device_info = HashMap::from([ | let device_info = HashMap::from([ | ||||
( | ( | ||||
USERS_TABLE_DEVICES_MAP_DEVICE_TYPE_ATTRIBUTE_NAME.to_string(), | USERS_TABLE_DEVICES_MAP_DEVICE_TYPE_ATTRIBUTE_NAME.to_string(), | ||||
AttributeValue::S(Device::Client.to_string()), | AttributeValue::S(Device::Client.to_string()), | ||||
), | ), | ||||
( | ( | ||||
USERS_TABLE_DEVICES_MAP_KEY_PAYLOAD_ATTRIBUTE_NAME.to_string(), | USERS_TABLE_DEVICES_MAP_KEY_PAYLOAD_ATTRIBUTE_NAME.to_string(), | ||||
AttributeValue::S(registration_state.key_payload), | AttributeValue::S( | ||||
registration_state.flattened_device_key_upload.key_payload, | |||||
), | |||||
), | ), | ||||
( | ( | ||||
USERS_TABLE_DEVICES_MAP_KEY_PAYLOAD_SIGNATURE_ATTRIBUTE_NAME | USERS_TABLE_DEVICES_MAP_KEY_PAYLOAD_SIGNATURE_ATTRIBUTE_NAME | ||||
.to_string(), | .to_string(), | ||||
AttributeValue::S(registration_state.key_payload_signature), | AttributeValue::S( | ||||
registration_state | |||||
.flattened_device_key_upload | |||||
.key_payload_signature, | |||||
), | |||||
), | ), | ||||
( | ( | ||||
USERS_TABLE_DEVICES_MAP_IDENTITY_PREKEY_ATTRIBUTE_NAME.to_string(), | USERS_TABLE_DEVICES_MAP_IDENTITY_PREKEY_ATTRIBUTE_NAME.to_string(), | ||||
AttributeValue::S(registration_state.identity_prekey), | AttributeValue::S( | ||||
registration_state | |||||
.flattened_device_key_upload | |||||
.identity_prekey, | |||||
), | |||||
), | ), | ||||
( | ( | ||||
USERS_TABLE_DEVICES_MAP_IDENTITY_PREKEY_SIGNATURE_ATTRIBUTE_NAME | USERS_TABLE_DEVICES_MAP_IDENTITY_PREKEY_SIGNATURE_ATTRIBUTE_NAME | ||||
.to_string(), | .to_string(), | ||||
AttributeValue::S(registration_state.identity_prekey_signature), | AttributeValue::S( | ||||
registration_state | |||||
.flattened_device_key_upload | |||||
.identity_prekey_signature, | |||||
), | |||||
), | ), | ||||
( | ( | ||||
USERS_TABLE_DEVICES_MAP_IDENTITY_ONETIME_KEYS_ATTRIBUTE_NAME | USERS_TABLE_DEVICES_MAP_IDENTITY_ONETIME_KEYS_ATTRIBUTE_NAME | ||||
.to_string(), | .to_string(), | ||||
AttributeValue::L( | AttributeValue::L( | ||||
registration_state | registration_state | ||||
.flattened_device_key_upload | |||||
.identity_onetime_keys | .identity_onetime_keys | ||||
.into_iter() | .into_iter() | ||||
.map(AttributeValue::S) | .map(AttributeValue::S) | ||||
.collect(), | .collect(), | ||||
), | ), | ||||
), | ), | ||||
( | ( | ||||
USERS_TABLE_DEVICES_MAP_NOTIF_PREKEY_ATTRIBUTE_NAME.to_string(), | USERS_TABLE_DEVICES_MAP_NOTIF_PREKEY_ATTRIBUTE_NAME.to_string(), | ||||
AttributeValue::S(registration_state.notif_prekey), | AttributeValue::S( | ||||
registration_state.flattened_device_key_upload.notif_prekey, | |||||
), | |||||
), | ), | ||||
( | ( | ||||
USERS_TABLE_DEVICES_MAP_NOTIF_PREKEY_SIGNATURE_ATTRIBUTE_NAME | USERS_TABLE_DEVICES_MAP_NOTIF_PREKEY_SIGNATURE_ATTRIBUTE_NAME | ||||
.to_string(), | .to_string(), | ||||
AttributeValue::S(registration_state.notif_prekey_signature), | AttributeValue::S( | ||||
registration_state | |||||
.flattened_device_key_upload | |||||
.notif_prekey_signature, | |||||
), | |||||
), | ), | ||||
( | ( | ||||
USERS_TABLE_DEVICES_MAP_NOTIF_ONETIME_KEYS_ATTRIBUTE_NAME.to_string(), | USERS_TABLE_DEVICES_MAP_NOTIF_ONETIME_KEYS_ATTRIBUTE_NAME.to_string(), | ||||
AttributeValue::L( | AttributeValue::L( | ||||
registration_state | registration_state | ||||
.flattened_device_key_upload | |||||
.notif_onetime_keys | .notif_onetime_keys | ||||
.into_iter() | .into_iter() | ||||
.map(AttributeValue::S) | .map(AttributeValue::S) | ||||
.collect(), | .collect(), | ||||
), | ), | ||||
), | ), | ||||
]); | ]); | ||||
let devices = HashMap::from([( | let devices = HashMap::from([( | ||||
registration_state.device_id_key, | registration_state.flattened_device_key_upload.device_id_key, | ||||
AttributeValue::M(device_info), | AttributeValue::M(device_info), | ||||
)]); | )]); | ||||
let user = HashMap::from([ | let user = HashMap::from([ | ||||
( | ( | ||||
USERS_TABLE_PARTITION_KEY.to_string(), | USERS_TABLE_PARTITION_KEY.to_string(), | ||||
AttributeValue::S(user_id.clone()), | AttributeValue::S(user_id.clone()), | ||||
), | ), | ||||
▲ Show 20 Lines • Show All 564 Lines • Show Last 20 Lines |