Page MenuHomePhabricator

D8817.id30340.diff
No OneTemporary

D8817.id30340.diff

diff --git a/keyserver/addons/rust-node-addon/src/identity_client/login.rs b/keyserver/addons/rust-node-addon/src/identity_client/login.rs
--- a/keyserver/addons/rust-node-addon/src/identity_client/login.rs
+++ b/keyserver/addons/rust-node-addon/src/identity_client/login.rs
@@ -46,8 +46,8 @@
pre_key: notif_prekey,
pre_key_signature: notif_prekey_signature,
}),
- onetime_content_prekeys: content_one_time_keys,
- onetime_notif_prekeys: notif_one_time_keys,
+ one_time_content_prekeys: content_one_time_keys,
+ one_time_notif_prekeys: notif_one_time_keys,
device_type: DeviceType::Keyserver.into(),
}),
};
diff --git a/keyserver/addons/rust-node-addon/src/identity_client/register_user.rs b/keyserver/addons/rust-node-addon/src/identity_client/register_user.rs
--- a/keyserver/addons/rust-node-addon/src/identity_client/register_user.rs
+++ b/keyserver/addons/rust-node-addon/src/identity_client/register_user.rs
@@ -40,8 +40,8 @@
pre_key: notif_prekey,
pre_key_signature: notif_prekey_signature,
}),
- onetime_content_prekeys: content_one_time_keys,
- onetime_notif_prekeys: notif_one_time_keys,
+ one_time_content_prekeys: content_one_time_keys,
+ one_time_notif_prekeys: notif_one_time_keys,
device_type: DeviceType::Keyserver.into(),
};
let registration_start_request = Request::new(RegistrationStartRequest {
diff --git a/native/native_rust_library/src/identity_client.rs b/native/native_rust_library/src/identity_client.rs
--- a/native/native_rust_library/src/identity_client.rs
+++ b/native/native_rust_library/src/identity_client.rs
@@ -13,8 +13,8 @@
_identity_prekey_signature: String,
_notif_prekey: String,
_notif_prekey_signature: String,
- _identity_onetime_keys: Vec<String>,
- _notif_onetime_keys: Vec<String>,
+ _identity_one_time_keys: Vec<String>,
+ _notif_one_time_keys: Vec<String>,
) -> Result<String, Status> {
unimplemented!();
}
@@ -29,8 +29,8 @@
_identity_prekey_signature: String,
_notif_prekey: String,
_notif_prekey_signature: String,
- _identity_onetime_keys: Vec<String>,
- _notif_onetime_keys: Vec<String>,
+ _identity_one_time_keys: Vec<String>,
+ _notif_one_time_keys: Vec<String>,
) -> Result<String, Status> {
unimplemented!();
}
diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs
--- a/native/native_rust_library/src/lib.rs
+++ b/native/native_rust_library/src/lib.rs
@@ -65,8 +65,8 @@
content_prekey_signature: String,
notif_prekey: String,
notif_prekey_signature: String,
- content_onetime_keys: Vec<String>,
- notif_onetime_keys: Vec<String>,
+ content_one_time_keys: Vec<String>,
+ notif_one_time_keys: Vec<String>,
promise_id: u32,
);
@@ -80,8 +80,8 @@
content_prekey_signature: String,
notif_prekey: String,
notif_prekey_signature: String,
- content_onetime_keys: Vec<String>,
- notif_onetime_keys: Vec<String>,
+ content_one_time_keys: Vec<String>,
+ notif_one_time_keys: Vec<String>,
promise_id: u32,
);
@@ -95,8 +95,8 @@
content_prekey_signature: String,
notif_prekey: String,
notif_prekey_signature: String,
- content_onetime_keys: Vec<String>,
- notif_onetime_keys: Vec<String>,
+ content_one_time_keys: Vec<String>,
+ notif_one_time_keys: Vec<String>,
social_proof: String,
promise_id: u32,
);
@@ -169,8 +169,8 @@
content_prekey_signature: String,
notif_prekey: String,
notif_prekey_signature: String,
- content_onetime_keys: Vec<String>,
- notif_onetime_keys: Vec<String>,
+ content_one_time_keys: Vec<String>,
+ notif_one_time_keys: Vec<String>,
promise_id: u32,
) {
RUNTIME.spawn(async move {
@@ -183,8 +183,8 @@
content_prekey_signature,
notif_prekey,
notif_prekey_signature,
- content_onetime_keys,
- notif_onetime_keys,
+ content_one_time_keys,
+ notif_one_time_keys,
};
let result = register_user_helper(password_user_info).await;
handle_string_result_as_callback(result, promise_id);
@@ -200,8 +200,8 @@
content_prekey_signature: String,
notif_prekey: String,
notif_prekey_signature: String,
- content_onetime_keys: Vec<String>,
- notif_onetime_keys: Vec<String>,
+ content_one_time_keys: Vec<String>,
+ notif_one_time_keys: Vec<String>,
}
#[derive(Serialize)]
@@ -234,8 +234,8 @@
pre_key: password_user_info.notif_prekey,
pre_key_signature: password_user_info.notif_prekey_signature,
}),
- onetime_content_prekeys: password_user_info.content_onetime_keys,
- onetime_notif_prekeys: password_user_info.notif_onetime_keys,
+ one_time_content_prekeys: password_user_info.content_one_time_keys,
+ one_time_notif_prekeys: password_user_info.notif_one_time_keys,
device_type: DEVICE_TYPE.into(),
}),
};
@@ -279,8 +279,8 @@
content_prekey_signature: String,
notif_prekey: String,
notif_prekey_signature: String,
- content_onetime_keys: Vec<String>,
- notif_onetime_keys: Vec<String>,
+ content_one_time_keys: Vec<String>,
+ notif_one_time_keys: Vec<String>,
promise_id: u32,
) {
RUNTIME.spawn(async move {
@@ -293,8 +293,8 @@
content_prekey_signature,
notif_prekey,
notif_prekey_signature,
- content_onetime_keys,
- notif_onetime_keys,
+ content_one_time_keys,
+ notif_one_time_keys,
};
let result = login_password_user_helper(password_user_info).await;
handle_string_result_as_callback(result, promise_id);
@@ -325,8 +325,8 @@
pre_key: password_user_info.notif_prekey,
pre_key_signature: password_user_info.notif_prekey_signature,
}),
- onetime_content_prekeys: password_user_info.content_onetime_keys,
- onetime_notif_prekeys: password_user_info.notif_onetime_keys,
+ one_time_content_prekeys: password_user_info.content_one_time_keys,
+ one_time_notif_prekeys: password_user_info.notif_one_time_keys,
device_type: DEVICE_TYPE.into(),
}),
};
@@ -366,8 +366,8 @@
content_prekey_signature: String,
notif_prekey: String,
notif_prekey_signature: String,
- content_onetime_keys: Vec<String>,
- notif_onetime_keys: Vec<String>,
+ content_one_time_keys: Vec<String>,
+ notif_one_time_keys: Vec<String>,
social_proof: String,
}
@@ -381,8 +381,8 @@
content_prekey_signature: String,
notif_prekey: String,
notif_prekey_signature: String,
- content_onetime_keys: Vec<String>,
- notif_onetime_keys: Vec<String>,
+ content_one_time_keys: Vec<String>,
+ notif_one_time_keys: Vec<String>,
social_proof: String,
promise_id: u32,
) {
@@ -396,8 +396,8 @@
content_prekey_signature,
notif_prekey,
notif_prekey_signature,
- content_onetime_keys,
- notif_onetime_keys,
+ content_one_time_keys,
+ notif_one_time_keys,
social_proof,
};
let result = login_wallet_user_helper(wallet_user_info).await;
@@ -425,8 +425,8 @@
pre_key: wallet_user_info.notif_prekey,
pre_key_signature: wallet_user_info.notif_prekey_signature,
}),
- onetime_content_prekeys: wallet_user_info.content_onetime_keys,
- onetime_notif_prekeys: wallet_user_info.notif_onetime_keys,
+ one_time_content_prekeys: wallet_user_info.content_one_time_keys,
+ one_time_notif_prekeys: wallet_user_info.notif_one_time_keys,
device_type: DEVICE_TYPE.into(),
}),
};
diff --git a/services/commtest/src/identity/device.rs b/services/commtest/src/identity/device.rs
--- a/services/commtest/src/identity/device.rs
+++ b/services/commtest/src/identity/device.rs
@@ -49,8 +49,8 @@
pre_key: "notif_prekey".to_string(),
pre_key_signature: "notif_prekey_sig".to_string(),
}),
- onetime_content_prekeys: Vec::new(),
- onetime_notif_prekeys: Vec::new(),
+ one_time_content_prekeys: Vec::new(),
+ one_time_notif_prekeys: Vec::new(),
device_type: client::DeviceType::Keyserver.into(),
}),
};
diff --git a/services/commtest/tests/identity_keyserver_tests.rs b/services/commtest/tests/identity_keyserver_tests.rs
--- a/services/commtest/tests/identity_keyserver_tests.rs
+++ b/services/commtest/tests/identity_keyserver_tests.rs
@@ -63,11 +63,11 @@
.unwrap();
assert_eq!(
- first_reponse.onetime_content_prekey,
+ first_reponse.one_time_content_prekey,
Some("content1".to_string())
);
assert_eq!(
- first_reponse.onetime_notif_prekey,
+ first_reponse.one_time_notif_prekey,
Some("notif1".to_string())
);
@@ -80,6 +80,6 @@
.unwrap();
// The one time keys should be exhausted
- assert_eq!(second_reponse.onetime_content_prekey, None);
- assert_eq!(second_reponse.onetime_notif_prekey, None);
+ assert_eq!(second_reponse.one_time_content_prekey, None);
+ assert_eq!(second_reponse.one_time_notif_prekey, None);
}
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
@@ -76,10 +76,10 @@
pub key_payload_signature: String,
pub content_prekey: String,
pub content_prekey_signature: String,
- pub content_onetime_keys: Vec<String>,
+ pub content_one_time_keys: Vec<String>,
pub notif_prekey: String,
pub notif_prekey_signature: String,
- pub notif_onetime_keys: Vec<String>,
+ pub notif_one_time_keys: Vec<String>,
pub device_type: database::Device,
}
@@ -138,8 +138,8 @@
pre_key: notif_prekey,
pre_key_signature: notif_prekey_signature,
}),
- onetime_content_prekeys,
- onetime_notif_prekeys,
+ one_time_content_prekeys,
+ one_time_notif_prekeys,
device_type,
}),
} = message
@@ -158,10 +158,10 @@
key_payload_signature: payload_signature,
content_prekey,
content_prekey_signature,
- content_onetime_keys: onetime_content_prekeys,
+ content_one_time_keys: one_time_content_prekeys,
notif_prekey,
notif_prekey_signature,
- notif_onetime_keys: onetime_notif_prekeys,
+ notif_one_time_keys: one_time_notif_prekeys,
device_type: Device::try_from(device_type)
.map_err(handle_db_error)?,
},
@@ -240,8 +240,8 @@
pre_key: notif_prekey,
pre_key_signature: notif_prekey_signature,
}),
- onetime_content_prekeys,
- onetime_notif_prekeys,
+ one_time_content_prekeys,
+ one_time_notif_prekeys,
device_type,
}),
..
@@ -261,10 +261,10 @@
key_payload_signature: payload_signature,
content_prekey,
content_prekey_signature,
- content_onetime_keys: onetime_content_prekeys,
+ content_one_time_keys: one_time_content_prekeys,
notif_prekey,
notif_prekey_signature,
- notif_onetime_keys: onetime_notif_prekeys,
+ notif_one_time_keys: one_time_notif_prekeys,
device_type: Device::try_from(device_type)
.map_err(handle_db_error)?,
},
@@ -471,8 +471,8 @@
pre_key: notif_prekey,
pre_key_signature: notif_prekey_signature,
}),
- onetime_content_prekeys,
- onetime_notif_prekeys,
+ one_time_content_prekeys,
+ one_time_notif_prekeys,
device_type,
}),
} = message
@@ -498,10 +498,10 @@
key_payload_signature: payload_signature,
content_prekey,
content_prekey_signature,
- content_onetime_keys: onetime_content_prekeys,
+ content_one_time_keys: one_time_content_prekeys,
notif_prekey,
notif_prekey_signature,
- notif_onetime_keys: onetime_notif_prekeys,
+ notif_one_time_keys: one_time_notif_prekeys,
device_type: Device::try_from(device_type)
.map_err(handle_db_error)?,
},
@@ -609,8 +609,8 @@
pre_key: notif_prekey,
pre_key_signature: notif_prekey_signature,
}),
- onetime_content_prekeys,
- onetime_notif_prekeys,
+ one_time_content_prekeys,
+ one_time_notif_prekeys,
device_type,
}),
} = message
@@ -624,10 +624,10 @@
key_payload_signature: payload_signature,
content_prekey,
content_prekey_signature,
- content_onetime_keys: onetime_content_prekeys,
+ content_one_time_keys: one_time_content_prekeys,
notif_prekey,
notif_prekey_signature,
- notif_onetime_keys: onetime_notif_prekeys,
+ notif_one_time_keys: one_time_notif_prekeys,
device_type: Device::try_from(device_type)
.map_err(handle_db_error)?,
},
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
@@ -56,12 +56,12 @@
"identityPreKey";
pub const USERS_TABLE_DEVICES_MAP_CONTENT_PREKEY_SIGNATURE_ATTRIBUTE_NAME:
&str = "identityPreKeySignature";
-pub const USERS_TABLE_DEVICES_MAP_CONTENT_ONETIME_KEYS_ATTRIBUTE_NAME: &str =
+pub const USERS_TABLE_DEVICES_MAP_CONTENT_ONE_TIME_KEYS_ATTRIBUTE_NAME: &str =
"identityOneTimeKeys";
pub const USERS_TABLE_DEVICES_MAP_NOTIF_PREKEY_ATTRIBUTE_NAME: &str = "preKey";
pub const USERS_TABLE_DEVICES_MAP_NOTIF_PREKEY_SIGNATURE_ATTRIBUTE_NAME: &str =
"preKeySignature";
-pub const USERS_TABLE_DEVICES_MAP_NOTIF_ONETIME_KEYS_ATTRIBUTE_NAME: &str =
+pub const USERS_TABLE_DEVICES_MAP_NOTIF_ONE_TIME_KEYS_ATTRIBUTE_NAME: &str =
"notifOneTimeKeys";
pub const USERS_TABLE_WALLET_ADDRESS_ATTRIBUTE: &str = "walletAddress";
pub const USERS_TABLE_DEVICES_MAP_SOCIAL_PROOF_ATTRIBUTE_NAME: &str =
@@ -133,7 +133,7 @@
// X3DH key management
-// Threshold for requesting more onetime keys
-pub const ONETIME_KEY_MINIMUM_THRESHOLD: usize = 5;
+// Threshold for requesting more one_time keys
+pub const ONE_TIME_KEY_MINIMUM_THRESHOLD: usize = 5;
// Number of keys to be refreshed when below the threshold
-pub const ONETIME_KEY_REFRESH_NUMBER: u32 = 5;
+pub const ONE_TIME_KEY_REFRESH_NUMBER: u32 = 5;
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
@@ -243,8 +243,8 @@
self
.append_one_time_prekeys(
flattened_device_key_upload.device_id_key,
- flattened_device_key_upload.content_onetime_keys,
- flattened_device_key_upload.notif_onetime_keys,
+ flattened_device_key_upload.content_one_time_keys,
+ flattened_device_key_upload.notif_one_time_keys,
)
.await?;
@@ -316,10 +316,10 @@
let keyserver = devices.get_map(keyserver_id)?;
let notif_one_time_key: Option<String> = self
- .get_onetime_key(keyserver_id, OlmAccountType::Notification)
+ .get_one_time_key(keyserver_id, OlmAccountType::Notification)
.await?;
let content_one_time_key: Option<String> = self
- .get_onetime_key(keyserver_id, OlmAccountType::Content)
+ .get_one_time_key(keyserver_id, OlmAccountType::Content)
.await?;
debug!(
@@ -381,26 +381,26 @@
return Ok(Some(outbound_payload));
}
- /// Will "mint" a single onetime key by attempting to successfully deleting
+ /// Will "mint" a single one time key by attempting to successfully deleting
/// a key
- pub async fn get_onetime_key(
+ pub async fn get_one_time_key(
&self,
device_id: &str,
account_type: OlmAccountType,
) -> Result<Option<String>, Error> {
use crate::constants::one_time_keys_table as otk_table;
- use crate::constants::ONETIME_KEY_MINIMUM_THRESHOLD;
+ use crate::constants::ONE_TIME_KEY_MINIMUM_THRESHOLD;
- let query_result = self.get_onetime_keys(device_id, account_type).await?;
+ let query_result = self.get_one_time_keys(device_id, account_type).await?;
let items = query_result.items();
// If no onetime keys exists, return none early
let Some(item_vec) = items else {
- debug!("Unable to find {:?} onetime-key", account_type);
+ debug!("Unable to find {:?} one time key", account_type);
return Ok(None);
};
- if item_vec.len() < ONETIME_KEY_MINIMUM_THRESHOLD {
+ if item_vec.len() < ONE_TIME_KEY_MINIMUM_THRESHOLD {
// Avoid device_id being moved out-of-scope by "move"
let device_id = device_id.to_string();
tokio::spawn(async move {
@@ -412,8 +412,8 @@
}
let mut result = None;
- // Attempt to delete the onetime keys individually, a successful delete
- // mints the onetime key to the requester
+ // Attempt to delete the one time keys individually, a successful delete
+ // mints the one time key to the requester
for item in item_vec {
let pk = item.get_string(otk_table::PARTITION_KEY)?;
let otk = item.get_string(otk_table::SORT_KEY)?;
@@ -429,7 +429,7 @@
),
]);
- debug!("Attempting to delete a {:?} onetime-key", account_type);
+ debug!("Attempting to delete a {:?} one time key", account_type);
match self
.client
.delete_item()
@@ -455,7 +455,7 @@
Ok(result)
}
- pub async fn get_onetime_keys(
+ pub async fn get_one_time_keys(
&self,
device_id: &str,
account_type: OlmAccountType,
@@ -574,9 +574,9 @@
// Avoid borrowing from lifetime of flattened_device_key_upload
let device_id = flattened_device_key_upload.device_id_key.clone();
let content_one_time_keys =
- flattened_device_key_upload.content_onetime_keys.clone();
+ flattened_device_key_upload.content_one_time_keys.clone();
let notif_one_time_keys =
- flattened_device_key_upload.notif_onetime_keys.clone();
+ flattened_device_key_upload.notif_one_time_keys.clone();
let device_info =
create_device_info(flattened_device_key_upload, social_proof);
diff --git a/services/identity/src/grpc_services/authenticated.rs b/services/identity/src/grpc_services/authenticated.rs
--- a/services/identity/src/grpc_services/authenticated.rs
+++ b/services/identity/src/grpc_services/authenticated.rs
@@ -139,8 +139,8 @@
pre_key: db_keys.notif_prekey.prekey,
pre_key_signature: db_keys.notif_prekey.prekey_signature,
}),
- onetime_content_prekey: db_keys.content_one_time_key,
- onetime_notif_prekey: db_keys.notif_one_time_key,
+ one_time_content_prekey: db_keys.content_one_time_key,
+ one_time_notif_prekey: db_keys.notif_one_time_key,
});
let response = Response::new(KeyserverKeysResponse {
diff --git a/services/identity/src/tunnelbroker.rs b/services/identity/src/tunnelbroker.rs
--- a/services/identity/src/tunnelbroker.rs
+++ b/services/identity/src/tunnelbroker.rs
@@ -24,13 +24,13 @@
pub async fn send_refresh_keys_request(
device_id: &str,
) -> Result<Response<Empty>, Error> {
- use crate::constants::ONETIME_KEY_REFRESH_NUMBER;
+ use crate::constants::ONE_TIME_KEY_REFRESH_NUMBER;
let mut tunnelbroker_client = create_tunnelbroker_client().await?;
let refresh_request = messages::RefreshKeyRequest {
device_id: device_id.to_string(),
- number_of_keys: ONETIME_KEY_REFRESH_NUMBER,
+ number_of_keys: ONE_TIME_KEY_REFRESH_NUMBER,
};
let payload = serde_json::to_string(&refresh_request).unwrap();
diff --git a/shared/protos/identity_authenticated.proto b/shared/protos/identity_authenticated.proto
--- a/shared/protos/identity_authenticated.proto
+++ b/shared/protos/identity_authenticated.proto
@@ -36,8 +36,8 @@
identity.client.IdentityKeyInfo identityInfo = 1;
identity.client.PreKey contentPrekey = 2;
identity.client.PreKey notifPrekey = 3;
- optional string onetimeContentPrekey = 4;
- optional string onetimeNotifPrekey = 5;
+ optional string oneTimeContentPrekey = 4;
+ optional string oneTimeNotifPrekey = 5;
}
message KeyserverKeysResponse {
diff --git a/shared/protos/identity_client.proto b/shared/protos/identity_client.proto
--- a/shared/protos/identity_client.proto
+++ b/shared/protos/identity_client.proto
@@ -121,8 +121,8 @@
IdentityKeyInfo deviceKeyInfo = 1;
PreKey contentUpload = 2;
PreKey notifUpload = 3;
- repeated string onetimeContentPrekeys = 4;
- repeated string onetimeNotifPrekeys = 5;
+ repeated string oneTimeContentPrekeys = 4;
+ repeated string oneTimeNotifPrekeys = 5;
DeviceType deviceType = 6;
}
@@ -281,8 +281,8 @@
IdentityKeyInfo identityInfo = 1;
PreKey contentPrekey = 2;
PreKey notifPrekey = 3;
- optional string onetimeContentPrekey = 4;
- optional string onetimeNotifPrekey = 5;
+ optional string oneTimeContentPrekey = 4;
+ optional string oneTimeNotifPrekey = 5;
}
// Information needed by a device to establish communcation when responding

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 6:36 AM (14 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2569452
Default Alt Text
D8817.id30340.diff (20 KB)

Event Timeline