Page MenuHomePhabricator

D7536.id25417.diff
No OneTemporary

D7536.id25417.diff

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(RegistrationState),
+ Login(LoginState),
}
#[derive(Clone)]
pub struct RegistrationState {
pub username: String,
+ pub flattened_device_key_upload: FlattenedDeviceKeyUpload,
+}
+
+#[derive(Clone)]
+pub struct LoginState(FlattenedDeviceKeyUpload);
+
+#[derive(Clone)]
+pub struct FlattenedDeviceKeyUpload {
pub device_id_key: String,
pub key_payload: String,
pub key_payload_signature: String,
@@ -120,15 +129,17 @@
.map_err(|_| tonic::Status::invalid_argument("malformed payload"))?;
let registration_state = RegistrationState {
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
@@ -165,7 +176,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

Mime Type
text/plain
Expires
Fri, Nov 29, 5:00 PM (21 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2597478
Default Alt Text
D7536.id25417.diff (4 KB)

Event Timeline