Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3383570
D7536.id25557.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D7536.id25557.diff
View Options
diff --git a/services/identity/src/client_service.rs b/services/identity/src/client_service.rs
--- a/services/identity/src/client_service.rs
+++ b/services/identity/src/client_service.rs
@@ -37,11 +37,20 @@
#[derive(Clone)]
pub enum WorkflowInProgress {
Registration(UserRegistrationInfo),
+ Login(UserLoginInfo),
}
#[derive(Clone)]
pub struct UserRegistrationInfo {
pub username: String,
+ pub flattened_device_key_upload: FlattenedDeviceKeyUpload,
+}
+
+#[derive(Clone)]
+pub struct UserLoginInfo(FlattenedDeviceKeyUpload);
+
+#[derive(Clone)]
+pub struct FlattenedDeviceKeyUpload {
pub device_id_key: String,
pub key_payload: String,
pub key_payload_signature: String,
@@ -114,15 +123,17 @@
.map_err(|_| tonic::Status::invalid_argument("malformed payload"))?;
let registration_state = UserRegistrationInfo {
username,
- device_id_key: key_info.primary_identity_public_keys.curve25519,
- key_payload: payload,
- key_payload_signature: payload_signature,
- identity_prekey,
- identity_prekey_signature,
- identity_onetime_keys: onetime_identity_prekeys,
- notif_prekey,
- notif_prekey_signature,
- notif_onetime_keys: onetime_notif_prekeys,
+ flattened_device_key_upload: FlattenedDeviceKeyUpload {
+ device_id_key: key_info.primary_identity_public_keys.curve25519,
+ key_payload: payload,
+ key_payload_signature: payload_signature,
+ identity_prekey,
+ identity_prekey_signature,
+ identity_onetime_keys: onetime_identity_prekeys,
+ notif_prekey,
+ notif_prekey_signature,
+ notif_onetime_keys: onetime_notif_prekeys,
+ },
};
let session_id = generate_uuid();
self
@@ -159,7 +170,7 @@
.finish(&message.opaque_registration_upload)
.map_err(comm_opaque2::grpc::protocol_error_to_grpc_status)?;
- let device_id = state.device_id_key.clone();
+ let device_id = state.flattened_device_key_upload.device_id_key.clone();
let user_id = self
.client
.add_user_to_users_table(state, password_file)
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
@@ -148,27 +148,42 @@
),
(
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
.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(),
- 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
.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
.to_string(),
AttributeValue::L(
registration_state
+ .flattened_device_key_upload
.identity_onetime_keys
.into_iter()
.map(AttributeValue::S)
@@ -177,17 +192,24 @@
),
(
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
.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(),
AttributeValue::L(
registration_state
+ .flattened_device_key_upload
.notif_onetime_keys
.into_iter()
.map(AttributeValue::S)
@@ -196,7 +218,7 @@
),
]);
let devices = HashMap::from([(
- registration_state.device_id_key,
+ registration_state.flattened_device_key_upload.device_id_key,
AttributeValue::M(device_info),
)]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 29, 4:42 PM (20 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2597501
Default Alt Text
D7536.id25557.diff (4 KB)
Attached To
Mode
D7536: [identity] manage login state
Attached
Detach File
Event Timeline
Log In to Comment