diff --git a/keyserver/addons/rust-node-addon/rust-binding-types.js b/keyserver/addons/rust-node-addon/rust-binding-types.js --- a/keyserver/addons/rust-node-addon/rust-binding-types.js +++ b/keyserver/addons/rust-node-addon/rust-binding-types.js @@ -47,8 +47,8 @@ userId: string, deviceId: string, accessToken: string, - contentOneTimePreKeys: $ReadOnlyArray, - notifOneTimePreKeys: $ReadOnlyArray, + contentOneTimePrekeys: $ReadOnlyArray, + notifOneTimePrekeys: $ReadOnlyArray, ) => Promise, +getInboundKeysForUserDevice: ( authUserId: string, 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 @@ -39,13 +39,13 @@ payload_signature: signed_identity_keys_blob.signature, social_proof: None, }), - content_upload: Some(PreKey { - pre_key: content_prekey, - pre_key_signature: content_prekey_signature, + content_upload: Some(Prekey { + prekey: content_prekey, + prekey_signature: content_prekey_signature, }), - notif_upload: Some(PreKey { - pre_key: notif_prekey, - pre_key_signature: notif_prekey_signature, + notif_upload: Some(Prekey { + prekey: notif_prekey, + prekey_signature: notif_prekey_signature, }), one_time_content_prekeys: content_one_time_keys, one_time_notif_prekeys: notif_one_time_keys, @@ -55,7 +55,7 @@ debug!("Starting login to identity service"); let response = identity_client - .login_password_user_start(login_start_request) + .log_in_password_user_start(login_start_request) .await .map_err(handle_grpc_error)?; debug!("Received login response from identity service"); @@ -88,7 +88,7 @@ debug!("Attempting to finalize opaque login exchange with identity service"); let login_finish_response = identity_client - .login_password_user_finish(login_finish_request) + .log_in_password_user_finish(login_finish_request) .await .map_err(handle_grpc_error)? .into_inner(); diff --git a/keyserver/addons/rust-node-addon/src/identity_client/mod.rs b/keyserver/addons/rust-node-addon/src/identity_client/mod.rs --- a/keyserver/addons/rust-node-addon/src/identity_client/mod.rs +++ b/keyserver/addons/rust-node-addon/src/identity_client/mod.rs @@ -10,7 +10,7 @@ use client_proto::identity_client_service_client::IdentityClientServiceClient; use client_proto::{ AddReservedUsernamesRequest, DeviceKeyUpload, DeviceType, IdentityKeyInfo, - PreKey, RegistrationFinishRequest, RegistrationStartRequest, + Prekey, RegistrationFinishRequest, RegistrationStartRequest, RemoveReservedUsernameRequest, }; use config::get_identity_service_config; @@ -169,18 +169,18 @@ .content_prekey .ok_or(Error::from_status(Status::GenericFailure))?; - let PreKey { - pre_key: content_prekey_value, - pre_key_signature: content_prekey_signature, + let Prekey { + prekey: content_prekey_value, + prekey_signature: content_prekey_signature, } = content_prekey; let notif_prekey = key_info .notif_prekey .ok_or(Error::from_status(Status::GenericFailure))?; - let PreKey { - pre_key: notif_prekey_value, - pre_key_signature: notif_prekey_signature, + let Prekey { + prekey: notif_prekey_value, + prekey_signature: notif_prekey_signature, } = notif_prekey; Ok(Self { diff --git a/keyserver/addons/rust-node-addon/src/identity_client/prekey.rs b/keyserver/addons/rust-node-addon/src/identity_client/prekey.rs --- a/keyserver/addons/rust-node-addon/src/identity_client/prekey.rs +++ b/keyserver/addons/rust-node-addon/src/identity_client/prekey.rs @@ -1,7 +1,7 @@ use super::get_authenticated_identity_client; use super::{Error, Status}; use grpc_clients::identity::protos::{ - authenticated::RefreshUserPreKeysRequest, unauthenticated::PreKey, + authenticated::RefreshUserPrekeysRequest, unauthenticated::Prekey, }; use napi::Result; use tracing::warn; @@ -21,18 +21,18 @@ let mut client = get_authenticated_identity_client(user_id, device_id, access_token).await?; - let message = RefreshUserPreKeysRequest { - new_content_pre_keys: Some(PreKey { - pre_key: content_prekey, - pre_key_signature: content_prekey_signature, + let message = RefreshUserPrekeysRequest { + new_content_prekeys: Some(Prekey { + prekey: content_prekey, + prekey_signature: content_prekey_signature, }), - new_notif_pre_keys: Some(PreKey { - pre_key: notif_prekey, - pre_key_signature: notif_prekey_signature, + new_notif_prekeys: Some(Prekey { + prekey: notif_prekey, + prekey_signature: notif_prekey_signature, }), }; - client.refresh_user_pre_keys(message).await.map_err(|e| { + client.refresh_user_prekeys(message).await.map_err(|e| { warn!( "Failed to upload new prekeys to identity service: {:?}", e.message() 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 @@ -31,13 +31,13 @@ payload_signature: signed_identity_keys_blob.signature, social_proof: None, }), - content_upload: Some(PreKey { - pre_key: content_prekey, - pre_key_signature: content_prekey_signature, + content_upload: Some(Prekey { + prekey: content_prekey, + prekey_signature: content_prekey_signature, }), - notif_upload: Some(PreKey { - pre_key: notif_prekey, - pre_key_signature: notif_prekey_signature, + notif_upload: Some(Prekey { + prekey: notif_prekey, + prekey_signature: notif_prekey_signature, }), one_time_content_prekeys: content_one_time_keys, one_time_notif_prekeys: notif_one_time_keys, diff --git a/keyserver/addons/rust-node-addon/src/identity_client/upload_one_time_keys.rs b/keyserver/addons/rust-node-addon/src/identity_client/upload_one_time_keys.rs --- a/keyserver/addons/rust-node-addon/src/identity_client/upload_one_time_keys.rs +++ b/keyserver/addons/rust-node-addon/src/identity_client/upload_one_time_keys.rs @@ -8,16 +8,16 @@ user_id: String, device_id: String, access_token: String, - content_one_time_pre_keys: Vec, - notif_one_time_pre_keys: Vec, + content_one_time_prekeys: Vec, + notif_one_time_prekeys: Vec, ) -> Result { // Set up the gRPC client that will be used to talk to the Identity service let mut identity_client = get_authenticated_identity_client(user_id, device_id, access_token).await?; let upload_request = UploadOneTimeKeysRequest { - content_one_time_pre_keys, - notif_one_time_pre_keys, + content_one_time_prekeys, + notif_one_time_prekeys, }; debug!("Sending one time keys to Identity service"); 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 @@ -9,7 +9,7 @@ }; use grpc_clients::identity::protos::client::{ DeviceKeyUpload, DeviceType, Empty, IdentityKeyInfo, - OpaqueLoginFinishRequest, OpaqueLoginStartRequest, PreKey, + OpaqueLoginFinishRequest, OpaqueLoginStartRequest, Prekey, RegistrationFinishRequest, RegistrationStartRequest, WalletLoginRequest, }; use grpc_clients::identity::{ @@ -402,13 +402,13 @@ payload_signature: password_user_info.key_payload_signature, social_proof: None, }), - content_upload: Some(PreKey { - pre_key: password_user_info.content_prekey, - pre_key_signature: password_user_info.content_prekey_signature, + content_upload: Some(Prekey { + prekey: password_user_info.content_prekey, + prekey_signature: password_user_info.content_prekey_signature, }), - notif_upload: Some(PreKey { - pre_key: password_user_info.notif_prekey, - pre_key_signature: password_user_info.notif_prekey_signature, + notif_upload: Some(Prekey { + prekey: password_user_info.notif_prekey, + prekey_signature: password_user_info.notif_prekey_signature, }), one_time_content_prekeys: password_user_info.content_one_time_keys, one_time_notif_prekeys: password_user_info.notif_one_time_keys, @@ -516,13 +516,13 @@ payload_signature: password_user_info.key_payload_signature, social_proof: None, }), - content_upload: Some(PreKey { - pre_key: password_user_info.content_prekey, - pre_key_signature: password_user_info.content_prekey_signature, + content_upload: Some(Prekey { + prekey: password_user_info.content_prekey, + prekey_signature: password_user_info.content_prekey_signature, }), - notif_upload: Some(PreKey { - pre_key: password_user_info.notif_prekey, - pre_key_signature: password_user_info.notif_prekey_signature, + notif_upload: Some(Prekey { + prekey: password_user_info.notif_prekey, + prekey_signature: password_user_info.notif_prekey_signature, }), one_time_content_prekeys: password_user_info.content_one_time_keys, one_time_notif_prekeys: password_user_info.notif_one_time_keys, @@ -538,7 +538,7 @@ .await?; let response = identity_client - .login_password_user_start(login_start_request) + .log_in_password_user_start(login_start_request) .await?; // We need to get the load balancer cookie from from the response and send it @@ -570,7 +570,7 @@ } let login_finish_response = identity_client - .login_password_user_finish(finish_request) + .log_in_password_user_finish(finish_request) .await? .into_inner(); let user_id_and_access_token = UserIDAndDeviceAccessToken { @@ -640,13 +640,13 @@ payload_signature: wallet_user_info.key_payload_signature, social_proof: Some(wallet_user_info.social_proof), }), - content_upload: Some(PreKey { - pre_key: wallet_user_info.content_prekey, - pre_key_signature: wallet_user_info.content_prekey_signature, + content_upload: Some(Prekey { + prekey: wallet_user_info.content_prekey, + prekey_signature: wallet_user_info.content_prekey_signature, }), - notif_upload: Some(PreKey { - pre_key: wallet_user_info.notif_prekey, - pre_key_signature: wallet_user_info.notif_prekey_signature, + notif_upload: Some(Prekey { + prekey: wallet_user_info.notif_prekey, + prekey_signature: wallet_user_info.notif_prekey_signature, }), one_time_content_prekeys: wallet_user_info.content_one_time_keys, one_time_notif_prekeys: wallet_user_info.notif_one_time_keys, @@ -662,7 +662,7 @@ .await?; let login_response = identity_client - .login_wallet_user(login_request) + .log_in_wallet_user(login_request) .await? .into_inner(); @@ -847,17 +847,17 @@ let content_prekey = key_info.content_prekey.ok_or(Error::MissingResponseData)?; - let PreKey { - pre_key: content_prekey_value, - pre_key_signature: content_prekey_signature, + let Prekey { + prekey: content_prekey_value, + prekey_signature: content_prekey_signature, } = content_prekey; let notif_prekey = key_info.notif_prekey.ok_or(Error::MissingResponseData)?; - let PreKey { - pre_key: notif_prekey_value, - pre_key_signature: notif_prekey_signature, + let Prekey { + prekey: notif_prekey_value, + prekey_signature: notif_prekey_signature, } = notif_prekey; let one_time_content_prekey = key_info.one_time_content_prekey; @@ -945,17 +945,17 @@ let content_prekey = key_info.content_prekey.ok_or(Error::MissingResponseData)?; - let PreKey { - pre_key: content_prekey_value, - pre_key_signature: content_prekey_signature, + let Prekey { + prekey: content_prekey_value, + prekey_signature: content_prekey_signature, } = content_prekey; let notif_prekey = key_info.notif_prekey.ok_or(Error::MissingResponseData)?; - let PreKey { - pre_key: notif_prekey_value, - pre_key_signature: notif_prekey_signature, + let Prekey { + prekey: notif_prekey_value, + prekey_signature: notif_prekey_signature, } = notif_prekey; Ok(Self { @@ -1033,8 +1033,8 @@ ) { RUNTIME.spawn(async move { let upload_request = UploadOneTimeKeysRequest { - content_one_time_pre_keys: content_one_time_keys, - notif_one_time_pre_keys: notif_one_time_keys, + content_one_time_prekeys: content_one_time_keys, + notif_one_time_prekeys: notif_one_time_keys, }; let auth_info = AuthInfo { access_token: auth_access_token, 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 @@ -8,7 +8,7 @@ use crate::service_addr; use grpc_clients::identity::protos::client::{ - DeviceKeyUpload, DeviceType, IdentityKeyInfo, PreKey, + DeviceKeyUpload, DeviceType, IdentityKeyInfo, Prekey, RegistrationFinishRequest, RegistrationStartRequest, }; @@ -49,13 +49,13 @@ payload_signature: "foo".to_string(), social_proof: None, }), - content_upload: Some(PreKey { - pre_key: "content_prekey".to_string(), - pre_key_signature: "content_prekey_sig".to_string(), + content_upload: Some(Prekey { + prekey: "content_prekey".to_string(), + prekey_signature: "content_prekey_sig".to_string(), }), - notif_upload: Some(PreKey { - pre_key: "notif_prekey".to_string(), - pre_key_signature: "notif_prekey_sig".to_string(), + notif_upload: Some(Prekey { + prekey: "notif_prekey".to_string(), + prekey_signature: "notif_prekey_sig".to_string(), }), one_time_content_prekeys: Vec::new(), one_time_notif_prekeys: Vec::new(), diff --git a/services/commtest/tests/identity_access_tokens_tests.rs b/services/commtest/tests/identity_access_tokens_tests.rs --- a/services/commtest/tests/identity_access_tokens_tests.rs +++ b/services/commtest/tests/identity_access_tokens_tests.rs @@ -21,7 +21,7 @@ let verify_request = VerifyUserAccessTokenRequest { user_id: device_info.user_id, - signing_public_key: device_info.device_id, + device_id: device_info.device_id, access_token: device_info.access_token, }; 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 @@ -26,8 +26,8 @@ .expect("Couldn't connect to identity service"); let upload_request = UploadOneTimeKeysRequest { - content_one_time_pre_keys: vec!["content1".to_string()], - notif_one_time_pre_keys: vec!["notif1".to_string()], + content_one_time_prekeys: vec!["content1".to_string()], + notif_one_time_prekeys: vec!["notif1".to_string()], }; client diff --git a/services/commtest/tests/identity_one_time_key_tests.rs b/services/commtest/tests/identity_one_time_key_tests.rs --- a/services/commtest/tests/identity_one_time_key_tests.rs +++ b/services/commtest/tests/identity_one_time_key_tests.rs @@ -22,11 +22,11 @@ .expect("Couldn't connect to identity service"); let upload_request = UploadOneTimeKeysRequest { - content_one_time_pre_keys: vec![ + content_one_time_prekeys: vec![ "content1".to_string(), "content2".to_string(), ], - notif_one_time_pre_keys: vec!["notif1".to_string(), "notif2".to_string()], + notif_one_time_prekeys: vec!["notif1".to_string(), "notif2".to_string()], }; identity_client diff --git a/services/commtest/tests/identity_prekey_tests.rs b/services/commtest/tests/identity_prekey_tests.rs --- a/services/commtest/tests/identity_prekey_tests.rs +++ b/services/commtest/tests/identity_prekey_tests.rs @@ -4,7 +4,7 @@ use commtest::service_addr; use grpc_clients::identity::{ get_auth_client, - protos::{authenticated::RefreshUserPreKeysRequest, client::PreKey}, + protos::{authenticated::RefreshUserPrekeysRequest, client::Prekey}, }; #[tokio::test] @@ -22,20 +22,20 @@ .await .expect("Couldn't connect to identity service"); - let upload_request = RefreshUserPreKeysRequest { - new_content_pre_keys: Some(PreKey { - pre_key: "content_prekey".to_string(), - pre_key_signature: "content_prekey_signature".to_string(), + let upload_request = RefreshUserPrekeysRequest { + new_content_prekeys: Some(Prekey { + prekey: "content_prekey".to_string(), + prekey_signature: "content_prekey_signature".to_string(), }), - new_notif_pre_keys: Some(PreKey { - pre_key: "content_prekey".to_string(), - pre_key_signature: "content_prekey_signature".to_string(), + new_notif_prekeys: Some(Prekey { + prekey: "content_prekey".to_string(), + prekey_signature: "content_prekey_signature".to_string(), }), }; // This send will fail if the one-time keys weren't successfully added println!( "Error: {:?}", - client.refresh_user_pre_keys(upload_request).await + client.refresh_user_prekeys(upload_request).await ); } diff --git a/services/commtest/tests/identity_tunnelbroker_tests.rs b/services/commtest/tests/identity_tunnelbroker_tests.rs --- a/services/commtest/tests/identity_tunnelbroker_tests.rs +++ b/services/commtest/tests/identity_tunnelbroker_tests.rs @@ -48,8 +48,8 @@ .expect("Couldn't connect to identity service"); let upload_request = UploadOneTimeKeysRequest { - content_one_time_pre_keys: vec!["content1".to_string()], - notif_one_time_pre_keys: vec!["notif1".to_string()], + content_one_time_prekeys: vec!["content1".to_string()], + notif_one_time_prekeys: vec!["notif1".to_string()], }; client.upload_one_time_keys(upload_request).await.unwrap(); 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 @@ -243,7 +243,7 @@ } } - async fn login_password_user_start( + async fn log_in_password_user_start( &self, request: tonic::Request, ) -> Result, tonic::Status> { @@ -305,7 +305,7 @@ Ok(response) } - async fn login_password_user_finish( + async fn log_in_password_user_finish( &self, request: tonic::Request, ) -> Result, tonic::Status> { @@ -356,7 +356,7 @@ } } - async fn login_wallet_user( + async fn log_in_wallet_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { @@ -465,7 +465,7 @@ Ok(Response::new(response)) } - async fn login_reserved_wallet_user( + async fn log_in_reserved_wallet_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { @@ -574,13 +574,13 @@ request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); - debug!("Verifying device: {}", &message.signing_public_key); + debug!("Verifying device: {}", &message.device_id); let token_valid = self .client .verify_access_token( message.user_id, - message.signing_public_key.clone(), + message.device_id.clone(), message.access_token, ) .await @@ -589,7 +589,7 @@ let response = Response::new(VerifyUserAccessTokenResponse { token_valid }); debug!( "device {} was verified: {}", - &message.signing_public_key, token_valid + &message.device_id, token_valid ); Ok(response) } 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 @@ -25,11 +25,11 @@ GetDeviceListResponse, InboundKeyInfo, InboundKeysForUserRequest, InboundKeysForUserResponse, KeyserverKeysResponse, OutboundKeyInfo, OutboundKeysForUserRequest, OutboundKeysForUserResponse, - RefreshUserPreKeysRequest, UpdateUserPasswordFinishRequest, + RefreshUserPrekeysRequest, UpdateUserPasswordFinishRequest, UpdateUserPasswordStartRequest, UpdateUserPasswordStartResponse, UploadOneTimeKeysRequest, }; -use super::protos::client::{Empty, IdentityKeyInfo, PreKey}; +use super::protos::client::{Empty, IdentityKeyInfo, Prekey}; #[derive(derive_more::Constructor)] pub struct AuthenticatedService { @@ -91,9 +91,9 @@ #[tonic::async_trait] impl IdentityClientService for AuthenticatedService { - async fn refresh_user_pre_keys( + async fn refresh_user_prekeys( &self, - request: Request, + request: Request, ) -> Result, Status> { let (user_id, device_id) = get_user_and_device_id(&request)?; let message = request.into_inner(); @@ -101,10 +101,10 @@ debug!("Refreshing prekeys for user: {}", user_id); let content_keys = message - .new_content_pre_keys + .new_content_prekeys .ok_or_else(|| Status::invalid_argument("Missing content keys"))?; let notif_keys = message - .new_notif_pre_keys + .new_notif_prekeys .ok_or_else(|| Status::invalid_argument("Missing notification keys"))?; self @@ -112,10 +112,10 @@ .set_prekey( user_id, device_id, - content_keys.pre_key, - content_keys.pre_key_signature, - notif_keys.pre_key, - notif_keys.pre_key_signature, + content_keys.prekey, + content_keys.prekey_signature, + notif_keys.prekey, + notif_keys.prekey_signature, ) .await .map_err(handle_db_error)?; @@ -211,13 +211,13 @@ payload_signature: db_keys.key_payload_signature, social_proof: db_keys.social_proof, }), - content_prekey: Some(PreKey { - pre_key: db_keys.content_prekey.prekey, - pre_key_signature: db_keys.content_prekey.prekey_signature, + content_prekey: Some(Prekey { + prekey: db_keys.content_prekey.prekey, + prekey_signature: db_keys.content_prekey.prekey_signature, }), - notif_prekey: Some(PreKey { - pre_key: db_keys.notif_prekey.prekey, - pre_key_signature: db_keys.notif_prekey.prekey_signature, + notif_prekey: Some(Prekey { + prekey: db_keys.notif_prekey.prekey, + prekey_signature: db_keys.notif_prekey.prekey_signature, }), one_time_content_prekey: db_keys.content_one_time_key, one_time_notif_prekey: db_keys.notif_one_time_key, @@ -242,8 +242,8 @@ .db_client .append_one_time_prekeys( device_id, - message.content_one_time_pre_keys, - message.notif_one_time_pre_keys, + message.content_one_time_prekeys, + message.notif_one_time_prekeys, ) .await .map_err(handle_db_error)?; diff --git a/services/identity/src/grpc_utils.rs b/services/identity/src/grpc_utils.rs --- a/services/identity/src/grpc_utils.rs +++ b/services/identity/src/grpc_utils.rs @@ -18,7 +18,7 @@ grpc_services::protos::{ auth::{InboundKeyInfo, OutboundKeyInfo}, unauth::{ - DeviceKeyUpload, IdentityKeyInfo, OpaqueLoginStartRequest, PreKey, + DeviceKeyUpload, IdentityKeyInfo, OpaqueLoginStartRequest, Prekey, RegistrationStartRequest, ReservedRegistrationStartRequest, ReservedWalletLoginRequest, WalletLoginRequest, }, @@ -126,10 +126,10 @@ device_info: &mut HashMap, key_attr: &str, signature_attr: &str, -) -> Result { - Ok(PreKey { - pre_key: extract_key(device_info, key_attr)?, - pre_key_signature: extract_key(device_info, signature_attr)?, +) -> Result { + Ok(Prekey { + prekey: extract_key(device_info, key_attr)?, + prekey_signature: extract_key(device_info, signature_attr)?, }) } @@ -201,7 +201,7 @@ self .device_key_upload() .and_then(|upload| upload.content_upload.as_ref()) - .map(|prekey| prekey.pre_key.clone()) + .map(|prekey| prekey.prekey.clone()) .ok_or_else(|| Status::invalid_argument("unexpected message data")) } @@ -209,7 +209,7 @@ self .device_key_upload() .and_then(|upload| upload.content_upload.as_ref()) - .map(|prekey| prekey.pre_key_signature.clone()) + .map(|prekey| prekey.prekey_signature.clone()) .ok_or_else(|| Status::invalid_argument("unexpected message data")) } @@ -217,7 +217,7 @@ self .device_key_upload() .and_then(|upload| upload.notif_upload.as_ref()) - .map(|prekey| prekey.pre_key.clone()) + .map(|prekey| prekey.prekey.clone()) .ok_or_else(|| Status::invalid_argument("unexpected message data")) } @@ -225,7 +225,7 @@ self .device_key_upload() .and_then(|upload| upload.notif_upload.as_ref()) - .map(|prekey| prekey.pre_key_signature.clone()) + .map(|prekey| prekey.prekey_signature.clone()) .ok_or_else(|| Status::invalid_argument("unexpected message data")) } diff --git a/services/tunnelbroker/src/identity/mod.rs b/services/tunnelbroker/src/identity/mod.rs --- a/services/tunnelbroker/src/identity/mod.rs +++ b/services/tunnelbroker/src/identity/mod.rs @@ -27,7 +27,7 @@ .await?; let message = VerifyUserAccessTokenRequest { user_id: user_id.to_string(), - signing_public_key: device_id.to_string(), + device_id: device_id.to_string(), access_token: access_token.to_string(), }; diff --git a/shared/grpc_clients/src/identity/unauthenticated/client.rs b/shared/grpc_clients/src/identity/unauthenticated/client.rs --- a/shared/grpc_clients/src/identity/unauthenticated/client.rs +++ b/shared/grpc_clients/src/identity/unauthenticated/client.rs @@ -22,7 +22,7 @@ let message = VerifyUserAccessTokenRequest { user_id: user_id.to_string(), - signing_public_key: device_id.to_string(), + device_id: device_id.to_string(), access_token: access_token.to_string(), }; 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 @@ -15,17 +15,17 @@ // Replenish one-time preKeys rpc UploadOneTimeKeys(UploadOneTimeKeysRequest) returns (identity.client.Empty) {} - // Rotate a device's preKey and preKey signature + // Rotate a device's prekey and prekey signature // Rotated for deniability of older messages - rpc RefreshUserPreKeys(RefreshUserPreKeysRequest) + rpc RefreshUserPrekeys(RefreshUserPrekeysRequest) returns (identity.client.Empty) {} // Called by clients to get all device keys associated with a user in order // to open a new channel of communication on any of their devices. // Specially, this will return the following per device: // - Identity keys (both Content and Notif Keys) - // - PreKey (including preKey signature) - // - One-time PreKey + // - Prekey (including prekey signature) + // - One-time Prekey rpc GetOutboundKeysForUser(OutboundKeysForUserRequest) returns (OutboundKeysForUserResponse) {} // Called by receivers of a communication request. The reponse will only @@ -64,29 +64,29 @@ // As OPKs get exhausted, they need to be refreshed message UploadOneTimeKeysRequest { - repeated string contentOneTimePreKeys = 1; - repeated string notifOneTimePreKeys = 2; + repeated string content_one_time_prekeys = 1; + repeated string notif_one_time_prekeys = 2; } // RefreshUserPreKeys -message RefreshUserPreKeysRequest { - identity.client.PreKey newContentPreKeys = 1; - identity.client.PreKey newNotifPreKeys = 2; +message RefreshUserPrekeysRequest { + identity.client.Prekey new_content_prekeys = 1; + identity.client.Prekey new_notif_prekeys = 2; } // Information needed when establishing communication to someone else's device message OutboundKeyInfo { - identity.client.IdentityKeyInfo identityInfo = 1; - identity.client.PreKey contentPrekey = 2; - identity.client.PreKey notifPrekey = 3; - optional string oneTimeContentPrekey = 4; - optional string oneTimeNotifPrekey = 5; + identity.client.IdentityKeyInfo identity_info = 1; + identity.client.Prekey content_prekey = 2; + identity.client.Prekey notif_prekey = 3; + optional string one_time_content_prekey = 4; + optional string one_time_notif_prekey = 5; } message KeyserverKeysResponse { - optional OutboundKeyInfo keyserverInfo = 1; + optional OutboundKeyInfo keyserver_info = 1; } // GetOutboundKeysForUser @@ -100,15 +100,15 @@ // to a request. // The device receiving a request only needs the content key and prekey. message OutboundKeysForUserRequest { - string userID = 1; + string user_id = 1; } // GetInboundKeysForUser message InboundKeyInfo { - identity.client.IdentityKeyInfo identityInfo = 1; - identity.client.PreKey contentPrekey = 2; - identity.client.PreKey notifPrekey = 3; + identity.client.IdentityKeyInfo identity_info = 1; + identity.client.Prekey content_prekey = 2; + identity.client.Prekey notif_prekey = 3; } message InboundKeysForUserResponse { @@ -117,7 +117,7 @@ } message InboundKeysForUserRequest { - string userID = 1; + string user_id = 1; } // FindUserID @@ -125,13 +125,13 @@ message FindUserIDRequest { oneof identifier { string username = 1; - string walletAddress = 2; + string wallet_address = 2; } } message FindUserIDResponse { // userID if the user is registered with Identity Service, null otherwise - optional string userID = 1; + optional string user_id = 1; // true if the identifier (username or wallet address) exists in the // reserved usernames list, false otherwise. It doesn't take into account // whether the user is registered with Identity Service (userID != null). @@ -144,22 +144,22 @@ // access token to validate user before updating password message UpdateUserPasswordStartRequest { // Message sent to initiate PAKE registration (step 1) - bytes opaqueRegistrationRequest = 1; + bytes opaque_registration_request = 1; } // Do a user registration, but overwrite the existing credentials // after validation of user message UpdateUserPasswordFinishRequest { // Identifier used to correlate start and finish request - string sessionID = 1; + string session_id = 1; // Opaque client registration upload (step 3) - bytes opaqueRegistrationUpload = 2; + bytes opaque_registration_upload = 2; } message UpdateUserPasswordStartResponse { // Identifier used to correlate start request with finish request - string sessionID = 1; - bytes opaqueRegistrationResponse = 2; + string session_id = 1; + bytes opaque_registration_response = 2; } // GetDeviceListForUser 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 @@ -18,12 +18,12 @@ rpc RegisterPasswordUserFinish(RegistrationFinishRequest) returns ( RegistrationFinishResponse) {} // Called by user to register device and get an access token - rpc LoginPasswordUserStart(OpaqueLoginStartRequest) returns + rpc LogInPasswordUserStart(OpaqueLoginStartRequest) returns (OpaqueLoginStartResponse) {} - rpc LoginPasswordUserFinish(OpaqueLoginFinishRequest) returns + rpc LogInPasswordUserFinish(OpaqueLoginFinishRequest) returns (OpaqueLoginFinishResponse) {} - rpc LoginWalletUser(WalletLoginRequest) returns (WalletLoginResponse) {} - rpc LoginReservedWalletUser(ReservedWalletLoginRequest) returns + rpc LogInWalletUser(WalletLoginRequest) returns (WalletLoginResponse) {} + rpc LogInReservedWalletUser(ReservedWalletLoginRequest) returns (WalletLoginResponse) {} // Sign-In with Ethereum actions @@ -56,9 +56,9 @@ message Empty {} -message PreKey { - string preKey = 1; - string preKeySignature = 2; +message Prekey { + string prekey = 1; + string prekey_signature = 2; } // Key information needed for starting a X3DH session @@ -68,10 +68,10 @@ // For keyservers, this will only contain ContentKeys string payload = 1; // Payload signed with the signing ed25519 key - string payloadSignature = 2; + string payload_signature = 2; // Signed message used for SIWE // This correlates a given wallet with a device's content key - optional string socialProof = 3; + optional string social_proof = 3; } // RegisterUser @@ -84,69 +84,69 @@ // be provide to avoid exhausting them. enum DeviceType { - Keyserver = 0; - Web = 1; + KEYSERVER = 0; + WEB = 1; // iOS doesn't leave a good option for title to camel case renaming - Ios = 2; - Android = 3; - Windows = 4; - MacOS = 5; + IOS = 2; + ANDROID = 3; + WINDOWS = 4; + MAC_OS = 5; } // Bundle of information needed for creating an initial message using X3DH message DeviceKeyUpload { - IdentityKeyInfo deviceKeyInfo = 1; - PreKey contentUpload = 2; - PreKey notifUpload = 3; - repeated string oneTimeContentPrekeys = 4; - repeated string oneTimeNotifPrekeys = 5; - DeviceType deviceType = 6; + IdentityKeyInfo device_key_info = 1; + Prekey content_upload = 2; + Prekey notif_upload = 3; + repeated string one_time_content_prekeys = 4; + repeated string one_time_notif_prekeys = 5; + DeviceType device_type = 6; } // Request for registering a new user message RegistrationStartRequest { // Message sent to initiate PAKE registration (step 1) - bytes opaqueRegistrationRequest = 1; + bytes opaque_registration_request = 1; string username = 2; // Information needed to open a new channel to current user's device - DeviceKeyUpload deviceKeyUpload = 3; + DeviceKeyUpload device_key_upload = 3; } message ReservedRegistrationStartRequest { // Message sent to initiate PAKE registration (step 1) - bytes opaqueRegistrationRequest = 1; + bytes opaque_registration_request = 1; string username = 2; // Information needed to open a new channel to current user's device - DeviceKeyUpload deviceKeyUpload = 3; + DeviceKeyUpload device_key_upload = 3; // Message from Ashoat's keyserver attesting that a given user has ownership // of a given username - string keyserverMessage = 4; + string keyserver_message = 4; // Above message signed with Ashoat's keyserver's signing ed25519 key - string keyserverSignature = 5; + string keyserver_signature = 5; } // Messages sent from a client to Identity Service message RegistrationFinishRequest { // Identifier to correlate RegisterStart session - string sessionID = 1; + string session_id = 1; // Final message in PAKE registration - bytes opaqueRegistrationUpload = 2; + bytes opaque_registration_upload = 2; } // Messages sent from Identity Service to client message RegistrationStartResponse { // Identifier used to correlate start request with finish request - string sessionID = 1; + string session_id = 1; // sent to the user upon reception of the PAKE registration attempt // (step 2) - bytes opaqueRegistrationResponse = 2; + bytes opaque_registration_response = 2; } message RegistrationFinishResponse { // Unique identifier for newly registered user - string userID = 1; + string user_id = 1; // After successful unpacking of user credentials, return token - string accessToken = 2; + string access_token = 2; } // LoginUser @@ -154,58 +154,58 @@ message OpaqueLoginStartRequest { string username = 1; // Message sent to initiate PAKE login (step 1) - bytes opaqueLoginRequest = 2; + bytes opaque_login_request = 2; // Information specific to a user's device needed to open a new channel of // communication with this user - DeviceKeyUpload deviceKeyUpload = 3; + DeviceKeyUpload device_key_upload = 3; } message OpaqueLoginFinishRequest { // Identifier used to correlate start request with finish request - string sessionID = 1; + string session_id = 1; // Message containing client's reponse to server challenge. // Used to verify that client holds password secret (Step 3) - bytes opaqueLoginUpload = 2; + bytes opaque_login_upload = 2; } message OpaqueLoginStartResponse { // Identifier used to correlate start request with finish request - string sessionID = 1; + string session_id = 1; // Opaque challenge sent from server to client attempting to login (Step 2) - bytes opaqueLoginResponse = 2; + bytes opaque_login_response = 2; } message OpaqueLoginFinishResponse { - string userID = 1; + string user_id = 1; // Mint and return a new access token upon successful login - string accessToken = 2; + string access_token = 2; } message WalletLoginRequest { - string siweMessage = 1; - string siweSignature = 2; + string siwe_message = 1; + string siwe_signature = 2; // Information specific to a user's device needed to open a new channel of // communication with this user - DeviceKeyUpload deviceKeyUpload = 3; + DeviceKeyUpload device_key_upload = 3; } message ReservedWalletLoginRequest { - string siweMessage = 1; - string siweSignature = 2; + string siwe_message = 1; + string siwe_signature = 2; // Information specific to a user's device needed to open a new channel of // communication with this user - DeviceKeyUpload deviceKeyUpload = 3; + DeviceKeyUpload device_key_upload = 3; // Message from Ashoat's keyserver attesting that a given user has ownership // of a given wallet address - string keyserverMessage = 4; + string keyserver_message = 4; // Above message signed with Ashoat's keyserver's signing ed25519 key - string keyserverSignature = 5; + string keyserver_signature = 5; } message WalletLoginResponse { - string userID = 1; - string accessToken = 2; + string user_id = 1; + string access_token = 2; } // GenerateNonce @@ -217,14 +217,14 @@ // VerifyUserAccessToken message VerifyUserAccessTokenRequest { - string userID = 1; + string user_id = 1; // signing ed25519 key for the given user's device - string signingPublicKey = 2; - string accessToken = 3; + string device_id = 2; + string access_token = 3; } message VerifyUserAccessTokenResponse { - bool tokenValid = 1; + bool token_valid = 1; } // AddReservedUsernames diff --git a/shared/protos/tunnelbroker.proto b/shared/protos/tunnelbroker.proto --- a/shared/protos/tunnelbroker.proto +++ b/shared/protos/tunnelbroker.proto @@ -19,7 +19,7 @@ message MessageToDevice { // The primary identity key of a device - string deviceID = 1; + string device_id = 1; // JSON encoded message. See shared/tunnelbroker_messages for valid payloads string payload = 2; }