diff --git a/.github/workflows/identity_tests.yml b/.github/workflows/identity_tests.yml index cf33509c1..7614c6625 100644 --- a/.github/workflows/identity_tests.yml +++ b/.github/workflows/identity_tests.yml @@ -1,24 +1,24 @@ name: Identity tests (Nix) on: push: branches: [master] paths: - 'services/identity/**' - - 'shared/protos/identity_client.proto' + - 'shared/protos/identity_unauthenticated.proto' - 'flake.*' - 'nix/**' jobs: build: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v17 with: extra_nix_config: | extra-substituters = https://comm.cachix.org extra-trusted-public-keys = comm.cachix.org-1:70RF31rkmCEhQ9HrXA2uXcpqQKGcUK3TxLJdgcUCaA4= - name: Identity tests working-directory: ./services/identity run: nix develop --accept-flake-config --command cargo test diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs index 86e0fd8f0..8cc3a9f13 100644 --- a/native/native_rust_library/src/lib.rs +++ b/native/native_rust_library/src/lib.rs @@ -1,1095 +1,1095 @@ use backup::ffi::*; use comm_opaque2::client::{Login, Registration}; use comm_opaque2::grpc::opaque_error_to_grpc_status as handle_error; use ffi::{bool_callback, string_callback, void_callback}; use grpc_clients::identity::protos::authenticated::{ InboundKeyInfo, InboundKeysForUserRequest, OutboundKeyInfo, OutboundKeysForUserRequest, UpdateUserPasswordFinishRequest, UpdateUserPasswordStartRequest, UploadOneTimeKeysRequest, }; -use grpc_clients::identity::protos::client::{ +use grpc_clients::identity::protos::unauth::{ DeviceKeyUpload, DeviceType, Empty, IdentityKeyInfo, OpaqueLoginFinishRequest, OpaqueLoginStartRequest, Prekey, RegistrationFinishRequest, RegistrationStartRequest, WalletLoginRequest, }; use grpc_clients::identity::{ get_auth_client, get_unauthenticated_client, REQUEST_METADATA_COOKIE_KEY, RESPONSE_METADATA_COOKIE_KEY, }; use lazy_static::lazy_static; use serde::Serialize; use std::sync::Arc; use tokio::runtime::{Builder, Runtime}; use tonic::{Request, Status}; use tracing::instrument; mod argon2_tools; mod backup; mod constants; use argon2_tools::compute_backup_key_str; mod generated { // We get the CODE_VERSION from this generated file include!(concat!(env!("OUT_DIR"), "/version.rs")); // We get the IDENTITY_SOCKET_ADDR from this generated file include!(concat!(env!("OUT_DIR"), "/socket_config.rs")); } pub use generated::CODE_VERSION; pub use generated::{BACKUP_SOCKET_ADDR, IDENTITY_SOCKET_ADDR}; #[cfg(not(target_os = "android"))] pub const DEVICE_TYPE: DeviceType = DeviceType::Ios; #[cfg(target_os = "android")] pub const DEVICE_TYPE: DeviceType = DeviceType::Android; lazy_static! { static ref RUNTIME: Arc = Arc::new(Builder::new_multi_thread().enable_all().build().unwrap()); } #[cxx::bridge] mod ffi { extern "Rust" { #[cxx_name = "identityRegisterUser"] fn register_user( username: String, password: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, promise_id: u32, ); #[cxx_name = "identityLoginPasswordUser"] fn login_password_user( username: String, password: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, promise_id: u32, ); #[cxx_name = "identityLoginWalletUser"] fn login_wallet_user( siwe_message: String, siwe_signature: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, social_proof: String, promise_id: u32, ); #[cxx_name = "identityUpdateUserPassword"] fn update_user_password( user_id: String, device_id: String, access_token: String, password: String, promise_id: u32, ); #[cxx_name = "identityDeleteUser"] fn delete_user( user_id: String, device_id: String, access_token: String, promise_id: u32, ); #[cxx_name = "identityGetOutboundKeysForUser"] fn get_outbound_keys_for_user( auth_user_id: String, auth_device_id: String, auth_access_token: String, user_id: String, promise_id: u32, ); #[cxx_name = "identityGetInboundKeysForUser"] fn get_inbound_keys_for_user( auth_user_id: String, auth_device_id: String, auth_access_token: String, user_id: String, promise_id: u32, ); #[cxx_name = "identityGenerateNonce"] fn generate_nonce(promise_id: u32); #[cxx_name = "identityVersionSupported"] fn version_supported(promise_id: u32); #[cxx_name = "identityUploadOneTimeKeys"] fn upload_one_time_keys( auth_user_id: String, auth_device_id: String, auth_access_token: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, promise_id: u32, ); // Argon2 #[cxx_name = "compute_backup_key"] fn compute_backup_key_str( password: &str, backup_id: &str, ) -> Result<[u8; 32]>; } unsafe extern "C++" { include!("RustCallback.h"); #[namespace = "comm"] #[cxx_name = "stringCallback"] fn string_callback(error: String, promise_id: u32, ret: String); #[namespace = "comm"] #[cxx_name = "voidCallback"] fn void_callback(error: String, promise_id: u32); #[namespace = "comm"] #[cxx_name = "boolCallback"] fn bool_callback(error: String, promise_id: u32, ret: bool); } // AES cryptography #[namespace = "comm"] unsafe extern "C++" { include!("RustAESCrypto.h"); #[allow(unused)] #[cxx_name = "aesGenerateKey"] fn generate_key(buffer: &mut [u8]) -> Result<()>; /// The first two argument aren't mutated but creation of Java ByteBuffer /// requires the underlying bytes to be mutable. #[allow(unused)] #[cxx_name = "aesEncrypt"] fn encrypt( key: &mut [u8], plaintext: &mut [u8], sealed_data: &mut [u8], ) -> Result<()>; /// The first two argument aren't mutated but creation of Java ByteBuffer /// requires the underlying bytes to be mutable. #[allow(unused)] #[cxx_name = "aesDecrypt"] fn decrypt( key: &mut [u8], sealed_data: &mut [u8], plaintext: &mut [u8], ) -> Result<()>; } // Comm Services Auth Metadata Emission #[namespace = "comm"] unsafe extern "C++" { include!("RustCSAMetadataEmitter.h"); #[allow(unused)] #[cxx_name = "sendAuthMetadataToJS"] fn send_auth_metadata_to_js( access_token: String, user_id: String, ) -> Result<()>; } // Backup extern "Rust" { #[cxx_name = "createBackup"] fn create_backup_sync( backup_id: String, backup_secret: String, pickle_key: String, pickled_account: String, user_data: String, promise_id: u32, ); #[cxx_name = "restoreBackup"] fn restore_backup_sync(backup_secret: String, promise_id: u32); } // Secure store #[namespace = "comm"] unsafe extern "C++" { include!("RustSecureStore.h"); #[allow(unused)] #[cxx_name = "secureStoreSet"] fn secure_store_set(key: &str, value: String) -> Result<()>; #[cxx_name = "secureStoreGet"] fn secure_store_get(key: &str) -> Result; } } fn handle_string_result_as_callback( result: Result, promise_id: u32, ) where E: std::fmt::Display, { match result { Err(e) => string_callback(e.to_string(), promise_id, "".to_string()), Ok(r) => string_callback("".to_string(), promise_id, r), } } fn handle_void_result_as_callback(result: Result<(), E>, promise_id: u32) where E: std::fmt::Display, { match result { Err(e) => void_callback(e.to_string(), promise_id), Ok(_) => void_callback("".to_string(), promise_id), } } fn handle_bool_result_as_callback(result: Result, promise_id: u32) where E: std::fmt::Display, { match result { Err(e) => bool_callback(e.to_string(), promise_id, false), Ok(r) => bool_callback("".to_string(), promise_id, r), } } fn generate_nonce(promise_id: u32) { RUNTIME.spawn(async move { let result = fetch_nonce().await; handle_string_result_as_callback(result, promise_id); }); } async fn fetch_nonce() -> Result { let mut identity_client = get_unauthenticated_client( IDENTITY_SOCKET_ADDR, CODE_VERSION, DEVICE_TYPE.as_str_name().to_lowercase(), ) .await?; let nonce = identity_client .generate_nonce(Empty {}) .await? .into_inner() .nonce; Ok(nonce) } fn version_supported(promise_id: u32) { RUNTIME.spawn(async move { let result = version_supported_helper().await; handle_bool_result_as_callback(result, promise_id); }); } async fn version_supported_helper() -> Result { let mut identity_client = get_unauthenticated_client( IDENTITY_SOCKET_ADDR, CODE_VERSION, DEVICE_TYPE.as_str_name().to_lowercase(), ) .await?; let response = identity_client.ping(Empty {}).await; match response { Ok(_) => Ok(true), Err(e) => { if grpc_clients::error::is_version_unsupported(&e) { Ok(false) } else { Err(e.into()) } } } } struct AuthInfo { user_id: String, device_id: String, access_token: String, } #[instrument] fn register_user( username: String, password: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, promise_id: u32, ) { RUNTIME.spawn(async move { let password_user_info = PasswordUserInfo { username, password, key_payload, key_payload_signature, content_prekey, content_prekey_signature, notif_prekey, notif_prekey_signature, 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); }); } struct PasswordUserInfo { username: String, password: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, } #[derive(Serialize)] #[serde(rename_all = "camelCase")] struct UserIDAndDeviceAccessToken { #[serde(rename = "userID")] user_id: String, access_token: String, } async fn register_user_helper( password_user_info: PasswordUserInfo, ) -> Result { let mut client_registration = Registration::new(); let opaque_registration_request = client_registration .start(&password_user_info.password) .map_err(handle_error)?; let registration_start_request = RegistrationStartRequest { opaque_registration_request, username: password_user_info.username, device_key_upload: Some(DeviceKeyUpload { device_key_info: Some(IdentityKeyInfo { payload: password_user_info.key_payload, payload_signature: password_user_info.key_payload_signature, social_proof: None, }), content_upload: Some(Prekey { prekey: password_user_info.content_prekey, prekey_signature: password_user_info.content_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, device_type: DEVICE_TYPE.into(), }), }; let mut identity_client = get_unauthenticated_client( IDENTITY_SOCKET_ADDR, CODE_VERSION, DEVICE_TYPE.as_str_name().to_lowercase(), ) .await?; let response = identity_client .register_password_user_start(registration_start_request) .await?; // We need to get the load balancer cookie from from the response and send it // in the subsequent request to ensure it is routed to the same identity // service instance as the first request let cookie = response .metadata() .get(RESPONSE_METADATA_COOKIE_KEY) .cloned(); let registration_start_response = response.into_inner(); let opaque_registration_upload = client_registration .finish( &password_user_info.password, ®istration_start_response.opaque_registration_response, ) .map_err(handle_error)?; let registration_finish_request = RegistrationFinishRequest { session_id: registration_start_response.session_id, opaque_registration_upload, }; let mut finish_request = Request::new(registration_finish_request); // Cookie won't be available in local dev environments if let Some(cookie_metadata) = cookie { finish_request .metadata_mut() .insert(REQUEST_METADATA_COOKIE_KEY, cookie_metadata); } let registration_finish_response = identity_client .register_password_user_finish(finish_request) .await? .into_inner(); let user_id_and_access_token = UserIDAndDeviceAccessToken { user_id: registration_finish_response.user_id, access_token: registration_finish_response.access_token, }; Ok(serde_json::to_string(&user_id_and_access_token)?) } #[instrument] fn login_password_user( username: String, password: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, promise_id: u32, ) { RUNTIME.spawn(async move { let password_user_info = PasswordUserInfo { username, password, key_payload, key_payload_signature, content_prekey, content_prekey_signature, notif_prekey, notif_prekey_signature, 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); }); } async fn login_password_user_helper( password_user_info: PasswordUserInfo, ) -> Result { let mut client_login = Login::new(); let opaque_login_request = client_login .start(&password_user_info.password) .map_err(handle_error)?; let login_start_request = OpaqueLoginStartRequest { opaque_login_request, username: password_user_info.username, device_key_upload: Some(DeviceKeyUpload { device_key_info: Some(IdentityKeyInfo { payload: password_user_info.key_payload, payload_signature: password_user_info.key_payload_signature, social_proof: None, }), content_upload: Some(Prekey { prekey: password_user_info.content_prekey, prekey_signature: password_user_info.content_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, device_type: DEVICE_TYPE.into(), }), }; let mut identity_client = get_unauthenticated_client( IDENTITY_SOCKET_ADDR, CODE_VERSION, DEVICE_TYPE.as_str_name().to_lowercase(), ) .await?; let response = identity_client .log_in_password_user_start(login_start_request) .await?; // We need to get the load balancer cookie from from the response and send it // in the subsequent request to ensure it is routed to the same identity // service instance as the first request let cookie = response .metadata() .get(RESPONSE_METADATA_COOKIE_KEY) .cloned(); let login_start_response = response.into_inner(); let opaque_login_upload = client_login .finish(&login_start_response.opaque_login_response) .map_err(handle_error)?; let login_finish_request = OpaqueLoginFinishRequest { session_id: login_start_response.session_id, opaque_login_upload, }; let mut finish_request = Request::new(login_finish_request); // Cookie won't be available in local dev environments if let Some(cookie_metadata) = cookie { finish_request .metadata_mut() .insert(REQUEST_METADATA_COOKIE_KEY, cookie_metadata); } let login_finish_response = identity_client .log_in_password_user_finish(finish_request) .await? .into_inner(); let user_id_and_access_token = UserIDAndDeviceAccessToken { user_id: login_finish_response.user_id, access_token: login_finish_response.access_token, }; Ok(serde_json::to_string(&user_id_and_access_token)?) } struct WalletUserInfo { siwe_message: String, siwe_signature: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, social_proof: String, } #[instrument] fn login_wallet_user( siwe_message: String, siwe_signature: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, social_proof: String, promise_id: u32, ) { RUNTIME.spawn(async move { let wallet_user_info = WalletUserInfo { siwe_message, siwe_signature, key_payload, key_payload_signature, content_prekey, content_prekey_signature, notif_prekey, notif_prekey_signature, content_one_time_keys, notif_one_time_keys, social_proof, }; let result = login_wallet_user_helper(wallet_user_info).await; handle_string_result_as_callback(result, promise_id); }); } async fn login_wallet_user_helper( wallet_user_info: WalletUserInfo, ) -> Result { let login_request = WalletLoginRequest { siwe_message: wallet_user_info.siwe_message, siwe_signature: wallet_user_info.siwe_signature, device_key_upload: Some(DeviceKeyUpload { device_key_info: Some(IdentityKeyInfo { payload: wallet_user_info.key_payload, payload_signature: wallet_user_info.key_payload_signature, social_proof: Some(wallet_user_info.social_proof), }), content_upload: Some(Prekey { prekey: wallet_user_info.content_prekey, prekey_signature: wallet_user_info.content_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, device_type: DEVICE_TYPE.into(), }), }; let mut identity_client = get_unauthenticated_client( IDENTITY_SOCKET_ADDR, CODE_VERSION, DEVICE_TYPE.as_str_name().to_lowercase(), ) .await?; let login_response = identity_client .log_in_wallet_user(login_request) .await? .into_inner(); let user_id_and_access_token = UserIDAndDeviceAccessToken { user_id: login_response.user_id, access_token: login_response.access_token, }; Ok(serde_json::to_string(&user_id_and_access_token)?) } struct UpdatePasswordInfo { user_id: String, device_id: String, access_token: String, password: String, } fn update_user_password( user_id: String, device_id: String, access_token: String, password: String, promise_id: u32, ) { RUNTIME.spawn(async move { let update_password_info = UpdatePasswordInfo { access_token, user_id, device_id, password, }; let result = update_user_password_helper(update_password_info).await; handle_void_result_as_callback(result, promise_id); }); } async fn update_user_password_helper( update_password_info: UpdatePasswordInfo, ) -> Result<(), Error> { let mut client_registration = Registration::new(); let opaque_registration_request = client_registration .start(&update_password_info.password) .map_err(handle_error)?; let update_password_start_request = UpdateUserPasswordStartRequest { opaque_registration_request, }; let mut identity_client = get_auth_client( IDENTITY_SOCKET_ADDR, update_password_info.user_id, update_password_info.device_id, update_password_info.access_token, CODE_VERSION, DEVICE_TYPE.as_str_name().to_lowercase(), ) .await?; let response = identity_client .update_user_password_start(update_password_start_request) .await?; // We need to get the load balancer cookie from from the response and send it // in the subsequent request to ensure it is routed to the same identity // service instance as the first request let cookie = response .metadata() .get(RESPONSE_METADATA_COOKIE_KEY) .cloned(); let update_password_start_response = response.into_inner(); let opaque_registration_upload = client_registration .finish( &update_password_info.password, &update_password_start_response.opaque_registration_response, ) .map_err(handle_error)?; let update_password_finish_request = UpdateUserPasswordFinishRequest { session_id: update_password_start_response.session_id, opaque_registration_upload, }; let mut finish_request = Request::new(update_password_finish_request); // Cookie won't be available in local dev environments if let Some(cookie_metadata) = cookie { finish_request .metadata_mut() .insert(REQUEST_METADATA_COOKIE_KEY, cookie_metadata); } identity_client .update_user_password_finish(finish_request) .await?; Ok(()) } fn delete_user( user_id: String, device_id: String, access_token: String, promise_id: u32, ) { RUNTIME.spawn(async move { let auth_info = AuthInfo { access_token, user_id, device_id, }; let result = delete_user_helper(auth_info).await; handle_void_result_as_callback(result, promise_id); }); } async fn delete_user_helper(auth_info: AuthInfo) -> Result<(), Error> { let mut identity_client = get_auth_client( IDENTITY_SOCKET_ADDR, auth_info.user_id, auth_info.device_id, auth_info.access_token, CODE_VERSION, DEVICE_TYPE.as_str_name().to_lowercase(), ) .await?; identity_client.delete_user(Empty {}).await?; Ok(()) } struct GetOutboundKeysRequestInfo { user_id: String, } struct GetInboundKeysRequestInfo { user_id: String, } // This struct should not be altered without also updating // OutboundKeyInfoResponse in lib/types/identity-service-types.js #[derive(Serialize)] #[serde(rename_all = "camelCase")] struct OutboundKeyInfoResponse { pub payload: String, pub payload_signature: String, pub social_proof: Option, pub content_prekey: String, pub content_prekey_signature: String, pub notif_prekey: String, pub notif_prekey_signature: String, pub one_time_content_prekey: Option, pub one_time_notif_prekey: Option, } // This struct should not be altered without also updating // InboundKeyInfoResponse in lib/types/identity-service-types.js #[derive(Serialize)] #[serde(rename_all = "camelCase")] struct InboundKeyInfoResponse { pub payload: String, pub payload_signature: String, pub social_proof: Option, pub content_prekey: String, pub content_prekey_signature: String, pub notif_prekey: String, pub notif_prekey_signature: String, } impl TryFrom for OutboundKeyInfoResponse { type Error = Error; fn try_from(key_info: OutboundKeyInfo) -> Result { let identity_info = key_info.identity_info.ok_or(Error::MissingResponseData)?; let IdentityKeyInfo { payload, payload_signature, social_proof, } = identity_info; let content_prekey = key_info.content_prekey.ok_or(Error::MissingResponseData)?; 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 { prekey: notif_prekey_value, prekey_signature: notif_prekey_signature, } = notif_prekey; let one_time_content_prekey = key_info.one_time_content_prekey; let one_time_notif_prekey = key_info.one_time_notif_prekey; Ok(Self { payload, payload_signature, social_proof, content_prekey: content_prekey_value, content_prekey_signature, notif_prekey: notif_prekey_value, notif_prekey_signature, one_time_content_prekey, one_time_notif_prekey, }) } } fn get_outbound_keys_for_user( auth_user_id: String, auth_device_id: String, auth_access_token: String, user_id: String, promise_id: u32, ) { RUNTIME.spawn(async move { let get_outbound_keys_request_info = GetOutboundKeysRequestInfo { user_id }; let auth_info = AuthInfo { access_token: auth_access_token, user_id: auth_user_id, device_id: auth_device_id, }; let result = get_outbound_keys_for_user_helper( get_outbound_keys_request_info, auth_info, ) .await; handle_string_result_as_callback(result, promise_id); }); } async fn get_outbound_keys_for_user_helper( get_outbound_keys_request_info: GetOutboundKeysRequestInfo, auth_info: AuthInfo, ) -> Result { let mut identity_client = get_auth_client( IDENTITY_SOCKET_ADDR, auth_info.user_id, auth_info.device_id, auth_info.access_token, CODE_VERSION, DEVICE_TYPE.as_str_name().to_lowercase(), ) .await?; let response = identity_client .get_outbound_keys_for_user(OutboundKeysForUserRequest { user_id: get_outbound_keys_request_info.user_id, }) .await? .into_inner(); let outbound_key_info: Vec = response .devices .into_values() .map(OutboundKeyInfoResponse::try_from) .collect::, _>>()?; Ok(serde_json::to_string(&outbound_key_info)?) } impl TryFrom for InboundKeyInfoResponse { type Error = Error; fn try_from(key_info: InboundKeyInfo) -> Result { let identity_info = key_info.identity_info.ok_or(Error::MissingResponseData)?; let IdentityKeyInfo { payload, payload_signature, social_proof, } = identity_info; let content_prekey = key_info.content_prekey.ok_or(Error::MissingResponseData)?; 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 { prekey: notif_prekey_value, prekey_signature: notif_prekey_signature, } = notif_prekey; Ok(Self { payload, payload_signature, social_proof, content_prekey: content_prekey_value, content_prekey_signature, notif_prekey: notif_prekey_value, notif_prekey_signature, }) } } fn get_inbound_keys_for_user( auth_user_id: String, auth_device_id: String, auth_access_token: String, user_id: String, promise_id: u32, ) { RUNTIME.spawn(async move { let get_inbound_keys_request_info = GetInboundKeysRequestInfo { user_id }; let auth_info = AuthInfo { access_token: auth_access_token, user_id: auth_user_id, device_id: auth_device_id, }; let result = get_inbound_keys_for_user_helper( get_inbound_keys_request_info, auth_info, ) .await; handle_string_result_as_callback(result, promise_id); }); } async fn get_inbound_keys_for_user_helper( get_inbound_keys_request_info: GetInboundKeysRequestInfo, auth_info: AuthInfo, ) -> Result { let mut identity_client = get_auth_client( IDENTITY_SOCKET_ADDR, auth_info.user_id, auth_info.device_id, auth_info.access_token, CODE_VERSION, DEVICE_TYPE.as_str_name().to_lowercase(), ) .await?; let response = identity_client .get_inbound_keys_for_user(InboundKeysForUserRequest { user_id: get_inbound_keys_request_info.user_id, }) .await? .into_inner(); let inbound_key_info: Vec = response .devices .into_values() .map(InboundKeyInfoResponse::try_from) .collect::, _>>()?; Ok(serde_json::to_string(&inbound_key_info)?) } #[instrument] fn upload_one_time_keys( auth_user_id: String, auth_device_id: String, auth_access_token: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, promise_id: u32, ) { RUNTIME.spawn(async move { let upload_request = UploadOneTimeKeysRequest { 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, user_id: auth_user_id, device_id: auth_device_id, }; let result = upload_one_time_keys_helper(auth_info, upload_request).await; handle_void_result_as_callback(result, promise_id); }); } async fn upload_one_time_keys_helper( auth_info: AuthInfo, upload_request: UploadOneTimeKeysRequest, ) -> Result<(), Error> { let mut identity_client = get_auth_client( IDENTITY_SOCKET_ADDR, auth_info.user_id, auth_info.device_id, auth_info.access_token, CODE_VERSION, DEVICE_TYPE.as_str_name().to_lowercase(), ) .await?; identity_client.upload_one_time_keys(upload_request).await?; Ok(()) } #[derive( Debug, derive_more::Display, derive_more::From, derive_more::Error, )] pub enum Error { #[display(...)] TonicGRPC(Status), #[display(...)] SerdeJson(serde_json::Error), #[display(...)] MissingResponseData, GRPClient(grpc_clients::error::Error), } #[cfg(test)] mod tests { use super::{BACKUP_SOCKET_ADDR, CODE_VERSION, IDENTITY_SOCKET_ADDR}; #[test] fn test_code_version_exists() { assert!(CODE_VERSION > 0); } #[test] fn test_identity_socket_addr_exists() { assert!(IDENTITY_SOCKET_ADDR.len() > 0); assert!(BACKUP_SOCKET_ADDR.len() > 0); } } diff --git a/services/commtest/src/identity/device.rs b/services/commtest/src/identity/device.rs index 8fdb15094..556c37d7f 100644 --- a/services/commtest/src/identity/device.rs +++ b/services/commtest/src/identity/device.rs @@ -1,103 +1,103 @@ use comm_opaque2::client::Registration; use grpc_clients::identity::get_unauthenticated_client; use rand::{distributions::Alphanumeric, Rng}; use crate::identity::olm_account_infos::{ ClientPublicKeys, DEFAULT_CLIENT_KEYS, }; use crate::service_addr; -use grpc_clients::identity::protos::client::{ +use grpc_clients::identity::protos::unauth::{ DeviceKeyUpload, DeviceType, IdentityKeyInfo, Prekey, RegistrationFinishRequest, RegistrationStartRequest, }; pub const PLACEHOLDER_CODE_VERSION: u64 = 0; pub const DEVICE_TYPE: &str = "service"; pub struct DeviceInfo { pub username: String, pub user_id: String, pub device_id: String, pub access_token: String, } pub async fn create_device(keys: Option<&ClientPublicKeys>) -> DeviceInfo { let password = "pass"; let username: String = rand::thread_rng() .sample_iter(&Alphanumeric) .take(7) .map(char::from) .collect(); // TODO: Generate dynamic valid olm account info let keys = keys.unwrap_or_else(|| &DEFAULT_CLIENT_KEYS); let example_payload = serde_json::to_string(&keys).expect("Failed to serialize example payload"); // The ed25519 value from the olm payload let device_id = &keys.primary_identity_public_keys.ed25519; let mut client_registration = Registration::new(); let opaque_registration_request = client_registration.start(password).unwrap(); let registration_start_request = RegistrationStartRequest { opaque_registration_request, username: username.to_string(), device_key_upload: Some(DeviceKeyUpload { device_key_info: Some(IdentityKeyInfo { payload: example_payload.to_string(), payload_signature: "foo".to_string(), social_proof: None, }), content_upload: Some(Prekey { prekey: "content_prekey".to_string(), prekey_signature: "content_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(), device_type: DeviceType::Keyserver.into(), }), }; let mut identity_client = get_unauthenticated_client( &service_addr::IDENTITY_GRPC.to_string(), PLACEHOLDER_CODE_VERSION, DEVICE_TYPE.to_string(), ) .await .expect("Couldn't connect to identity service"); let registration_start_response = identity_client .register_password_user_start(registration_start_request) .await .unwrap() .into_inner(); let opaque_registration_upload = client_registration .finish( password, ®istration_start_response.opaque_registration_response, ) .unwrap(); let registration_finish_request = RegistrationFinishRequest { session_id: registration_start_response.session_id, opaque_registration_upload, }; let registration_finish_response = identity_client .register_password_user_finish(registration_finish_request) .await .unwrap() .into_inner(); DeviceInfo { username: username.to_string(), device_id: device_id.to_string(), user_id: registration_finish_response.user_id, access_token: registration_finish_response.access_token, } } diff --git a/services/commtest/tests/identity_access_tokens_tests.rs b/services/commtest/tests/identity_access_tokens_tests.rs index d0717bcf2..5de0d30c1 100644 --- a/services/commtest/tests/identity_access_tokens_tests.rs +++ b/services/commtest/tests/identity_access_tokens_tests.rs @@ -1,34 +1,34 @@ use commtest::identity::device::{ create_device, DEVICE_TYPE, PLACEHOLDER_CODE_VERSION, }; use commtest::service_addr; use grpc_clients::identity::{ - get_unauthenticated_client, protos::client::VerifyUserAccessTokenRequest, + get_unauthenticated_client, protos::unauth::VerifyUserAccessTokenRequest, }; #[tokio::test] async fn verify_access_token() { let identity_grpc_endpoint = service_addr::IDENTITY_GRPC.to_string(); let device_info = create_device(None).await; let mut identity_client = get_unauthenticated_client( &identity_grpc_endpoint, PLACEHOLDER_CODE_VERSION, DEVICE_TYPE.to_string(), ) .await .expect("Couldn't connect to identity service"); let verify_request = VerifyUserAccessTokenRequest { user_id: device_info.user_id, device_id: device_info.device_id, access_token: device_info.access_token, }; let response = identity_client .verify_user_access_token(verify_request) .await .unwrap(); assert!(response.into_inner().token_valid); } diff --git a/services/commtest/tests/identity_prekey_tests.rs b/services/commtest/tests/identity_prekey_tests.rs index 72a481ee0..f99382778 100644 --- a/services/commtest/tests/identity_prekey_tests.rs +++ b/services/commtest/tests/identity_prekey_tests.rs @@ -1,41 +1,41 @@ use commtest::identity::device::{ create_device, DEVICE_TYPE, PLACEHOLDER_CODE_VERSION, }; use commtest::service_addr; use grpc_clients::identity::{ get_auth_client, - protos::{authenticated::RefreshUserPrekeysRequest, client::Prekey}, + protos::{authenticated::RefreshUserPrekeysRequest, unauth::Prekey}, }; #[tokio::test] async fn set_prekey() { let device_info = create_device(None).await; let mut client = get_auth_client( &service_addr::IDENTITY_GRPC.to_string(), device_info.user_id, device_info.device_id, device_info.access_token, PLACEHOLDER_CODE_VERSION, DEVICE_TYPE.to_string(), ) .await .expect("Couldn't connect to identity service"); let upload_request = RefreshUserPrekeysRequest { new_content_prekeys: Some(Prekey { prekey: "content_prekey".to_string(), prekey_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_prekeys(upload_request).await ); } diff --git a/services/identity/build.rs b/services/identity/build.rs index 6ae421b24..4aabe65f4 100644 --- a/services/identity/build.rs +++ b/services/identity/build.rs @@ -1,13 +1,13 @@ fn main() -> Result<(), Box> { tonic_build::configure() .build_server(true) .build_client(false) .compile( &[ - "../../shared/protos/identity_client.proto", - "../../shared/protos/identity_authenticated.proto", + "../../shared/protos/identity_unauth.proto", + "../../shared/protos/identity_auth.proto", ], &["../../shared/protos/"], )?; Ok(()) } diff --git a/services/identity/src/client_service.rs b/services/identity/src/client_service.rs index 8b5d571b5..e8d319980 100644 --- a/services/identity/src/client_service.rs +++ b/services/identity/src/client_service.rs @@ -1,770 +1,770 @@ // Standard library imports use std::str::FromStr; // External crate imports use comm_lib::aws::DynamoDBError; use comm_opaque2::grpc::protocol_error_to_grpc_status; use moka::future::Cache; use rand::rngs::OsRng; use siwe::eip55; use tonic::Response; use tracing::{debug, error}; // Workspace crate imports use crate::config::CONFIG; use crate::database::{ DBDeviceTypeInt, DatabaseClient, DeviceType, KeyPayload, }; use crate::error::Error as DBError; use crate::grpc_services::protos::unauth::{ AddReservedUsernamesRequest, Empty, GenerateNonceResponse, OpaqueLoginFinishRequest, OpaqueLoginFinishResponse, OpaqueLoginStartRequest, OpaqueLoginStartResponse, RegistrationFinishRequest, RegistrationFinishResponse, RegistrationStartRequest, RegistrationStartResponse, RemoveReservedUsernameRequest, ReservedRegistrationStartRequest, ReservedWalletLoginRequest, VerifyUserAccessTokenRequest, VerifyUserAccessTokenResponse, WalletLoginRequest, WalletLoginResponse, }; use crate::grpc_utils::DeviceKeyUploadActions; use crate::id::generate_uuid; use crate::nonce::generate_nonce_data; use crate::reserved_users::{ validate_account_ownership_message_and_get_user_id, validate_add_reserved_usernames_message, validate_remove_reserved_username_message, }; use crate::siwe::{is_valid_ethereum_address, parse_and_verify_siwe_message}; use crate::token::{AccessTokenData, AuthType}; -pub use crate::grpc_services::protos::client::identity_client_service_server::{ +pub use crate::grpc_services::protos::unauth::identity_client_service_server::{ IdentityClientService, IdentityClientServiceServer, }; #[derive(Clone)] pub enum WorkflowInProgress { Registration(Box), Login(Box), Update(UpdateState), } #[derive(Clone)] pub struct UserRegistrationInfo { pub username: String, pub flattened_device_key_upload: FlattenedDeviceKeyUpload, pub user_id: Option, } #[derive(Clone)] pub struct UserLoginInfo { pub user_id: String, pub flattened_device_key_upload: FlattenedDeviceKeyUpload, pub opaque_server_login: comm_opaque2::server::Login, } #[derive(Clone)] pub struct UpdateState { pub user_id: String, } #[derive(Clone)] pub struct FlattenedDeviceKeyUpload { pub device_id_key: String, pub key_payload: String, pub key_payload_signature: String, pub content_prekey: String, pub content_prekey_signature: String, pub content_one_time_keys: Vec, pub notif_prekey: String, pub notif_prekey_signature: String, pub notif_one_time_keys: Vec, pub device_type: DeviceType, } #[derive(derive_more::Constructor)] pub struct ClientService { client: DatabaseClient, cache: Cache, } #[tonic::async_trait] impl IdentityClientService for ClientService { async fn register_password_user_start( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); debug!("Received registration request for: {}", message.username); self.check_username_taken(&message.username).await?; let username_in_reserved_usernames_table = self .client .username_in_reserved_usernames_table(&message.username) .await .map_err(handle_db_error)?; if username_in_reserved_usernames_table { return Err(tonic::Status::already_exists("username already exists")); } if CONFIG.reserved_usernames.contains(&message.username) || is_valid_ethereum_address(&message.username) { return Err(tonic::Status::invalid_argument("username reserved")); } let registration_state = construct_user_registration_info( &message, None, message.username.clone(), )?; let server_registration = comm_opaque2::server::Registration::new(); let server_message = server_registration .start( &CONFIG.server_setup, &message.opaque_registration_request, message.username.as_bytes(), ) .map_err(protocol_error_to_grpc_status)?; let session_id = self .cache .insert_with_uuid_key(WorkflowInProgress::Registration(Box::new( registration_state, ))) .await; let response = RegistrationStartResponse { session_id, opaque_registration_response: server_message, }; Ok(Response::new(response)) } async fn register_reserved_password_user_start( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); self.check_username_taken(&message.username).await?; if CONFIG.reserved_usernames.contains(&message.username) { return Err(tonic::Status::invalid_argument("username reserved")); } let username_in_reserved_usernames_table = self .client .username_in_reserved_usernames_table(&message.username) .await .map_err(handle_db_error)?; if !username_in_reserved_usernames_table { return Err(tonic::Status::permission_denied("username not reserved")); } let user_id = validate_account_ownership_message_and_get_user_id( &message.username, &message.keyserver_message, &message.keyserver_signature, )?; let registration_state = construct_user_registration_info( &message, Some(user_id), message.username.clone(), )?; let server_registration = comm_opaque2::server::Registration::new(); let server_message = server_registration .start( &CONFIG.server_setup, &message.opaque_registration_request, message.username.as_bytes(), ) .map_err(protocol_error_to_grpc_status)?; let session_id = self .cache .insert_with_uuid_key(WorkflowInProgress::Registration(Box::new( registration_state, ))) .await; let response = RegistrationStartResponse { session_id, opaque_registration_response: server_message, }; Ok(Response::new(response)) } async fn register_password_user_finish( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); if let Some(WorkflowInProgress::Registration(state)) = self.cache.get(&message.session_id) { self.cache.invalidate(&message.session_id).await; let server_registration = comm_opaque2::server::Registration::new(); let password_file = server_registration .finish(&message.opaque_registration_upload) .map_err(protocol_error_to_grpc_status)?; let device_id = state.flattened_device_key_upload.device_id_key.clone(); let user_id = self .client .add_password_user_to_users_table(*state, password_file) .await .map_err(handle_db_error)?; // Create access token let token = AccessTokenData::new( user_id.clone(), device_id, crate::token::AuthType::Password, &mut OsRng, ); let access_token = token.access_token.clone(); self .client .put_access_token_data(token) .await .map_err(handle_db_error)?; let response = RegistrationFinishResponse { user_id, access_token, }; Ok(Response::new(response)) } else { Err(tonic::Status::not_found("session not found")) } } async fn log_in_password_user_start( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); debug!("Attempting to login user: {:?}", &message.username); let user_id_and_password_file = self .client .get_user_id_and_password_file_from_username(&message.username) .await .map_err(handle_db_error)?; let (user_id, password_file_bytes) = if let Some(data) = user_id_and_password_file { data } else { // It's possible that the user attempting login is already registered // on Ashoat's keyserver. If they are, we should send back a gRPC status // code instructing them to get a signed message from Ashoat's keyserver // in order to claim their username and register with the Identity // service. let username_in_reserved_usernames_table = self .client .username_in_reserved_usernames_table(&message.username) .await .map_err(handle_db_error)?; if username_in_reserved_usernames_table { return Err(tonic::Status::failed_precondition( "need keyserver message to claim username", )); } return Err(tonic::Status::not_found("user not found")); }; let mut server_login = comm_opaque2::server::Login::new(); let server_response = server_login .start( &CONFIG.server_setup, &password_file_bytes, &message.opaque_login_request, message.username.as_bytes(), ) .map_err(protocol_error_to_grpc_status)?; let login_state = construct_user_login_info(&message, user_id, server_login)?; let session_id = self .cache .insert_with_uuid_key(WorkflowInProgress::Login(Box::new(login_state))) .await; let response = Response::new(OpaqueLoginStartResponse { session_id, opaque_login_response: server_response, }); Ok(response) } async fn log_in_password_user_finish( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); if let Some(WorkflowInProgress::Login(state)) = self.cache.get(&message.session_id) { self.cache.invalidate(&message.session_id).await; let mut server_login = state.opaque_server_login.clone(); server_login .finish(&message.opaque_login_upload) .map_err(protocol_error_to_grpc_status)?; self .client .add_password_user_device_to_users_table( state.user_id.clone(), state.flattened_device_key_upload.clone(), ) .await .map_err(handle_db_error)?; // Create access token let token = AccessTokenData::new( state.user_id.clone(), state.flattened_device_key_upload.device_id_key, crate::token::AuthType::Password, &mut OsRng, ); let access_token = token.access_token.clone(); self .client .put_access_token_data(token) .await .map_err(handle_db_error)?; let response = OpaqueLoginFinishResponse { user_id: state.user_id, access_token, }; Ok(Response::new(response)) } else { Err(tonic::Status::not_found("session not found")) } } async fn log_in_wallet_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let parsed_message = parse_and_verify_siwe_message( &message.siwe_message, &message.siwe_signature, )?; match self .client .get_nonce_from_nonces_table(&parsed_message.nonce) .await .map_err(handle_db_error)? { None => return Err(tonic::Status::invalid_argument("invalid nonce")), Some(_) => self .client .remove_nonce_from_nonces_table(&parsed_message.nonce) .await .map_err(handle_db_error)?, }; let wallet_address = eip55(&parsed_message.address); let flattened_device_key_upload = construct_flattened_device_key_upload(&message)?; let social_proof = message .social_proof()? .ok_or_else(|| tonic::Status::invalid_argument("malformed payload"))?; let user_id = match self .client .get_user_id_from_user_info(wallet_address.clone(), &AuthType::Wallet) .await .map_err(handle_db_error)? { Some(id) => { // User already exists, so we should update the DDB item self .client .add_wallet_user_device_to_users_table( id.clone(), flattened_device_key_upload.clone(), social_proof, ) .await .map_err(handle_db_error)?; id } None => { // It's possible that the user attempting login is already registered // on Ashoat's keyserver. If they are, we should send back a gRPC status // code instructing them to get a signed message from Ashoat's keyserver // in order to claim their wallet address and register with the Identity // service. let username_in_reserved_usernames_table = self .client .username_in_reserved_usernames_table(&wallet_address) .await .map_err(handle_db_error)?; if username_in_reserved_usernames_table { return Err(tonic::Status::failed_precondition( "need keyserver message to claim username", )); } // User doesn't exist yet and wallet address isn't reserved, so we // should add a new user in DDB self .client .add_wallet_user_to_users_table( flattened_device_key_upload.clone(), wallet_address, social_proof, None, ) .await .map_err(handle_db_error)? } }; // Create access token let token = AccessTokenData::new( user_id.clone(), flattened_device_key_upload.device_id_key, crate::token::AuthType::Password, &mut OsRng, ); let access_token = token.access_token.clone(); self .client .put_access_token_data(token) .await .map_err(handle_db_error)?; let response = WalletLoginResponse { user_id, access_token, }; Ok(Response::new(response)) } async fn log_in_reserved_wallet_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let parsed_message = parse_and_verify_siwe_message( &message.siwe_message, &message.siwe_signature, )?; match self .client .get_nonce_from_nonces_table(&parsed_message.nonce) .await .map_err(handle_db_error)? { None => return Err(tonic::Status::invalid_argument("invalid nonce")), Some(_) => self .client .remove_nonce_from_nonces_table(&parsed_message.nonce) .await .map_err(handle_db_error)?, }; let wallet_address = eip55(&parsed_message.address); self.check_wallet_address_taken(&wallet_address).await?; let wallet_address_in_reserved_usernames_table = self .client .username_in_reserved_usernames_table(&wallet_address) .await .map_err(handle_db_error)?; if !wallet_address_in_reserved_usernames_table { return Err(tonic::Status::permission_denied( "wallet address not reserved", )); } let user_id = validate_account_ownership_message_and_get_user_id( &wallet_address, &message.keyserver_message, &message.keyserver_signature, )?; let flattened_device_key_upload = construct_flattened_device_key_upload(&message)?; let social_proof = message .social_proof()? .ok_or_else(|| tonic::Status::invalid_argument("malformed payload"))?; self .client .add_wallet_user_to_users_table( flattened_device_key_upload.clone(), wallet_address, social_proof, Some(user_id.clone()), ) .await .map_err(handle_db_error)?; let token = AccessTokenData::new( user_id.clone(), flattened_device_key_upload.device_id_key, crate::token::AuthType::Password, &mut OsRng, ); let access_token = token.access_token.clone(); self .client .put_access_token_data(token) .await .map_err(handle_db_error)?; let response = WalletLoginResponse { user_id, access_token, }; Ok(Response::new(response)) } async fn generate_nonce( &self, _request: tonic::Request, ) -> Result, tonic::Status> { let nonce_data = generate_nonce_data(&mut OsRng); match self .client .add_nonce_to_nonces_table(nonce_data.clone()) .await { Ok(_) => Ok(Response::new(GenerateNonceResponse { nonce: nonce_data.nonce, })), Err(e) => Err(handle_db_error(e)), } } async fn verify_user_access_token( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); debug!("Verifying device: {}", &message.device_id); let token_valid = self .client .verify_access_token( message.user_id, message.device_id.clone(), message.access_token, ) .await .map_err(handle_db_error)?; let response = Response::new(VerifyUserAccessTokenResponse { token_valid }); debug!( "device {} was verified: {}", &message.device_id, token_valid ); Ok(response) } async fn add_reserved_usernames( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let usernames = validate_add_reserved_usernames_message( &message.message, &message.signature, )?; let filtered_usernames = self .client .filter_out_taken_usernames(usernames) .await .map_err(handle_db_error)?; self .client .add_usernames_to_reserved_usernames_table(filtered_usernames) .await .map_err(handle_db_error)?; let response = Response::new(Empty {}); Ok(response) } async fn remove_reserved_username( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let username = validate_remove_reserved_username_message( &message.message, &message.signature, )?; self .client .delete_username_from_reserved_usernames_table(username) .await .map_err(handle_db_error)?; let response = Response::new(Empty {}); Ok(response) } async fn ping( &self, _request: tonic::Request, ) -> Result, tonic::Status> { let response = Response::new(Empty {}); Ok(response) } } impl ClientService { async fn check_username_taken( &self, username: &str, ) -> Result<(), tonic::Status> { let username_taken = self .client .username_taken(username.to_string()) .await .map_err(handle_db_error)?; if username_taken { return Err(tonic::Status::already_exists("username already exists")); } Ok(()) } async fn check_wallet_address_taken( &self, wallet_address: &str, ) -> Result<(), tonic::Status> { let wallet_address_taken = self .client .wallet_address_taken(wallet_address.to_string()) .await .map_err(handle_db_error)?; if wallet_address_taken { return Err(tonic::Status::already_exists( "wallet address already exists", )); } Ok(()) } } #[tonic::async_trait] pub trait CacheExt { async fn insert_with_uuid_key(&self, value: T) -> String; } #[tonic::async_trait] impl CacheExt for Cache where T: Clone + Send + Sync + 'static, { async fn insert_with_uuid_key(&self, value: T) -> String { let session_id = generate_uuid(); self.insert(session_id.clone(), value).await; session_id } } pub fn handle_db_error(db_error: DBError) -> tonic::Status { match db_error { DBError::AwsSdk(DynamoDBError::InternalServerError(_)) | DBError::AwsSdk(DynamoDBError::ProvisionedThroughputExceededException( _, )) | DBError::AwsSdk(DynamoDBError::RequestLimitExceeded(_)) => { tonic::Status::unavailable("please retry") } e => { error!("Encountered an unexpected error: {}", e); tonic::Status::failed_precondition("unexpected error") } } } fn construct_user_registration_info( message: &impl DeviceKeyUploadActions, user_id: Option, username: String, ) -> Result { Ok(UserRegistrationInfo { username, flattened_device_key_upload: construct_flattened_device_key_upload( message, )?, user_id, }) } fn construct_user_login_info( message: &impl DeviceKeyUploadActions, user_id: String, opaque_server_login: comm_opaque2::server::Login, ) -> Result { Ok(UserLoginInfo { user_id, flattened_device_key_upload: construct_flattened_device_key_upload( message, )?, opaque_server_login, }) } fn construct_flattened_device_key_upload( message: &impl DeviceKeyUploadActions, ) -> Result { let key_info = KeyPayload::from_str(&message.payload()?) .map_err(|_| tonic::Status::invalid_argument("malformed payload"))?; let flattened_device_key_upload = FlattenedDeviceKeyUpload { device_id_key: key_info.primary_identity_public_keys.ed25519, key_payload: message.payload()?, key_payload_signature: message.payload_signature()?, content_prekey: message.content_prekey()?, content_prekey_signature: message.content_prekey_signature()?, content_one_time_keys: message.one_time_content_prekeys()?, notif_prekey: message.notif_prekey()?, notif_prekey_signature: message.notif_prekey_signature()?, notif_one_time_keys: message.one_time_notif_prekeys()?, device_type: DeviceType::try_from(DBDeviceTypeInt(message.device_type()?)) .map_err(handle_db_error)?, }; Ok(flattened_device_key_upload) } diff --git a/services/identity/src/constants.rs b/services/identity/src/constants.rs index c93c66d7d..3ecb9e911 100644 --- a/services/identity/src/constants.rs +++ b/services/identity/src/constants.rs @@ -1,216 +1,216 @@ // Secrets pub const SECRETS_DIRECTORY: &str = "secrets"; pub const SECRETS_SETUP_FILE: &str = "server_setup.txt"; // DynamoDB // User table information, supporting opaque_ke 2.0 and X3DH information // Users can sign in either through username+password or Eth wallet. // // This structure should be aligned with the messages defined in -// shared/protos/identity_client.proto +// shared/protos/identity_unauthenticated.proto // // Structure for a user should be: // { // userID: String, // opaqueRegistrationData: Option, // username: Option, // walletAddress: Option, // devices: HashMap // } // // A device is defined as: // { // deviceType: String, # client or keyserver // keyPayload: String, // keyPayloadSignature: String, // identityPreKey: String, // identityPreKeySignature: String, // identityOneTimeKeys: Vec, // notifPreKey: String, // notifPreKeySignature: String, // notifOneTimeKeys: Vec, // socialProof: Option // } // } // // Additional context: // "devices" uses the signing public identity key of the device as a key for the devices map // "keyPayload" is a JSON encoded string containing identity and notif keys (both signature and verification) // if "deviceType" == "keyserver", then the device will not have any notif key information pub const USERS_TABLE: &str = "identity-users"; pub const USERS_TABLE_PARTITION_KEY: &str = "userID"; pub const USERS_TABLE_REGISTRATION_ATTRIBUTE: &str = "opaqueRegistrationData"; pub const USERS_TABLE_USERNAME_ATTRIBUTE: &str = "username"; pub const USERS_TABLE_DEVICES_ATTRIBUTE: &str = "devices"; pub const USERS_TABLE_DEVICES_MAP_DEVICE_TYPE_ATTRIBUTE_NAME: &str = "deviceType"; pub const USERS_TABLE_DEVICES_MAP_KEY_PAYLOAD_ATTRIBUTE_NAME: &str = "keyPayload"; pub const USERS_TABLE_DEVICES_MAP_KEY_PAYLOAD_SIGNATURE_ATTRIBUTE_NAME: &str = "keyPayloadSignature"; pub const USERS_TABLE_DEVICES_MAP_CONTENT_PREKEY_ATTRIBUTE_NAME: &str = "identityPreKey"; pub const USERS_TABLE_DEVICES_MAP_CONTENT_PREKEY_SIGNATURE_ATTRIBUTE_NAME: &str = "identityPreKeySignature"; 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_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 = "socialProof"; pub const USERS_TABLE_DEVICELIST_TIMESTAMP_ATTRIBUTE_NAME: &str = "deviceListTimestamp"; pub const USERS_TABLE_USERNAME_INDEX: &str = "username-index"; pub const USERS_TABLE_WALLET_ADDRESS_INDEX: &str = "walletAddress-index"; pub const ACCESS_TOKEN_TABLE: &str = "identity-tokens"; pub const ACCESS_TOKEN_TABLE_PARTITION_KEY: &str = "userID"; pub const ACCESS_TOKEN_SORT_KEY: &str = "signingPublicKey"; pub const ACCESS_TOKEN_TABLE_CREATED_ATTRIBUTE: &str = "created"; pub const ACCESS_TOKEN_TABLE_AUTH_TYPE_ATTRIBUTE: &str = "authType"; pub const ACCESS_TOKEN_TABLE_VALID_ATTRIBUTE: &str = "valid"; pub const ACCESS_TOKEN_TABLE_TOKEN_ATTRIBUTE: &str = "token"; pub const NONCE_TABLE: &str = "identity-nonces"; pub const NONCE_TABLE_PARTITION_KEY: &str = "nonce"; pub const NONCE_TABLE_CREATED_ATTRIBUTE: &str = "created"; pub const NONCE_TABLE_EXPIRATION_TIME_ATTRIBUTE: &str = "expirationTime"; pub const NONCE_TABLE_EXPIRATION_TIME_UNIX_ATTRIBUTE: &str = "expirationTimeUnix"; // Usernames reserved because they exist in Ashoat's keyserver already pub const RESERVED_USERNAMES_TABLE: &str = "identity-reserved-usernames"; pub const RESERVED_USERNAMES_TABLE_PARTITION_KEY: &str = "username"; pub mod devices_table { /// table name pub const NAME: &str = "identity-devices"; pub const TIMESTAMP_INDEX_NAME: &str = "deviceList-timestamp-index"; /// partition key pub const ATTR_USER_ID: &str = "userID"; /// sort key pub const ATTR_ITEM_ID: &str = "itemID"; // itemID prefixes (one shouldn't be a prefix of the other) pub const DEVICE_ITEM_KEY_PREFIX: &str = "device-"; pub const DEVICE_LIST_KEY_PREFIX: &str = "devicelist-"; // device-specific attrs pub const ATTR_DEVICE_TYPE: &str = "deviceType"; pub const ATTR_DEVICE_KEY_INFO: &str = "deviceKeyInfo"; pub const ATTR_CONTENT_PREKEY: &str = "contentPreKey"; pub const ATTR_NOTIF_PREKEY: &str = "notifPreKey"; // IdentityKeyInfo constants pub const ATTR_KEY_PAYLOAD: &str = "keyPayload"; pub const ATTR_KEY_PAYLOAD_SIGNATURE: &str = "keyPayloadSignature"; pub const ATTR_SOCIAL_PROOF: &str = "socialProof"; // PreKey constants pub const ATTR_PREKEY: &str = "preKey"; pub const ATTR_PREKEY_SIGNATURE: &str = "preKeySignature"; // device-list-specific attrs pub const ATTR_TIMESTAMP: &str = "timestamp"; pub const ATTR_DEVICE_IDS: &str = "deviceIDs"; } // One time keys table, which need to exist in their own table to ensure // atomicity of additions and removals pub mod one_time_keys_table { // The `PARTITION_KEY` will contain "notification_${deviceID}" or // "content_${deviceID}" to allow for both key sets to coexist in the same table pub const NAME: &str = "identity-one-time-keys"; pub const PARTITION_KEY: &str = "deviceID"; pub const DEVICE_ID: &str = PARTITION_KEY; pub const SORT_KEY: &str = "oneTimeKey"; pub const ONE_TIME_KEY: &str = SORT_KEY; } // One-time key constants for device info map pub const CONTENT_ONE_TIME_KEY: &str = "contentOneTimeKey"; pub const NOTIF_ONE_TIME_KEY: &str = "notifOneTimeKey"; // Tokio pub const MPSC_CHANNEL_BUFFER_CAPACITY: usize = 1; pub const IDENTITY_SERVICE_SOCKET_ADDR: &str = "[::]:50054"; // Token pub const ACCESS_TOKEN_LENGTH: usize = 512; // Temporary config pub const AUTH_TOKEN: &str = "COMM_IDENTITY_SERVICE_AUTH_TOKEN"; pub const KEYSERVER_PUBLIC_KEY: &str = "KEYSERVER_PUBLIC_KEY"; // Nonce pub const NONCE_LENGTH: usize = 17; pub const NONCE_TTL_DURATION: i64 = 30; // LocalStack pub const LOCALSTACK_ENDPOINT: &str = "LOCALSTACK_ENDPOINT"; // OPAQUE Server Setup pub const OPAQUE_SERVER_SETUP: &str = "OPAQUE_SERVER_SETUP"; // Tunnelbroker pub const TUNNELBROKER_GRPC_ENDPOINT: &str = "TUNNELBROKER_GRPC_ENDPOINT"; pub const DEFAULT_TUNNELBROKER_ENDPOINT: &str = "http://localhost:50051"; // X3DH key management // 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 ONE_TIME_KEY_REFRESH_NUMBER: u32 = 5; // Minimum supported code versions pub const MIN_SUPPORTED_NATIVE_VERSION: u64 = 270; // Request metadata pub mod request_metadata { pub const CODE_VERSION: &str = "code_version"; pub const DEVICE_TYPE: &str = "device_type"; pub const USER_ID: &str = "user_id"; pub const DEVICE_ID: &str = "device_id"; pub const ACCESS_TOKEN: &str = "access_token"; } // CORS pub mod cors { use std::time::Duration; pub const DEFAULT_MAX_AGE: Duration = Duration::from_secs(24 * 60 * 60); pub const DEFAULT_EXPOSED_HEADERS: [&str; 3] = ["grpc-status", "grpc-message", "grpc-status-details-bin"]; pub const DEFAULT_ALLOW_HEADERS: [&str; 9] = [ "x-grpc-web", "content-type", "x-user-agent", "grpc-timeout", super::request_metadata::CODE_VERSION, super::request_metadata::DEVICE_TYPE, super::request_metadata::USER_ID, super::request_metadata::DEVICE_ID, super::request_metadata::ACCESS_TOKEN, ]; pub const DEFAULT_ALLOW_ORIGIN: [&str; 2] = ["https://web.comm.app", "http://localhost:3000"]; } diff --git a/services/identity/src/grpc_services/authenticated.rs b/services/identity/src/grpc_services/authenticated.rs index 395433428..bf6565ddf 100644 --- a/services/identity/src/grpc_services/authenticated.rs +++ b/services/identity/src/grpc_services/authenticated.rs @@ -1,508 +1,508 @@ use std::collections::HashMap; use crate::config::CONFIG; use crate::database::DeviceListRow; use crate::grpc_utils::DeviceInfoWithAuth; use crate::{ client_service::{ handle_db_error, CacheExt, UpdateState, WorkflowInProgress, }, constants::request_metadata, database::DatabaseClient, ddb_utils::DateTimeExt, grpc_services::shared::get_value, token::AuthType, }; use chrono::{DateTime, Utc}; use comm_opaque2::grpc::protocol_error_to_grpc_status; use moka::future::Cache; use tonic::{Request, Response, Status}; use tracing::{debug, error}; use super::protos::auth::{ find_user_id_request, identity_client_service_server::IdentityClientService, FindUserIdRequest, FindUserIdResponse, GetDeviceListRequest, GetDeviceListResponse, InboundKeyInfo, InboundKeysForUserRequest, InboundKeysForUserResponse, KeyserverKeysResponse, OutboundKeyInfo, OutboundKeysForUserRequest, OutboundKeysForUserResponse, RefreshUserPrekeysRequest, UpdateUserPasswordFinishRequest, UpdateUserPasswordStartRequest, UpdateUserPasswordStartResponse, UploadOneTimeKeysRequest, }; -use super::protos::client::{Empty, IdentityKeyInfo, Prekey}; +use super::protos::unauth::{Empty, IdentityKeyInfo, Prekey}; #[derive(derive_more::Constructor)] pub struct AuthenticatedService { db_client: DatabaseClient, cache: Cache, } fn get_auth_info(req: &Request<()>) -> Option<(String, String, String)> { debug!("Retrieving auth info for request: {:?}", req); let user_id = get_value(req, request_metadata::USER_ID)?; let device_id = get_value(req, request_metadata::DEVICE_ID)?; let access_token = get_value(req, request_metadata::ACCESS_TOKEN)?; Some((user_id, device_id, access_token)) } pub fn auth_interceptor( req: Request<()>, db_client: &DatabaseClient, ) -> Result, Status> { debug!("Intercepting request to check auth info: {:?}", req); let (user_id, device_id, access_token) = get_auth_info(&req) .ok_or_else(|| Status::unauthenticated("Missing credentials"))?; let handle = tokio::runtime::Handle::current(); let new_db_client = db_client.clone(); // This function cannot be `async`, yet must call the async db call // Force tokio to resolve future in current thread without an explicit .await let valid_token = tokio::task::block_in_place(move || { handle .block_on(new_db_client.verify_access_token( user_id, device_id, access_token, )) .map_err(handle_db_error) })?; if !valid_token { return Err(Status::aborted("Bad Credentials")); } Ok(req) } pub fn get_user_and_device_id( request: &Request, ) -> Result<(String, String), Status> { let user_id = get_value(request, request_metadata::USER_ID) .ok_or_else(|| Status::unauthenticated("Missing user_id field"))?; let device_id = get_value(request, request_metadata::DEVICE_ID) .ok_or_else(|| Status::unauthenticated("Missing device_id field"))?; Ok((user_id, device_id)) } #[tonic::async_trait] impl IdentityClientService for AuthenticatedService { async fn refresh_user_prekeys( &self, request: Request, ) -> Result, Status> { let (user_id, device_id) = get_user_and_device_id(&request)?; let message = request.into_inner(); debug!("Refreshing prekeys for user: {}", user_id); let content_keys = message .new_content_prekeys .ok_or_else(|| Status::invalid_argument("Missing content keys"))?; let notif_keys = message .new_notif_prekeys .ok_or_else(|| Status::invalid_argument("Missing notification keys"))?; self .db_client .set_prekey( user_id, device_id, content_keys.prekey, content_keys.prekey_signature, notif_keys.prekey, notif_keys.prekey_signature, ) .await .map_err(handle_db_error)?; let response = Response::new(Empty {}); Ok(response) } async fn get_outbound_keys_for_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let devices_map = self .db_client .get_keys_for_user_id(&message.user_id, true) .await .map_err(handle_db_error)? .ok_or_else(|| tonic::Status::not_found("user not found"))?; let transformed_devices = devices_map .into_iter() .filter_map(|(key, device_info)| { let device_info_with_auth = DeviceInfoWithAuth { device_info, auth_type: None, }; match OutboundKeyInfo::try_from(device_info_with_auth) { Ok(key_info) => Some((key, key_info)), Err(_) => { error!("Failed to transform device info for key {}", key); None } } }) .collect::>(); Ok(tonic::Response::new(OutboundKeysForUserResponse { devices: transformed_devices, })) } async fn get_inbound_keys_for_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let devices_map = self .db_client .get_keys_for_user_id(&message.user_id, false) .await .map_err(handle_db_error)? .ok_or_else(|| tonic::Status::not_found("user not found"))?; let transformed_devices = devices_map .into_iter() .filter_map(|(key, device_info)| { let device_info_with_auth = DeviceInfoWithAuth { device_info, auth_type: None, }; match InboundKeyInfo::try_from(device_info_with_auth) { Ok(key_info) => Some((key, key_info)), Err(_) => { error!("Failed to transform device info for key {}", key); None } } }) .collect::>(); Ok(tonic::Response::new(InboundKeysForUserResponse { devices: transformed_devices, })) } async fn get_keyserver_keys( &self, request: Request, ) -> Result, Status> { let message = request.into_inner(); let inner_response = self .db_client .get_keyserver_keys_for_user(&message.user_id) .await .map_err(handle_db_error)? .map(|db_keys| OutboundKeyInfo { identity_info: Some(IdentityKeyInfo { payload: db_keys.key_payload, payload_signature: db_keys.key_payload_signature, social_proof: db_keys.social_proof, }), content_prekey: Some(Prekey { prekey: db_keys.content_prekey.prekey, prekey_signature: db_keys.content_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, }); let response = Response::new(KeyserverKeysResponse { keyserver_info: inner_response, }); return Ok(response); } async fn upload_one_time_keys( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, device_id) = get_user_and_device_id(&request)?; let message = request.into_inner(); debug!("Attempting to update one time keys for user: {}", user_id); self .db_client .append_one_time_prekeys( device_id, message.content_one_time_prekeys, message.notif_one_time_prekeys, ) .await .map_err(handle_db_error)?; Ok(tonic::Response::new(Empty {})) } async fn find_user_id( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); use find_user_id_request::Identifier; let (user_ident, auth_type) = match message.identifier { None => { return Err(tonic::Status::invalid_argument("no identifier provided")) } Some(Identifier::Username(username)) => (username, AuthType::Password), Some(Identifier::WalletAddress(address)) => (address, AuthType::Wallet), }; let (is_reserved_result, user_id_result) = tokio::join!( self .db_client .username_in_reserved_usernames_table(&user_ident), self .db_client .get_user_id_from_user_info(user_ident.clone(), &auth_type), ); let is_reserved = is_reserved_result.map_err(handle_db_error)?; let user_id = user_id_result.map_err(handle_db_error)?; Ok(Response::new(FindUserIdResponse { user_id, is_reserved, })) } async fn update_user_password_start( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, _) = get_user_and_device_id(&request)?; let message = request.into_inner(); let server_registration = comm_opaque2::server::Registration::new(); let server_message = server_registration .start( &CONFIG.server_setup, &message.opaque_registration_request, user_id.as_bytes(), ) .map_err(protocol_error_to_grpc_status)?; let update_state = UpdateState { user_id }; let session_id = self .cache .insert_with_uuid_key(WorkflowInProgress::Update(update_state)) .await; let response = UpdateUserPasswordStartResponse { session_id, opaque_registration_response: server_message, }; Ok(Response::new(response)) } async fn update_user_password_finish( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let Some(WorkflowInProgress::Update(state)) = self.cache.get(&message.session_id) else { return Err(tonic::Status::not_found("session not found")); }; self.cache.invalidate(&message.session_id).await; let server_registration = comm_opaque2::server::Registration::new(); let password_file = server_registration .finish(&message.opaque_registration_upload) .map_err(protocol_error_to_grpc_status)?; self .db_client .update_user_password(state.user_id, password_file) .await .map_err(handle_db_error)?; let response = Empty {}; Ok(Response::new(response)) } async fn log_out_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, device_id) = get_user_and_device_id(&request)?; self .db_client .remove_device_from_users_table(user_id.clone(), device_id.clone()) .await .map_err(handle_db_error)?; self .db_client .delete_access_token_data(user_id, device_id) .await .map_err(handle_db_error)?; let response = Empty {}; Ok(Response::new(response)) } async fn delete_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, _) = get_user_and_device_id(&request)?; self .db_client .delete_user(user_id) .await .map_err(handle_db_error)?; let response = Empty {}; Ok(Response::new(response)) } async fn get_device_list_for_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let GetDeviceListRequest { user_id, since_timestamp, } = request.into_inner(); let since = since_timestamp .map(|timestamp| { DateTime::::from_utc_timestamp_millis(timestamp) .ok_or_else(|| tonic::Status::invalid_argument("Invalid timestamp")) }) .transpose()?; let mut db_result = self .db_client .get_device_list_history(user_id, since) .await .map_err(handle_db_error)?; // these should be sorted already, but just in case db_result.sort_by_key(|list| list.timestamp); let device_list_updates: Vec = db_result .into_iter() .map(RawDeviceList::from) .map(SignedDeviceList::try_from_raw) .collect::, _>>()?; let stringified_updates = device_list_updates .iter() .map(serde_json::to_string) .collect::, _>>() .map_err(|err| { error!("Failed to serialize device list updates: {}", err); tonic::Status::failed_precondition("unexpected error") })?; Ok(Response::new(GetDeviceListResponse { device_list_updates: stringified_updates, })) } } // raw device list that can be serialized to JSON (and then signed in the future) #[derive(serde::Serialize)] struct RawDeviceList { devices: Vec, timestamp: i64, } impl From for RawDeviceList { fn from(row: DeviceListRow) -> Self { Self { devices: row.device_ids, timestamp: row.timestamp.timestamp_millis(), } } } #[derive(serde::Serialize)] #[serde(rename_all = "camelCase")] struct SignedDeviceList { /// JSON-stringified [`RawDeviceList`] raw_device_list: String, } impl SignedDeviceList { /// Serialize (and sign in the future) a [`RawDeviceList`] fn try_from_raw(raw: RawDeviceList) -> Result { let stringified_list = serde_json::to_string(&raw).map_err(|err| { error!("Failed to serialize raw device list: {}", err); tonic::Status::failed_precondition("unexpected error") })?; Ok(Self { raw_device_list: stringified_list, }) } } #[cfg(test)] mod tests { use super::*; #[test] fn serialize_device_list_updates() { let raw_updates = vec![ RawDeviceList { devices: vec!["device1".into()], timestamp: 111111111, }, RawDeviceList { devices: vec!["device1".into(), "device2".into()], timestamp: 222222222, }, ]; let expected_raw_list1 = r#"{"devices":["device1"],"timestamp":111111111}"#; let expected_raw_list2 = r#"{"devices":["device1","device2"],"timestamp":222222222}"#; let signed_updates = raw_updates .into_iter() .map(SignedDeviceList::try_from_raw) .collect::, _>>() .expect("signing device list updates failed"); assert_eq!(signed_updates[0].raw_device_list, expected_raw_list1); assert_eq!(signed_updates[1].raw_device_list, expected_raw_list2); let stringified_updates = signed_updates .iter() .map(serde_json::to_string) .collect::, _>>() .expect("serialize signed device lists failed"); let expected_stringified_list1 = r#"{"rawDeviceList":"{\"devices\":[\"device1\"],\"timestamp\":111111111}"}"#; let expected_stringified_list2 = r#"{"rawDeviceList":"{\"devices\":[\"device1\",\"device2\"],\"timestamp\":222222222}"}"#; assert_eq!(stringified_updates[0], expected_stringified_list1); assert_eq!(stringified_updates[1], expected_stringified_list2); } } diff --git a/services/identity/src/grpc_services/mod.rs b/services/identity/src/grpc_services/mod.rs index 3c31cbfb9..44e341f10 100644 --- a/services/identity/src/grpc_services/mod.rs +++ b/services/identity/src/grpc_services/mod.rs @@ -1,16 +1,11 @@ pub mod authenticated; pub mod shared; pub mod protos { pub mod unauth { - tonic::include_proto!("identity.client"); + tonic::include_proto!("identity.unauth"); } pub mod auth { - tonic::include_proto!("identity.authenticated"); + tonic::include_proto!("identity.auth"); } - - // This must be named client, because generated code from the authenticated - // protobuf file references message structs from the client protobuf file - // with the client:: namespace - pub use self::unauth as client; } diff --git a/shared/grpc_clients/build.rs b/shared/grpc_clients/build.rs index ccd4134d2..ecf39bd58 100644 --- a/shared/grpc_clients/build.rs +++ b/shared/grpc_clients/build.rs @@ -1,17 +1,17 @@ fn main() { tonic_build::configure() .build_server(false) .compile( &[ - "../protos/identity_client.proto", - "../protos/identity_authenticated.proto", + "../protos/identity_unauth.proto", + "../protos/identity_auth.proto", "../protos/tunnelbroker.proto", ], &["../protos"], ) .unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e)); - println!("cargo:rerun-if-changed=../protos/identity_client.proto"); - println!("cargo:rerun-if-changed=../protos/identity_authenticated.proto"); + println!("cargo:rerun-if-changed=../protos/identity_unauth.proto"); + println!("cargo:rerun-if-changed=../protos/identity_auth.proto"); println!("cargo:rerun-if-changed=../protos/tunnelbroker.proto"); } diff --git a/shared/grpc_clients/src/identity/device.rs b/shared/grpc_clients/src/identity/device.rs index 01497f22f..925345027 100644 --- a/shared/grpc_clients/src/identity/device.rs +++ b/shared/grpc_clients/src/identity/device.rs @@ -1,57 +1,57 @@ use std::fmt::{Display, Formatter, Result as FmtResult}; use crate::error::Error; -pub use crate::identity::protos::client::DeviceType; +pub use crate::identity::protos::unauth::DeviceType; impl TryFrom for DeviceType { type Error = crate::error::Error; fn try_from(value: i32) -> Result { match value { 0 => Ok(DeviceType::Keyserver), 1 => Ok(DeviceType::Web), 2 => Ok(DeviceType::Ios), 3 => Ok(DeviceType::Android), 4 => Ok(DeviceType::Windows), 5 => Ok(DeviceType::MacOs), _ => Err(Error::InvalidDeviceType), } } } impl Display for DeviceType { fn fmt(&self, f: &mut Formatter) -> FmtResult { match self { DeviceType::Keyserver => write!(f, "keyserver"), DeviceType::Web => write!(f, "web"), DeviceType::Ios => write!(f, "ios"), DeviceType::Android => write!(f, "android"), DeviceType::Windows => write!(f, "windows"), DeviceType::MacOs => write!(f, "macos"), } } } #[cfg(test)] mod device_tests { use super::*; #[test] fn test_device_try_from() { let device_type = DeviceType::try_from(5i32).unwrap(); assert_eq!(DeviceType::MacOs, device_type); } #[test] fn test_invalid_device() { let device_type_result = DeviceType::try_from(6i32); assert!(device_type_result.is_err()); } #[test] fn test_display_device_type() { assert_eq!(format!("{}", DeviceType::Ios), "ios"); } } diff --git a/shared/grpc_clients/src/identity/mod.rs b/shared/grpc_clients/src/identity/mod.rs index da3565952..fca0e2fa9 100644 --- a/shared/grpc_clients/src/identity/mod.rs +++ b/shared/grpc_clients/src/identity/mod.rs @@ -1,21 +1,21 @@ pub mod authenticated; pub mod device; pub mod shared; pub mod unauthenticated; pub mod protos { - // This must be named client for authenticated generated code - pub mod client { - tonic::include_proto!("identity.client"); + // This must be named unauth for authenticated generated code + pub mod unauth { + tonic::include_proto!("identity.unauth"); } - pub use client as unauthenticated; - - pub mod authenticated { - tonic::include_proto!("identity.authenticated"); + pub mod auth { + tonic::include_proto!("identity.auth"); } + pub use auth as authenticated; + pub use unauth as unauthenticated; } pub use authenticated::get_auth_client; pub use device::DeviceType; pub use shared::{REQUEST_METADATA_COOKIE_KEY, RESPONSE_METADATA_COOKIE_KEY}; pub use unauthenticated::get_unauthenticated_client; diff --git a/shared/grpc_clients/src/identity/unauthenticated/mod.rs b/shared/grpc_clients/src/identity/unauthenticated/mod.rs index 64333a08d..1cd2945cc 100644 --- a/shared/grpc_clients/src/identity/unauthenticated/mod.rs +++ b/shared/grpc_clients/src/identity/unauthenticated/mod.rs @@ -1,29 +1,29 @@ pub mod client; use tonic::codegen::InterceptedService; use tonic::transport::Channel; use super::{ - protos::client::identity_client_service_client::IdentityClientServiceClient, + protos::unauth::identity_client_service_client::IdentityClientServiceClient, shared::CodeVersionLayer, }; use crate::error::Error; pub async fn get_unauthenticated_client( url: &str, code_version: u64, device_type: String, ) -> Result< IdentityClientServiceClient>, Error, > { let channel = crate::get_grpc_service_channel(url).await?; let version_interceptor = CodeVersionLayer { version: code_version, device_type, }; Ok(IdentityClientServiceClient::with_interceptor( channel, version_interceptor, )) } diff --git a/shared/protos/identity_authenticated.proto b/shared/protos/identity_auth.proto similarity index 88% rename from shared/protos/identity_authenticated.proto rename to shared/protos/identity_auth.proto index ea2522381..af60151f6 100644 --- a/shared/protos/identity_authenticated.proto +++ b/shared/protos/identity_auth.proto @@ -1,184 +1,184 @@ syntax = "proto3"; -import "identity_client.proto"; +import "identity_unauth.proto"; -package identity.authenticated; +package identity.auth; // RPCs from a client (iOS, Android, or web) to identity service // // This service will assert authenticity of a device by verifying the access // token through an interceptor, thus avoiding the need to explicitly pass // the credentials on every request service IdentityClientService { // X3DH actions // Replenish one-time preKeys rpc UploadOneTimeKeys(UploadOneTimeKeysRequest) - returns (identity.client.Empty) {} + returns (identity.unauth.Empty) {} // Rotate a device's prekey and prekey signature // Rotated for deniability of older messages rpc RefreshUserPrekeys(RefreshUserPrekeysRequest) - returns (identity.client.Empty) {} + returns (identity.unauth.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 rpc GetOutboundKeysForUser(OutboundKeysForUserRequest) returns (OutboundKeysForUserResponse) {} // Called by receivers of a communication request. The reponse will only // return identity keys (both content and notif keys) and related prekeys per // device, but will not contain one-time keys. rpc GetInboundKeysForUser(InboundKeysForUserRequest) returns (InboundKeysForUserResponse) {} // Called by user to update password and receive new access token rpc UpdateUserPasswordStart(UpdateUserPasswordStartRequest) returns (UpdateUserPasswordStartResponse) {} rpc UpdateUserPasswordFinish(UpdateUserPasswordFinishRequest) returns - (identity.client.Empty) {} + (identity.unauth.Empty) {} // Called by user to log out (clears device's keys and access token) - rpc LogOutUser(identity.client.Empty) returns (identity.client.Empty) {} + rpc LogOutUser(identity.unauth.Empty) returns (identity.unauth.Empty) {} // Called by a user to delete their own account - rpc DeleteUser(identity.client.Empty) returns (identity.client.Empty) {} + rpc DeleteUser(identity.unauth.Empty) returns (identity.unauth.Empty) {} // Called by clients to get required keys for opening a connection // to a user's keyserver rpc GetKeyserverKeys(OutboundKeysForUserRequest) returns (KeyserverKeysResponse) {} // Returns userID for given username or wallet address rpc FindUserID(FindUserIDRequest) returns (FindUserIDResponse) {} // Returns device list history rpc GetDeviceListForUser(GetDeviceListRequest) returns (GetDeviceListResponse) {} } // Helper types // UploadOneTimeKeys // As OPKs get exhausted, they need to be refreshed message UploadOneTimeKeysRequest { repeated string content_one_time_prekeys = 1; repeated string notif_one_time_prekeys = 2; } // RefreshUserPreKeys message RefreshUserPrekeysRequest { - identity.client.Prekey new_content_prekeys = 1; - identity.client.Prekey new_notif_prekeys = 2; + identity.unauth.Prekey new_content_prekeys = 1; + identity.unauth.Prekey new_notif_prekeys = 2; } // Information needed when establishing communication to someone else's device message OutboundKeyInfo { - identity.client.IdentityKeyInfo identity_info = 1; - identity.client.Prekey content_prekey = 2; - identity.client.Prekey notif_prekey = 3; + identity.unauth.IdentityKeyInfo identity_info = 1; + identity.unauth.Prekey content_prekey = 2; + identity.unauth.Prekey notif_prekey = 3; optional string one_time_content_prekey = 4; optional string one_time_notif_prekey = 5; } message KeyserverKeysResponse { optional OutboundKeyInfo keyserver_info = 1; } // GetOutboundKeysForUser message OutboundKeysForUserResponse { // Map is keyed on devices' public ed25519 key used for signing map devices = 1; } // Information needed by a device to establish communcation when responding // to a request. // The device receiving a request only needs the content key and prekey. message OutboundKeysForUserRequest { string user_id = 1; } // GetInboundKeysForUser message InboundKeyInfo { - identity.client.IdentityKeyInfo identity_info = 1; - identity.client.Prekey content_prekey = 2; - identity.client.Prekey notif_prekey = 3; + identity.unauth.IdentityKeyInfo identity_info = 1; + identity.unauth.Prekey content_prekey = 2; + identity.unauth.Prekey notif_prekey = 3; } message InboundKeysForUserResponse { // Map is keyed on devices' public ed25519 key used for signing map devices = 1; } message InboundKeysForUserRequest { string user_id = 1; } // FindUserID message FindUserIDRequest { oneof identifier { string username = 1; string wallet_address = 2; } } message FindUserIDResponse { // userID if the user is registered with Identity Service, null otherwise 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). bool is_reserved = 2; } // UpdateUserPassword // Request for updating a user, similar to registration but need a // access token to validate user before updating password message UpdateUserPasswordStartRequest { // Message sent to initiate PAKE registration (step 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 session_id = 1; // Opaque client registration upload (step 3) bytes opaque_registration_upload = 2; } message UpdateUserPasswordStartResponse { // Identifier used to correlate start request with finish request string session_id = 1; bytes opaque_registration_response = 2; } // GetDeviceListForUser message GetDeviceListRequest { // User whose device lists we want to retrieve string user_id = 1; // UTC timestamp in milliseconds // If none, whole device list history will be retrieved optional int64 since_timestamp = 2; } message GetDeviceListResponse { // A list of stringified JSON objects of the following format: // { // "rawDeviceList": JSON.stringify({ // "devices": [, ...] // "timestamp": , // }) // } repeated string device_list_updates = 1; } diff --git a/shared/protos/identity_client.proto b/shared/protos/identity_unauth.proto similarity index 99% rename from shared/protos/identity_client.proto rename to shared/protos/identity_unauth.proto index 35e447700..751c01c24 100644 --- a/shared/protos/identity_client.proto +++ b/shared/protos/identity_unauth.proto @@ -1,246 +1,246 @@ syntax = "proto3"; -package identity.client; +package identity.unauth; // RPCs from a client (iOS, Android, or web) to identity service service IdentityClientService { // Account actions // Called by user to register with the Identity Service (PAKE only) // Due to limitations of grpc-web, the Opaque challenge+response // needs to be split up over two unary requests // Start/Finish is used here to align with opaque protocol rpc RegisterPasswordUserStart(RegistrationStartRequest) returns ( RegistrationStartResponse) {} rpc RegisterReservedPasswordUserStart(ReservedRegistrationStartRequest) returns (RegistrationStartResponse) {} rpc RegisterPasswordUserFinish(RegistrationFinishRequest) returns ( RegistrationFinishResponse) {} // Called by user to register device and get an access token rpc LogInPasswordUserStart(OpaqueLoginStartRequest) returns (OpaqueLoginStartResponse) {} rpc LogInPasswordUserFinish(OpaqueLoginFinishRequest) returns (OpaqueLoginFinishResponse) {} rpc LogInWalletUser(WalletLoginRequest) returns (WalletLoginResponse) {} rpc LogInReservedWalletUser(ReservedWalletLoginRequest) returns (WalletLoginResponse) {} // Sign-In with Ethereum actions // Called by clients to get a nonce for a Sign-In with Ethereum message rpc GenerateNonce(Empty) returns (GenerateNonceResponse) {} // Service actions // Called by other services to verify a user's access token rpc VerifyUserAccessToken(VerifyUserAccessTokenRequest) returns (VerifyUserAccessTokenResponse) {} // Ashoat's keyserver actions // Called by Ashoat's keyserver to add usernames to the Identity service's // reserved list rpc AddReservedUsernames(AddReservedUsernamesRequest) returns (Empty) {} // Called by Ashoat's keyserver to remove usernames from the Identity // service's reserved list rpc RemoveReservedUsername(RemoveReservedUsernameRequest) returns (Empty) {} // Miscellaneous actions // Called by users periodically to check if their code version is supported rpc Ping(Empty) returns (Empty) {} } // Helper types message Empty {} message Prekey { string prekey = 1; string prekey_signature = 2; } // Key information needed for starting a X3DH session message IdentityKeyInfo { // JSON payload containing Olm keys // Sessions for users will contain both ContentKeys and NotifKeys // For keyservers, this will only contain ContentKeys string payload = 1; // Payload signed with the signing ed25519 key string payload_signature = 2; // Signed message used for SIWE // This correlates a given wallet with a device's content key optional string social_proof = 3; } // RegisterUser // Ephemeral information provided so others can create initial message // to this device // // Prekeys are generally rotated periodically // One-time Prekeys are "consumed" after first use, so many need to // be provide to avoid exhausting them. enum DeviceType { KEYSERVER = 0; WEB = 1; // iOS doesn't leave a good option for title to camel case renaming IOS = 2; ANDROID = 3; WINDOWS = 4; MAC_OS = 5; } // Bundle of information needed for creating an initial message using X3DH message DeviceKeyUpload { 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 opaque_registration_request = 1; string username = 2; // Information needed to open a new channel to current user's device DeviceKeyUpload device_key_upload = 3; } message ReservedRegistrationStartRequest { // Message sent to initiate PAKE registration (step 1) bytes opaque_registration_request = 1; string username = 2; // Information needed to open a new channel to current user's device DeviceKeyUpload device_key_upload = 3; // Message from Ashoat's keyserver attesting that a given user has ownership // of a given username string keyserver_message = 4; // Above message signed with Ashoat's keyserver's signing ed25519 key string keyserver_signature = 5; } // Messages sent from a client to Identity Service message RegistrationFinishRequest { // Identifier to correlate RegisterStart session string session_id = 1; // Final message in PAKE registration bytes opaque_registration_upload = 2; } // Messages sent from Identity Service to client message RegistrationStartResponse { // Identifier used to correlate start request with finish request string session_id = 1; // sent to the user upon reception of the PAKE registration attempt // (step 2) bytes opaque_registration_response = 2; } message RegistrationFinishResponse { // Unique identifier for newly registered user string user_id = 1; // After successful unpacking of user credentials, return token string access_token = 2; } // LoginUser message OpaqueLoginStartRequest { string username = 1; // Message sent to initiate PAKE login (step 1) bytes opaque_login_request = 2; // Information specific to a user's device needed to open a new channel of // communication with this user DeviceKeyUpload device_key_upload = 3; } message OpaqueLoginFinishRequest { // Identifier used to correlate start request with finish request string session_id = 1; // Message containing client's reponse to server challenge. // Used to verify that client holds password secret (Step 3) bytes opaque_login_upload = 2; } message OpaqueLoginStartResponse { // Identifier used to correlate start request with finish request string session_id = 1; // Opaque challenge sent from server to client attempting to login (Step 2) bytes opaque_login_response = 2; } message OpaqueLoginFinishResponse { string user_id = 1; // Mint and return a new access token upon successful login string access_token = 2; } message WalletLoginRequest { 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 device_key_upload = 3; } message ReservedWalletLoginRequest { 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 device_key_upload = 3; // Message from Ashoat's keyserver attesting that a given user has ownership // of a given wallet address string keyserver_message = 4; // Above message signed with Ashoat's keyserver's signing ed25519 key string keyserver_signature = 5; } message WalletLoginResponse { string user_id = 1; string access_token = 2; } // GenerateNonce message GenerateNonceResponse{ string nonce = 1; } // VerifyUserAccessToken message VerifyUserAccessTokenRequest { string user_id = 1; // signing ed25519 key for the given user's device string device_id = 2; string access_token = 3; } message VerifyUserAccessTokenResponse { bool token_valid = 1; } // AddReservedUsernames message AddReservedUsernamesRequest { // Message from Ashoat's keyserver containing the username to be added string message = 1; // Above message signed with Ashoat's keyserver's signing ed25519 key string signature = 2; } // RemoveReservedUsername message RemoveReservedUsernameRequest { // Message from Ashoat's keyserver containing the username to be removed string message = 1; // Above message signed with Ashoat's keyserver's signing ed25519 key string signature = 2; } diff --git a/web/grpc/identity-service-client-wrapper.js b/web/grpc/identity-service-client-wrapper.js index 9bb44589a..6da34b432 100644 --- a/web/grpc/identity-service-client-wrapper.js +++ b/web/grpc/identity-service-client-wrapper.js @@ -1,86 +1,86 @@ // @flow import identityServiceConfig from 'lib/facts/identity-service.js'; import type { IdentityServiceAuthLayer } from 'lib/types/identity-service-types.js'; import { VersionInterceptor, AuthInterceptor } from './interceptor.js'; import * as IdentityAuthClient from '../protobufs/identity-auth-client.cjs'; -import * as IdentityClient from '../protobufs/identity-client.cjs'; -import { Empty } from '../protobufs/identity-structs.cjs'; +import { Empty } from '../protobufs/identity-unauth-structs.cjs'; +import * as IdentityClient from '../protobufs/identity-unauth.cjs'; class IdentityServiceClientWrapper { authClient: ?IdentityAuthClient.IdentityClientServicePromiseClient; unauthorizedClient: ?IdentityClient.IdentityClientServicePromiseClient; constructor() { this.authClient = null; this.unauthorizedClient = null; } determineSocketAddr(): string { return process.env.IDENTITY_SOCKET_ADDR ?? identityServiceConfig.defaultURL; } async initAuthClient(authLayer: IdentityServiceAuthLayer): Promise { const { userID, deviceID, commServicesAccessToken } = authLayer; const identitySocketAddr = this.determineSocketAddr(); const versionInterceptor = new VersionInterceptor(); const authInterceptor = new AuthInterceptor( userID, deviceID, commServicesAccessToken, ); const authClientOpts = { unaryInterceptors: [versionInterceptor, authInterceptor], }; this.authClient = new IdentityAuthClient.IdentityClientServicePromiseClient( identitySocketAddr, null, authClientOpts, ); } async initUnauthorizedClient(): Promise { const identitySocketAddr = this.determineSocketAddr(); const versionInterceptor = new VersionInterceptor(); const unauthorizedClientOpts = { unaryInterceptors: [versionInterceptor], }; this.unauthorizedClient = new IdentityClient.IdentityClientServicePromiseClient( identitySocketAddr, null, unauthorizedClientOpts, ); } async deleteUser( userID: string, deviceID: string, accessToken: string, ): Promise { if (!this.authClient) { const authLayer: IdentityServiceAuthLayer = { userID, deviceID, commServicesAccessToken: accessToken, }; await this.initAuthClient(authLayer); } if (this.authClient) { await this.authClient.deleteUser(new Empty()); } else { throw new Error('Identity service client is not initialized'); } } } export { IdentityServiceClientWrapper }; diff --git a/web/protobufs/identity-auth-client.cjs b/web/protobufs/identity-auth-client.cjs index 37eb86ab7..d4ac45960 100644 --- a/web/protobufs/identity-auth-client.cjs +++ b/web/protobufs/identity-auth-client.cjs @@ -1,691 +1,691 @@ /** * @fileoverview gRPC-Web generated client stub for identity.authenticated * @enhanceable * @public * @generated */ // Code generated by protoc-gen-grpc-web. DO NOT EDIT. // versions: // protoc-gen-grpc-web v1.4.2 // protoc v3.21.12 // source: identity_authenticated.proto /* eslint-disable */ // @ts-nocheck const grpc = {}; grpc.web = require('grpc-web'); -var identity_client_pb = require('./identity-structs.cjs') +var identity_client_pb = require('./identity-unauth-structs.cjs'); const proto = {}; proto.identity = {}; proto.identity.authenticated = require('./identity-auth-structs.cjs'); /** * @param {string} hostname * @param {?Object} credentials * @param {?grpc.web.ClientOptions} options * @constructor * @struct * @final */ proto.identity.authenticated.IdentityClientServiceClient = function(hostname, credentials, options) { if (!options) options = {}; options.format = 'text'; /** * @private @const {!grpc.web.GrpcWebClientBase} The client */ this.client_ = new grpc.web.GrpcWebClientBase(options); /** * @private @const {string} The hostname */ this.hostname_ = hostname.replace(/\/+$/, ''); }; /** * @param {string} hostname * @param {?Object} credentials * @param {?grpc.web.ClientOptions} options * @constructor * @struct * @final */ proto.identity.authenticated.IdentityClientServicePromiseClient = function(hostname, credentials, options) { if (!options) options = {}; options.format = 'text'; /** * @private @const {!grpc.web.GrpcWebClientBase} The client */ this.client_ = new grpc.web.GrpcWebClientBase(options); /** * @private @const {string} The hostname */ this.hostname_ = hostname.replace(/\/+$/, ''); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.authenticated.UploadOneTimeKeysRequest, * !proto.identity.client.Empty>} */ const methodDescriptor_IdentityClientService_UploadOneTimeKeys = new grpc.web.MethodDescriptor( '/identity.authenticated.IdentityClientService/UploadOneTimeKeys', grpc.web.MethodType.UNARY, proto.identity.authenticated.UploadOneTimeKeysRequest, identity_client_pb.Empty, /** * @param {!proto.identity.authenticated.UploadOneTimeKeysRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, identity_client_pb.Empty.deserializeBinary ); /** * @param {!proto.identity.authenticated.UploadOneTimeKeysRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.Empty)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.authenticated.IdentityClientServiceClient.prototype.uploadOneTimeKeys = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.authenticated.IdentityClientService/UploadOneTimeKeys', request, metadata || {}, methodDescriptor_IdentityClientService_UploadOneTimeKeys, callback); }; /** * @param {!proto.identity.authenticated.UploadOneTimeKeysRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.authenticated.IdentityClientServicePromiseClient.prototype.uploadOneTimeKeys = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.authenticated.IdentityClientService/UploadOneTimeKeys', request, metadata || {}, methodDescriptor_IdentityClientService_UploadOneTimeKeys); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.authenticated.RefreshUserPreKeysRequest, * !proto.identity.client.Empty>} */ const methodDescriptor_IdentityClientService_RefreshUserPreKeys = new grpc.web.MethodDescriptor( '/identity.authenticated.IdentityClientService/RefreshUserPreKeys', grpc.web.MethodType.UNARY, proto.identity.authenticated.RefreshUserPreKeysRequest, identity_client_pb.Empty, /** * @param {!proto.identity.authenticated.RefreshUserPreKeysRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, identity_client_pb.Empty.deserializeBinary ); /** * @param {!proto.identity.authenticated.RefreshUserPreKeysRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.Empty)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.authenticated.IdentityClientServiceClient.prototype.refreshUserPreKeys = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.authenticated.IdentityClientService/RefreshUserPreKeys', request, metadata || {}, methodDescriptor_IdentityClientService_RefreshUserPreKeys, callback); }; /** * @param {!proto.identity.authenticated.RefreshUserPreKeysRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.authenticated.IdentityClientServicePromiseClient.prototype.refreshUserPreKeys = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.authenticated.IdentityClientService/RefreshUserPreKeys', request, metadata || {}, methodDescriptor_IdentityClientService_RefreshUserPreKeys); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.authenticated.OutboundKeysForUserRequest, * !proto.identity.authenticated.OutboundKeysForUserResponse>} */ const methodDescriptor_IdentityClientService_GetOutboundKeysForUser = new grpc.web.MethodDescriptor( '/identity.authenticated.IdentityClientService/GetOutboundKeysForUser', grpc.web.MethodType.UNARY, proto.identity.authenticated.OutboundKeysForUserRequest, proto.identity.authenticated.OutboundKeysForUserResponse, /** * @param {!proto.identity.authenticated.OutboundKeysForUserRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.authenticated.OutboundKeysForUserResponse.deserializeBinary ); /** * @param {!proto.identity.authenticated.OutboundKeysForUserRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.authenticated.OutboundKeysForUserResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.authenticated.IdentityClientServiceClient.prototype.getOutboundKeysForUser = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.authenticated.IdentityClientService/GetOutboundKeysForUser', request, metadata || {}, methodDescriptor_IdentityClientService_GetOutboundKeysForUser, callback); }; /** * @param {!proto.identity.authenticated.OutboundKeysForUserRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.authenticated.IdentityClientServicePromiseClient.prototype.getOutboundKeysForUser = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.authenticated.IdentityClientService/GetOutboundKeysForUser', request, metadata || {}, methodDescriptor_IdentityClientService_GetOutboundKeysForUser); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.authenticated.InboundKeysForUserRequest, * !proto.identity.authenticated.InboundKeysForUserResponse>} */ const methodDescriptor_IdentityClientService_GetInboundKeysForUser = new grpc.web.MethodDescriptor( '/identity.authenticated.IdentityClientService/GetInboundKeysForUser', grpc.web.MethodType.UNARY, proto.identity.authenticated.InboundKeysForUserRequest, proto.identity.authenticated.InboundKeysForUserResponse, /** * @param {!proto.identity.authenticated.InboundKeysForUserRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.authenticated.InboundKeysForUserResponse.deserializeBinary ); /** * @param {!proto.identity.authenticated.InboundKeysForUserRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.authenticated.InboundKeysForUserResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.authenticated.IdentityClientServiceClient.prototype.getInboundKeysForUser = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.authenticated.IdentityClientService/GetInboundKeysForUser', request, metadata || {}, methodDescriptor_IdentityClientService_GetInboundKeysForUser, callback); }; /** * @param {!proto.identity.authenticated.InboundKeysForUserRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.authenticated.IdentityClientServicePromiseClient.prototype.getInboundKeysForUser = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.authenticated.IdentityClientService/GetInboundKeysForUser', request, metadata || {}, methodDescriptor_IdentityClientService_GetInboundKeysForUser); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.authenticated.UpdateUserPasswordStartRequest, * !proto.identity.authenticated.UpdateUserPasswordStartResponse>} */ const methodDescriptor_IdentityClientService_UpdateUserPasswordStart = new grpc.web.MethodDescriptor( '/identity.authenticated.IdentityClientService/UpdateUserPasswordStart', grpc.web.MethodType.UNARY, proto.identity.authenticated.UpdateUserPasswordStartRequest, proto.identity.authenticated.UpdateUserPasswordStartResponse, /** * @param {!proto.identity.authenticated.UpdateUserPasswordStartRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.authenticated.UpdateUserPasswordStartResponse.deserializeBinary ); /** * @param {!proto.identity.authenticated.UpdateUserPasswordStartRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.authenticated.UpdateUserPasswordStartResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.authenticated.IdentityClientServiceClient.prototype.updateUserPasswordStart = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.authenticated.IdentityClientService/UpdateUserPasswordStart', request, metadata || {}, methodDescriptor_IdentityClientService_UpdateUserPasswordStart, callback); }; /** * @param {!proto.identity.authenticated.UpdateUserPasswordStartRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.authenticated.IdentityClientServicePromiseClient.prototype.updateUserPasswordStart = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.authenticated.IdentityClientService/UpdateUserPasswordStart', request, metadata || {}, methodDescriptor_IdentityClientService_UpdateUserPasswordStart); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.authenticated.UpdateUserPasswordFinishRequest, * !proto.identity.client.Empty>} */ const methodDescriptor_IdentityClientService_UpdateUserPasswordFinish = new grpc.web.MethodDescriptor( '/identity.authenticated.IdentityClientService/UpdateUserPasswordFinish', grpc.web.MethodType.UNARY, proto.identity.authenticated.UpdateUserPasswordFinishRequest, identity_client_pb.Empty, /** * @param {!proto.identity.authenticated.UpdateUserPasswordFinishRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, identity_client_pb.Empty.deserializeBinary ); /** * @param {!proto.identity.authenticated.UpdateUserPasswordFinishRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.Empty)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.authenticated.IdentityClientServiceClient.prototype.updateUserPasswordFinish = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.authenticated.IdentityClientService/UpdateUserPasswordFinish', request, metadata || {}, methodDescriptor_IdentityClientService_UpdateUserPasswordFinish, callback); }; /** * @param {!proto.identity.authenticated.UpdateUserPasswordFinishRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.authenticated.IdentityClientServicePromiseClient.prototype.updateUserPasswordFinish = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.authenticated.IdentityClientService/UpdateUserPasswordFinish', request, metadata || {}, methodDescriptor_IdentityClientService_UpdateUserPasswordFinish); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.Empty, * !proto.identity.client.Empty>} */ const methodDescriptor_IdentityClientService_LogOutUser = new grpc.web.MethodDescriptor( '/identity.authenticated.IdentityClientService/LogOutUser', grpc.web.MethodType.UNARY, identity_client_pb.Empty, identity_client_pb.Empty, /** * @param {!proto.identity.client.Empty} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, identity_client_pb.Empty.deserializeBinary ); /** * @param {!proto.identity.client.Empty} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.Empty)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.authenticated.IdentityClientServiceClient.prototype.logOutUser = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.authenticated.IdentityClientService/LogOutUser', request, metadata || {}, methodDescriptor_IdentityClientService_LogOutUser, callback); }; /** * @param {!proto.identity.client.Empty} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.authenticated.IdentityClientServicePromiseClient.prototype.logOutUser = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.authenticated.IdentityClientService/LogOutUser', request, metadata || {}, methodDescriptor_IdentityClientService_LogOutUser); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.Empty, * !proto.identity.client.Empty>} */ const methodDescriptor_IdentityClientService_DeleteUser = new grpc.web.MethodDescriptor( '/identity.authenticated.IdentityClientService/DeleteUser', grpc.web.MethodType.UNARY, identity_client_pb.Empty, identity_client_pb.Empty, /** * @param {!proto.identity.client.Empty} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, identity_client_pb.Empty.deserializeBinary ); /** * @param {!proto.identity.client.Empty} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.Empty)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.authenticated.IdentityClientServiceClient.prototype.deleteUser = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.authenticated.IdentityClientService/DeleteUser', request, metadata || {}, methodDescriptor_IdentityClientService_DeleteUser, callback); }; /** * @param {!proto.identity.client.Empty} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.authenticated.IdentityClientServicePromiseClient.prototype.deleteUser = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.authenticated.IdentityClientService/DeleteUser', request, metadata || {}, methodDescriptor_IdentityClientService_DeleteUser); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.authenticated.OutboundKeysForUserRequest, * !proto.identity.authenticated.KeyserverKeysResponse>} */ const methodDescriptor_IdentityClientService_GetKeyserverKeys = new grpc.web.MethodDescriptor( '/identity.authenticated.IdentityClientService/GetKeyserverKeys', grpc.web.MethodType.UNARY, proto.identity.authenticated.OutboundKeysForUserRequest, proto.identity.authenticated.KeyserverKeysResponse, /** * @param {!proto.identity.authenticated.OutboundKeysForUserRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.authenticated.KeyserverKeysResponse.deserializeBinary ); /** * @param {!proto.identity.authenticated.OutboundKeysForUserRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.authenticated.KeyserverKeysResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.authenticated.IdentityClientServiceClient.prototype.getKeyserverKeys = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.authenticated.IdentityClientService/GetKeyserverKeys', request, metadata || {}, methodDescriptor_IdentityClientService_GetKeyserverKeys, callback); }; /** * @param {!proto.identity.authenticated.OutboundKeysForUserRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.authenticated.IdentityClientServicePromiseClient.prototype.getKeyserverKeys = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.authenticated.IdentityClientService/GetKeyserverKeys', request, metadata || {}, methodDescriptor_IdentityClientService_GetKeyserverKeys); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.authenticated.FindUserIDRequest, * !proto.identity.authenticated.FindUserIDResponse>} */ const methodDescriptor_IdentityClientService_FindUserID = new grpc.web.MethodDescriptor( '/identity.authenticated.IdentityClientService/FindUserID', grpc.web.MethodType.UNARY, proto.identity.authenticated.FindUserIDRequest, proto.identity.authenticated.FindUserIDResponse, /** * @param {!proto.identity.authenticated.FindUserIDRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.authenticated.FindUserIDResponse.deserializeBinary ); /** * @param {!proto.identity.authenticated.FindUserIDRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.authenticated.FindUserIDResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.authenticated.IdentityClientServiceClient.prototype.findUserID = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.authenticated.IdentityClientService/FindUserID', request, metadata || {}, methodDescriptor_IdentityClientService_FindUserID, callback); }; /** * @param {!proto.identity.authenticated.FindUserIDRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.authenticated.IdentityClientServicePromiseClient.prototype.findUserID = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.authenticated.IdentityClientService/FindUserID', request, metadata || {}, methodDescriptor_IdentityClientService_FindUserID); }; module.exports = proto.identity.authenticated; diff --git a/web/protobufs/identity-auth-client.cjs.flow b/web/protobufs/identity-auth-client.cjs.flow index 5b511338d..929cdda36 100644 --- a/web/protobufs/identity-auth-client.cjs.flow +++ b/web/protobufs/identity-auth-client.cjs.flow @@ -1,139 +1,139 @@ // @flow import * as grpcWeb from 'grpc-web'; import * as identityAuthStructs from './identity-auth-structs.cjs'; -import * as identityStructs from './identity-structs.cjs'; +import * as identityStructs from './identity-unauth-structs.cjs'; declare export class IdentityClientServiceClient { constructor (hostname: string, credentials?: null | { +[index: string]: string; }, options?: null | { +[index: string]: any; }): void; uploadOneTimeKeys( request: identityAuthStructs.UploadOneTimeKeysRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.Empty) => void ): grpcWeb.ClientReadableStream; refreshUserPreKeys( request: identityAuthStructs.RefreshUserPreKeysRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.Empty) => void ): grpcWeb.ClientReadableStream; getOutboundKeysForUser( request: identityAuthStructs.OutboundKeysForUserRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityAuthStructs.OutboundKeysForUserResponse) => void ): grpcWeb.ClientReadableStream; getInboundKeysForUser( request: identityAuthStructs.InboundKeysForUserRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityAuthStructs.InboundKeysForUserResponse) => void ): grpcWeb.ClientReadableStream; updateUserPasswordStart( request: identityAuthStructs.UpdateUserPasswordStartRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityAuthStructs.UpdateUserPasswordStartResponse) => void ): grpcWeb.ClientReadableStream; updateUserPasswordFinish( request: identityAuthStructs.UpdateUserPasswordFinishRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.Empty) => void ): grpcWeb.ClientReadableStream; logOutUser( request: identityStructs.Empty, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.Empty) => void ): grpcWeb.ClientReadableStream; deleteUser( request: identityStructs.Empty, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.Empty) => void ): grpcWeb.ClientReadableStream; getKeyserverKeys( request: identityAuthStructs.OutboundKeysForUserRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityAuthStructs.KeyserverKeysResponse) => void ): grpcWeb.ClientReadableStream; findUserID( request: identityAuthStructs.FindUserIDRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityAuthStructs.FindUserIDResponse) => void ): grpcWeb.ClientReadableStream; } declare export class IdentityClientServicePromiseClient { constructor (hostname: string, credentials?: null | { +[index: string]: string; }, options?: null | { +[index: string]: any; }): void; uploadOneTimeKeys( request: identityAuthStructs.UploadOneTimeKeysRequest, metadata?: grpcWeb.Metadata ): Promise; refreshUserPreKeys( request: identityAuthStructs.RefreshUserPreKeysRequest, metadata?: grpcWeb.Metadata ): Promise; getOutboundKeysForUser( request: identityAuthStructs.OutboundKeysForUserRequest, metadata?: grpcWeb.Metadata ): Promise; getInboundKeysForUser( request: identityAuthStructs.InboundKeysForUserRequest, metadata?: grpcWeb.Metadata ): Promise; updateUserPasswordStart( request: identityAuthStructs.UpdateUserPasswordStartRequest, metadata?: grpcWeb.Metadata ): Promise; updateUserPasswordFinish( request: identityAuthStructs.UpdateUserPasswordFinishRequest, metadata?: grpcWeb.Metadata ): Promise; logOutUser( request: identityStructs.Empty, metadata?: grpcWeb.Metadata ): Promise; deleteUser( request: identityStructs.Empty, metadata?: grpcWeb.Metadata ): Promise; getKeyserverKeys( request: identityAuthStructs.OutboundKeysForUserRequest, metadata?: grpcWeb.Metadata ): Promise; findUserID( request: identityAuthStructs.FindUserIDRequest, metadata?: grpcWeb.Metadata ): Promise; } diff --git a/web/protobufs/identity-auth-structs.cjs b/web/protobufs/identity-auth-structs.cjs index 08af3e3cd..40f87b80f 100644 --- a/web/protobufs/identity-auth-structs.cjs +++ b/web/protobufs/identity-auth-structs.cjs @@ -1,2946 +1,2946 @@ // source: identity_authenticated.proto /** * @fileoverview * @enhanceable * @suppress {missingRequire} reports error on implicit type usages. * @suppress {messageConventions} JS Compiler reports an error if a variable or * field starts with 'MSG_' and isn't a translatable message. * @public * @generated */ // GENERATED CODE -- DO NOT EDIT! /* eslint-disable */ // @ts-nocheck var jspb = require('google-protobuf'); var goog = jspb; var global = (typeof globalThis !== 'undefined' && globalThis) || (typeof window !== 'undefined' && window) || (typeof global !== 'undefined' && global) || (typeof self !== 'undefined' && self) || (function () { return this; }).call(null) || Function('return this')(); -var identity_client_pb = require('./identity-structs.cjs'); +var identity_client_pb = require('./identity-unauth-structs.cjs'); goog.object.extend(proto, identity_client_pb); goog.exportSymbol('proto.identity.authenticated.FindUserIDRequest', null, global); goog.exportSymbol('proto.identity.authenticated.FindUserIDRequest.IdentifierCase', null, global); goog.exportSymbol('proto.identity.authenticated.FindUserIDResponse', null, global); goog.exportSymbol('proto.identity.authenticated.InboundKeyInfo', null, global); goog.exportSymbol('proto.identity.authenticated.InboundKeysForUserRequest', null, global); goog.exportSymbol('proto.identity.authenticated.InboundKeysForUserResponse', null, global); goog.exportSymbol('proto.identity.authenticated.KeyserverKeysResponse', null, global); goog.exportSymbol('proto.identity.authenticated.OutboundKeyInfo', null, global); goog.exportSymbol('proto.identity.authenticated.OutboundKeysForUserRequest', null, global); goog.exportSymbol('proto.identity.authenticated.OutboundKeysForUserResponse', null, global); goog.exportSymbol('proto.identity.authenticated.RefreshUserPreKeysRequest', null, global); goog.exportSymbol('proto.identity.authenticated.UpdateUserPasswordFinishRequest', null, global); goog.exportSymbol('proto.identity.authenticated.UpdateUserPasswordStartRequest', null, global); goog.exportSymbol('proto.identity.authenticated.UpdateUserPasswordStartResponse', null, global); goog.exportSymbol('proto.identity.authenticated.UploadOneTimeKeysRequest', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.UploadOneTimeKeysRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.identity.authenticated.UploadOneTimeKeysRequest.repeatedFields_, null); }; goog.inherits(proto.identity.authenticated.UploadOneTimeKeysRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.UploadOneTimeKeysRequest.displayName = 'proto.identity.authenticated.UploadOneTimeKeysRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.RefreshUserPreKeysRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.authenticated.RefreshUserPreKeysRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.RefreshUserPreKeysRequest.displayName = 'proto.identity.authenticated.RefreshUserPreKeysRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.OutboundKeyInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.authenticated.OutboundKeyInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.OutboundKeyInfo.displayName = 'proto.identity.authenticated.OutboundKeyInfo'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.KeyserverKeysResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.authenticated.KeyserverKeysResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.KeyserverKeysResponse.displayName = 'proto.identity.authenticated.KeyserverKeysResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.OutboundKeysForUserResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.authenticated.OutboundKeysForUserResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.OutboundKeysForUserResponse.displayName = 'proto.identity.authenticated.OutboundKeysForUserResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.OutboundKeysForUserRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.authenticated.OutboundKeysForUserRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.OutboundKeysForUserRequest.displayName = 'proto.identity.authenticated.OutboundKeysForUserRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.InboundKeyInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.authenticated.InboundKeyInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.InboundKeyInfo.displayName = 'proto.identity.authenticated.InboundKeyInfo'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.InboundKeysForUserResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.authenticated.InboundKeysForUserResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.InboundKeysForUserResponse.displayName = 'proto.identity.authenticated.InboundKeysForUserResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.InboundKeysForUserRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.authenticated.InboundKeysForUserRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.InboundKeysForUserRequest.displayName = 'proto.identity.authenticated.InboundKeysForUserRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.FindUserIDRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, proto.identity.authenticated.FindUserIDRequest.oneofGroups_); }; goog.inherits(proto.identity.authenticated.FindUserIDRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.FindUserIDRequest.displayName = 'proto.identity.authenticated.FindUserIDRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.FindUserIDResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.authenticated.FindUserIDResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.FindUserIDResponse.displayName = 'proto.identity.authenticated.FindUserIDResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.UpdateUserPasswordStartRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.authenticated.UpdateUserPasswordStartRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.UpdateUserPasswordStartRequest.displayName = 'proto.identity.authenticated.UpdateUserPasswordStartRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.UpdateUserPasswordFinishRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.authenticated.UpdateUserPasswordFinishRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.displayName = 'proto.identity.authenticated.UpdateUserPasswordFinishRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.authenticated.UpdateUserPasswordStartResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.authenticated.UpdateUserPasswordStartResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.authenticated.UpdateUserPasswordStartResponse.displayName = 'proto.identity.authenticated.UpdateUserPasswordStartResponse'; } /** * List of repeated fields within this message type. * @private {!Array} * @const */ proto.identity.authenticated.UploadOneTimeKeysRequest.repeatedFields_ = [1,2]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.UploadOneTimeKeysRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.UploadOneTimeKeysRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.UploadOneTimeKeysRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.UploadOneTimeKeysRequest.toObject = function(includeInstance, msg) { var f, obj = { contentonetimeprekeysList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f, notifonetimeprekeysList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.UploadOneTimeKeysRequest} */ proto.identity.authenticated.UploadOneTimeKeysRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.UploadOneTimeKeysRequest; return proto.identity.authenticated.UploadOneTimeKeysRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.UploadOneTimeKeysRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.UploadOneTimeKeysRequest} */ proto.identity.authenticated.UploadOneTimeKeysRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.addContentonetimeprekeys(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.addNotifonetimeprekeys(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.UploadOneTimeKeysRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.UploadOneTimeKeysRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.UploadOneTimeKeysRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.UploadOneTimeKeysRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getContentonetimeprekeysList(); if (f.length > 0) { writer.writeRepeatedString( 1, f ); } f = message.getNotifonetimeprekeysList(); if (f.length > 0) { writer.writeRepeatedString( 2, f ); } }; /** * repeated string contentOneTimePreKeys = 1; * @return {!Array} */ proto.identity.authenticated.UploadOneTimeKeysRequest.prototype.getContentonetimeprekeysList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** * @param {!Array} value * @return {!proto.identity.authenticated.UploadOneTimeKeysRequest} returns this */ proto.identity.authenticated.UploadOneTimeKeysRequest.prototype.setContentonetimeprekeysList = function(value) { return jspb.Message.setField(this, 1, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.authenticated.UploadOneTimeKeysRequest} returns this */ proto.identity.authenticated.UploadOneTimeKeysRequest.prototype.addContentonetimeprekeys = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** * Clears the list making it empty but non-null. * @return {!proto.identity.authenticated.UploadOneTimeKeysRequest} returns this */ proto.identity.authenticated.UploadOneTimeKeysRequest.prototype.clearContentonetimeprekeysList = function() { return this.setContentonetimeprekeysList([]); }; /** * repeated string notifOneTimePreKeys = 2; * @return {!Array} */ proto.identity.authenticated.UploadOneTimeKeysRequest.prototype.getNotifonetimeprekeysList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; /** * @param {!Array} value * @return {!proto.identity.authenticated.UploadOneTimeKeysRequest} returns this */ proto.identity.authenticated.UploadOneTimeKeysRequest.prototype.setNotifonetimeprekeysList = function(value) { return jspb.Message.setField(this, 2, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.authenticated.UploadOneTimeKeysRequest} returns this */ proto.identity.authenticated.UploadOneTimeKeysRequest.prototype.addNotifonetimeprekeys = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; /** * Clears the list making it empty but non-null. * @return {!proto.identity.authenticated.UploadOneTimeKeysRequest} returns this */ proto.identity.authenticated.UploadOneTimeKeysRequest.prototype.clearNotifonetimeprekeysList = function() { return this.setNotifonetimeprekeysList([]); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.RefreshUserPreKeysRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.RefreshUserPreKeysRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.RefreshUserPreKeysRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.RefreshUserPreKeysRequest.toObject = function(includeInstance, msg) { var f, obj = { newcontentprekeys: (f = msg.getNewcontentprekeys()) && identity_client_pb.PreKey.toObject(includeInstance, f), newnotifprekeys: (f = msg.getNewnotifprekeys()) && identity_client_pb.PreKey.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.RefreshUserPreKeysRequest} */ proto.identity.authenticated.RefreshUserPreKeysRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.RefreshUserPreKeysRequest; return proto.identity.authenticated.RefreshUserPreKeysRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.RefreshUserPreKeysRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.RefreshUserPreKeysRequest} */ proto.identity.authenticated.RefreshUserPreKeysRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new identity_client_pb.PreKey; reader.readMessage(value,identity_client_pb.PreKey.deserializeBinaryFromReader); msg.setNewcontentprekeys(value); break; case 2: var value = new identity_client_pb.PreKey; reader.readMessage(value,identity_client_pb.PreKey.deserializeBinaryFromReader); msg.setNewnotifprekeys(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.RefreshUserPreKeysRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.RefreshUserPreKeysRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.RefreshUserPreKeysRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.RefreshUserPreKeysRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNewcontentprekeys(); if (f != null) { writer.writeMessage( 1, f, identity_client_pb.PreKey.serializeBinaryToWriter ); } f = message.getNewnotifprekeys(); if (f != null) { writer.writeMessage( 2, f, identity_client_pb.PreKey.serializeBinaryToWriter ); } }; /** * optional identity.client.PreKey newContentPreKeys = 1; * @return {?proto.identity.client.PreKey} */ proto.identity.authenticated.RefreshUserPreKeysRequest.prototype.getNewcontentprekeys = function() { return /** @type{?proto.identity.client.PreKey} */ ( jspb.Message.getWrapperField(this, identity_client_pb.PreKey, 1)); }; /** * @param {?proto.identity.client.PreKey|undefined} value * @return {!proto.identity.authenticated.RefreshUserPreKeysRequest} returns this */ proto.identity.authenticated.RefreshUserPreKeysRequest.prototype.setNewcontentprekeys = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.authenticated.RefreshUserPreKeysRequest} returns this */ proto.identity.authenticated.RefreshUserPreKeysRequest.prototype.clearNewcontentprekeys = function() { return this.setNewcontentprekeys(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.RefreshUserPreKeysRequest.prototype.hasNewcontentprekeys = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional identity.client.PreKey newNotifPreKeys = 2; * @return {?proto.identity.client.PreKey} */ proto.identity.authenticated.RefreshUserPreKeysRequest.prototype.getNewnotifprekeys = function() { return /** @type{?proto.identity.client.PreKey} */ ( jspb.Message.getWrapperField(this, identity_client_pb.PreKey, 2)); }; /** * @param {?proto.identity.client.PreKey|undefined} value * @return {!proto.identity.authenticated.RefreshUserPreKeysRequest} returns this */ proto.identity.authenticated.RefreshUserPreKeysRequest.prototype.setNewnotifprekeys = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.authenticated.RefreshUserPreKeysRequest} returns this */ proto.identity.authenticated.RefreshUserPreKeysRequest.prototype.clearNewnotifprekeys = function() { return this.setNewnotifprekeys(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.RefreshUserPreKeysRequest.prototype.hasNewnotifprekeys = function() { return jspb.Message.getField(this, 2) != null; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.OutboundKeyInfo.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.OutboundKeyInfo.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.OutboundKeyInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.OutboundKeyInfo.toObject = function(includeInstance, msg) { var f, obj = { identityinfo: (f = msg.getIdentityinfo()) && identity_client_pb.IdentityKeyInfo.toObject(includeInstance, f), contentprekey: (f = msg.getContentprekey()) && identity_client_pb.PreKey.toObject(includeInstance, f), notifprekey: (f = msg.getNotifprekey()) && identity_client_pb.PreKey.toObject(includeInstance, f), onetimecontentprekey: jspb.Message.getFieldWithDefault(msg, 4, ""), onetimenotifprekey: jspb.Message.getFieldWithDefault(msg, 5, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.OutboundKeyInfo} */ proto.identity.authenticated.OutboundKeyInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.OutboundKeyInfo; return proto.identity.authenticated.OutboundKeyInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.OutboundKeyInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.OutboundKeyInfo} */ proto.identity.authenticated.OutboundKeyInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new identity_client_pb.IdentityKeyInfo; reader.readMessage(value,identity_client_pb.IdentityKeyInfo.deserializeBinaryFromReader); msg.setIdentityinfo(value); break; case 2: var value = new identity_client_pb.PreKey; reader.readMessage(value,identity_client_pb.PreKey.deserializeBinaryFromReader); msg.setContentprekey(value); break; case 3: var value = new identity_client_pb.PreKey; reader.readMessage(value,identity_client_pb.PreKey.deserializeBinaryFromReader); msg.setNotifprekey(value); break; case 4: var value = /** @type {string} */ (reader.readString()); msg.setOnetimecontentprekey(value); break; case 5: var value = /** @type {string} */ (reader.readString()); msg.setOnetimenotifprekey(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.OutboundKeyInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.OutboundKeyInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.OutboundKeyInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.OutboundKeyInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getIdentityinfo(); if (f != null) { writer.writeMessage( 1, f, identity_client_pb.IdentityKeyInfo.serializeBinaryToWriter ); } f = message.getContentprekey(); if (f != null) { writer.writeMessage( 2, f, identity_client_pb.PreKey.serializeBinaryToWriter ); } f = message.getNotifprekey(); if (f != null) { writer.writeMessage( 3, f, identity_client_pb.PreKey.serializeBinaryToWriter ); } f = /** @type {string} */ (jspb.Message.getField(message, 4)); if (f != null) { writer.writeString( 4, f ); } f = /** @type {string} */ (jspb.Message.getField(message, 5)); if (f != null) { writer.writeString( 5, f ); } }; /** * optional identity.client.IdentityKeyInfo identityInfo = 1; * @return {?proto.identity.client.IdentityKeyInfo} */ proto.identity.authenticated.OutboundKeyInfo.prototype.getIdentityinfo = function() { return /** @type{?proto.identity.client.IdentityKeyInfo} */ ( jspb.Message.getWrapperField(this, identity_client_pb.IdentityKeyInfo, 1)); }; /** * @param {?proto.identity.client.IdentityKeyInfo|undefined} value * @return {!proto.identity.authenticated.OutboundKeyInfo} returns this */ proto.identity.authenticated.OutboundKeyInfo.prototype.setIdentityinfo = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.authenticated.OutboundKeyInfo} returns this */ proto.identity.authenticated.OutboundKeyInfo.prototype.clearIdentityinfo = function() { return this.setIdentityinfo(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.OutboundKeyInfo.prototype.hasIdentityinfo = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional identity.client.PreKey contentPrekey = 2; * @return {?proto.identity.client.PreKey} */ proto.identity.authenticated.OutboundKeyInfo.prototype.getContentprekey = function() { return /** @type{?proto.identity.client.PreKey} */ ( jspb.Message.getWrapperField(this, identity_client_pb.PreKey, 2)); }; /** * @param {?proto.identity.client.PreKey|undefined} value * @return {!proto.identity.authenticated.OutboundKeyInfo} returns this */ proto.identity.authenticated.OutboundKeyInfo.prototype.setContentprekey = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.authenticated.OutboundKeyInfo} returns this */ proto.identity.authenticated.OutboundKeyInfo.prototype.clearContentprekey = function() { return this.setContentprekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.OutboundKeyInfo.prototype.hasContentprekey = function() { return jspb.Message.getField(this, 2) != null; }; /** * optional identity.client.PreKey notifPrekey = 3; * @return {?proto.identity.client.PreKey} */ proto.identity.authenticated.OutboundKeyInfo.prototype.getNotifprekey = function() { return /** @type{?proto.identity.client.PreKey} */ ( jspb.Message.getWrapperField(this, identity_client_pb.PreKey, 3)); }; /** * @param {?proto.identity.client.PreKey|undefined} value * @return {!proto.identity.authenticated.OutboundKeyInfo} returns this */ proto.identity.authenticated.OutboundKeyInfo.prototype.setNotifprekey = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.authenticated.OutboundKeyInfo} returns this */ proto.identity.authenticated.OutboundKeyInfo.prototype.clearNotifprekey = function() { return this.setNotifprekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.OutboundKeyInfo.prototype.hasNotifprekey = function() { return jspb.Message.getField(this, 3) != null; }; /** * optional string oneTimeContentPrekey = 4; * @return {string} */ proto.identity.authenticated.OutboundKeyInfo.prototype.getOnetimecontentprekey = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * @param {string} value * @return {!proto.identity.authenticated.OutboundKeyInfo} returns this */ proto.identity.authenticated.OutboundKeyInfo.prototype.setOnetimecontentprekey = function(value) { return jspb.Message.setField(this, 4, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.authenticated.OutboundKeyInfo} returns this */ proto.identity.authenticated.OutboundKeyInfo.prototype.clearOnetimecontentprekey = function() { return jspb.Message.setField(this, 4, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.OutboundKeyInfo.prototype.hasOnetimecontentprekey = function() { return jspb.Message.getField(this, 4) != null; }; /** * optional string oneTimeNotifPrekey = 5; * @return {string} */ proto.identity.authenticated.OutboundKeyInfo.prototype.getOnetimenotifprekey = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; /** * @param {string} value * @return {!proto.identity.authenticated.OutboundKeyInfo} returns this */ proto.identity.authenticated.OutboundKeyInfo.prototype.setOnetimenotifprekey = function(value) { return jspb.Message.setField(this, 5, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.authenticated.OutboundKeyInfo} returns this */ proto.identity.authenticated.OutboundKeyInfo.prototype.clearOnetimenotifprekey = function() { return jspb.Message.setField(this, 5, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.OutboundKeyInfo.prototype.hasOnetimenotifprekey = function() { return jspb.Message.getField(this, 5) != null; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.KeyserverKeysResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.KeyserverKeysResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.KeyserverKeysResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.KeyserverKeysResponse.toObject = function(includeInstance, msg) { var f, obj = { keyserverinfo: (f = msg.getKeyserverinfo()) && proto.identity.authenticated.OutboundKeyInfo.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.KeyserverKeysResponse} */ proto.identity.authenticated.KeyserverKeysResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.KeyserverKeysResponse; return proto.identity.authenticated.KeyserverKeysResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.KeyserverKeysResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.KeyserverKeysResponse} */ proto.identity.authenticated.KeyserverKeysResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.identity.authenticated.OutboundKeyInfo; reader.readMessage(value,proto.identity.authenticated.OutboundKeyInfo.deserializeBinaryFromReader); msg.setKeyserverinfo(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.KeyserverKeysResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.KeyserverKeysResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.KeyserverKeysResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.KeyserverKeysResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getKeyserverinfo(); if (f != null) { writer.writeMessage( 1, f, proto.identity.authenticated.OutboundKeyInfo.serializeBinaryToWriter ); } }; /** * optional OutboundKeyInfo keyserverInfo = 1; * @return {?proto.identity.authenticated.OutboundKeyInfo} */ proto.identity.authenticated.KeyserverKeysResponse.prototype.getKeyserverinfo = function() { return /** @type{?proto.identity.authenticated.OutboundKeyInfo} */ ( jspb.Message.getWrapperField(this, proto.identity.authenticated.OutboundKeyInfo, 1)); }; /** * @param {?proto.identity.authenticated.OutboundKeyInfo|undefined} value * @return {!proto.identity.authenticated.KeyserverKeysResponse} returns this */ proto.identity.authenticated.KeyserverKeysResponse.prototype.setKeyserverinfo = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.authenticated.KeyserverKeysResponse} returns this */ proto.identity.authenticated.KeyserverKeysResponse.prototype.clearKeyserverinfo = function() { return this.setKeyserverinfo(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.KeyserverKeysResponse.prototype.hasKeyserverinfo = function() { return jspb.Message.getField(this, 1) != null; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.OutboundKeysForUserResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.OutboundKeysForUserResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.OutboundKeysForUserResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.OutboundKeysForUserResponse.toObject = function(includeInstance, msg) { var f, obj = { devicesMap: (f = msg.getDevicesMap()) ? f.toObject(includeInstance, proto.identity.authenticated.OutboundKeyInfo.toObject) : [] }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.OutboundKeysForUserResponse} */ proto.identity.authenticated.OutboundKeysForUserResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.OutboundKeysForUserResponse; return proto.identity.authenticated.OutboundKeysForUserResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.OutboundKeysForUserResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.OutboundKeysForUserResponse} */ proto.identity.authenticated.OutboundKeysForUserResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = msg.getDevicesMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.identity.authenticated.OutboundKeyInfo.deserializeBinaryFromReader, "", new proto.identity.authenticated.OutboundKeyInfo()); }); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.OutboundKeysForUserResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.OutboundKeysForUserResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.OutboundKeysForUserResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.OutboundKeysForUserResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDevicesMap(true); if (f && f.getLength() > 0) { f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.identity.authenticated.OutboundKeyInfo.serializeBinaryToWriter); } }; /** * map devices = 1; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.identity.authenticated.OutboundKeysForUserResponse.prototype.getDevicesMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 1, opt_noLazyCreate, proto.identity.authenticated.OutboundKeyInfo)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.identity.authenticated.OutboundKeysForUserResponse} returns this */ proto.identity.authenticated.OutboundKeysForUserResponse.prototype.clearDevicesMap = function() { this.getDevicesMap().clear(); return this; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.OutboundKeysForUserRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.OutboundKeysForUserRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.OutboundKeysForUserRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.OutboundKeysForUserRequest.toObject = function(includeInstance, msg) { var f, obj = { userid: jspb.Message.getFieldWithDefault(msg, 1, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.OutboundKeysForUserRequest} */ proto.identity.authenticated.OutboundKeysForUserRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.OutboundKeysForUserRequest; return proto.identity.authenticated.OutboundKeysForUserRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.OutboundKeysForUserRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.OutboundKeysForUserRequest} */ proto.identity.authenticated.OutboundKeysForUserRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setUserid(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.OutboundKeysForUserRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.OutboundKeysForUserRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.OutboundKeysForUserRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.OutboundKeysForUserRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserid(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string userID = 1; * @return {string} */ proto.identity.authenticated.OutboundKeysForUserRequest.prototype.getUserid = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.authenticated.OutboundKeysForUserRequest} returns this */ proto.identity.authenticated.OutboundKeysForUserRequest.prototype.setUserid = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.InboundKeyInfo.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.InboundKeyInfo.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.InboundKeyInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.InboundKeyInfo.toObject = function(includeInstance, msg) { var f, obj = { identityinfo: (f = msg.getIdentityinfo()) && identity_client_pb.IdentityKeyInfo.toObject(includeInstance, f), contentprekey: (f = msg.getContentprekey()) && identity_client_pb.PreKey.toObject(includeInstance, f), notifprekey: (f = msg.getNotifprekey()) && identity_client_pb.PreKey.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.InboundKeyInfo} */ proto.identity.authenticated.InboundKeyInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.InboundKeyInfo; return proto.identity.authenticated.InboundKeyInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.InboundKeyInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.InboundKeyInfo} */ proto.identity.authenticated.InboundKeyInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new identity_client_pb.IdentityKeyInfo; reader.readMessage(value,identity_client_pb.IdentityKeyInfo.deserializeBinaryFromReader); msg.setIdentityinfo(value); break; case 2: var value = new identity_client_pb.PreKey; reader.readMessage(value,identity_client_pb.PreKey.deserializeBinaryFromReader); msg.setContentprekey(value); break; case 3: var value = new identity_client_pb.PreKey; reader.readMessage(value,identity_client_pb.PreKey.deserializeBinaryFromReader); msg.setNotifprekey(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.InboundKeyInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.InboundKeyInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.InboundKeyInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.InboundKeyInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getIdentityinfo(); if (f != null) { writer.writeMessage( 1, f, identity_client_pb.IdentityKeyInfo.serializeBinaryToWriter ); } f = message.getContentprekey(); if (f != null) { writer.writeMessage( 2, f, identity_client_pb.PreKey.serializeBinaryToWriter ); } f = message.getNotifprekey(); if (f != null) { writer.writeMessage( 3, f, identity_client_pb.PreKey.serializeBinaryToWriter ); } }; /** * optional identity.client.IdentityKeyInfo identityInfo = 1; * @return {?proto.identity.client.IdentityKeyInfo} */ proto.identity.authenticated.InboundKeyInfo.prototype.getIdentityinfo = function() { return /** @type{?proto.identity.client.IdentityKeyInfo} */ ( jspb.Message.getWrapperField(this, identity_client_pb.IdentityKeyInfo, 1)); }; /** * @param {?proto.identity.client.IdentityKeyInfo|undefined} value * @return {!proto.identity.authenticated.InboundKeyInfo} returns this */ proto.identity.authenticated.InboundKeyInfo.prototype.setIdentityinfo = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.authenticated.InboundKeyInfo} returns this */ proto.identity.authenticated.InboundKeyInfo.prototype.clearIdentityinfo = function() { return this.setIdentityinfo(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.InboundKeyInfo.prototype.hasIdentityinfo = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional identity.client.PreKey contentPrekey = 2; * @return {?proto.identity.client.PreKey} */ proto.identity.authenticated.InboundKeyInfo.prototype.getContentprekey = function() { return /** @type{?proto.identity.client.PreKey} */ ( jspb.Message.getWrapperField(this, identity_client_pb.PreKey, 2)); }; /** * @param {?proto.identity.client.PreKey|undefined} value * @return {!proto.identity.authenticated.InboundKeyInfo} returns this */ proto.identity.authenticated.InboundKeyInfo.prototype.setContentprekey = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.authenticated.InboundKeyInfo} returns this */ proto.identity.authenticated.InboundKeyInfo.prototype.clearContentprekey = function() { return this.setContentprekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.InboundKeyInfo.prototype.hasContentprekey = function() { return jspb.Message.getField(this, 2) != null; }; /** * optional identity.client.PreKey notifPrekey = 3; * @return {?proto.identity.client.PreKey} */ proto.identity.authenticated.InboundKeyInfo.prototype.getNotifprekey = function() { return /** @type{?proto.identity.client.PreKey} */ ( jspb.Message.getWrapperField(this, identity_client_pb.PreKey, 3)); }; /** * @param {?proto.identity.client.PreKey|undefined} value * @return {!proto.identity.authenticated.InboundKeyInfo} returns this */ proto.identity.authenticated.InboundKeyInfo.prototype.setNotifprekey = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.authenticated.InboundKeyInfo} returns this */ proto.identity.authenticated.InboundKeyInfo.prototype.clearNotifprekey = function() { return this.setNotifprekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.InboundKeyInfo.prototype.hasNotifprekey = function() { return jspb.Message.getField(this, 3) != null; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.InboundKeysForUserResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.InboundKeysForUserResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.InboundKeysForUserResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.InboundKeysForUserResponse.toObject = function(includeInstance, msg) { var f, obj = { devicesMap: (f = msg.getDevicesMap()) ? f.toObject(includeInstance, proto.identity.authenticated.InboundKeyInfo.toObject) : [] }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.InboundKeysForUserResponse} */ proto.identity.authenticated.InboundKeysForUserResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.InboundKeysForUserResponse; return proto.identity.authenticated.InboundKeysForUserResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.InboundKeysForUserResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.InboundKeysForUserResponse} */ proto.identity.authenticated.InboundKeysForUserResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = msg.getDevicesMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.identity.authenticated.InboundKeyInfo.deserializeBinaryFromReader, "", new proto.identity.authenticated.InboundKeyInfo()); }); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.InboundKeysForUserResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.InboundKeysForUserResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.InboundKeysForUserResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.InboundKeysForUserResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDevicesMap(true); if (f && f.getLength() > 0) { f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.identity.authenticated.InboundKeyInfo.serializeBinaryToWriter); } }; /** * map devices = 1; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.identity.authenticated.InboundKeysForUserResponse.prototype.getDevicesMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 1, opt_noLazyCreate, proto.identity.authenticated.InboundKeyInfo)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.identity.authenticated.InboundKeysForUserResponse} returns this */ proto.identity.authenticated.InboundKeysForUserResponse.prototype.clearDevicesMap = function() { this.getDevicesMap().clear(); return this; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.InboundKeysForUserRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.InboundKeysForUserRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.InboundKeysForUserRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.InboundKeysForUserRequest.toObject = function(includeInstance, msg) { var f, obj = { userid: jspb.Message.getFieldWithDefault(msg, 1, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.InboundKeysForUserRequest} */ proto.identity.authenticated.InboundKeysForUserRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.InboundKeysForUserRequest; return proto.identity.authenticated.InboundKeysForUserRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.InboundKeysForUserRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.InboundKeysForUserRequest} */ proto.identity.authenticated.InboundKeysForUserRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setUserid(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.InboundKeysForUserRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.InboundKeysForUserRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.InboundKeysForUserRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.InboundKeysForUserRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserid(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string userID = 1; * @return {string} */ proto.identity.authenticated.InboundKeysForUserRequest.prototype.getUserid = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.authenticated.InboundKeysForUserRequest} returns this */ proto.identity.authenticated.InboundKeysForUserRequest.prototype.setUserid = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * Oneof group definitions for this message. Each group defines the field * numbers belonging to that group. When of these fields' value is set, all * other fields in the group are cleared. During deserialization, if multiple * fields are encountered for a group, only the last value seen will be kept. * @private {!Array>} * @const */ proto.identity.authenticated.FindUserIDRequest.oneofGroups_ = [[1,2]]; /** * @enum {number} */ proto.identity.authenticated.FindUserIDRequest.IdentifierCase = { IDENTIFIER_NOT_SET: 0, USERNAME: 1, WALLETADDRESS: 2 }; /** * @return {proto.identity.authenticated.FindUserIDRequest.IdentifierCase} */ proto.identity.authenticated.FindUserIDRequest.prototype.getIdentifierCase = function() { return /** @type {proto.identity.authenticated.FindUserIDRequest.IdentifierCase} */(jspb.Message.computeOneofCase(this, proto.identity.authenticated.FindUserIDRequest.oneofGroups_[0])); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.FindUserIDRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.FindUserIDRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.FindUserIDRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.FindUserIDRequest.toObject = function(includeInstance, msg) { var f, obj = { username: jspb.Message.getFieldWithDefault(msg, 1, ""), walletaddress: jspb.Message.getFieldWithDefault(msg, 2, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.FindUserIDRequest} */ proto.identity.authenticated.FindUserIDRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.FindUserIDRequest; return proto.identity.authenticated.FindUserIDRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.FindUserIDRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.FindUserIDRequest} */ proto.identity.authenticated.FindUserIDRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setUsername(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setWalletaddress(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.FindUserIDRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.FindUserIDRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.FindUserIDRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.FindUserIDRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { writer.writeString( 1, f ); } f = /** @type {string} */ (jspb.Message.getField(message, 2)); if (f != null) { writer.writeString( 2, f ); } }; /** * optional string username = 1; * @return {string} */ proto.identity.authenticated.FindUserIDRequest.prototype.getUsername = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.authenticated.FindUserIDRequest} returns this */ proto.identity.authenticated.FindUserIDRequest.prototype.setUsername = function(value) { return jspb.Message.setOneofField(this, 1, proto.identity.authenticated.FindUserIDRequest.oneofGroups_[0], value); }; /** * Clears the field making it undefined. * @return {!proto.identity.authenticated.FindUserIDRequest} returns this */ proto.identity.authenticated.FindUserIDRequest.prototype.clearUsername = function() { return jspb.Message.setOneofField(this, 1, proto.identity.authenticated.FindUserIDRequest.oneofGroups_[0], undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.FindUserIDRequest.prototype.hasUsername = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional string walletAddress = 2; * @return {string} */ proto.identity.authenticated.FindUserIDRequest.prototype.getWalletaddress = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.authenticated.FindUserIDRequest} returns this */ proto.identity.authenticated.FindUserIDRequest.prototype.setWalletaddress = function(value) { return jspb.Message.setOneofField(this, 2, proto.identity.authenticated.FindUserIDRequest.oneofGroups_[0], value); }; /** * Clears the field making it undefined. * @return {!proto.identity.authenticated.FindUserIDRequest} returns this */ proto.identity.authenticated.FindUserIDRequest.prototype.clearWalletaddress = function() { return jspb.Message.setOneofField(this, 2, proto.identity.authenticated.FindUserIDRequest.oneofGroups_[0], undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.FindUserIDRequest.prototype.hasWalletaddress = function() { return jspb.Message.getField(this, 2) != null; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.FindUserIDResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.FindUserIDResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.FindUserIDResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.FindUserIDResponse.toObject = function(includeInstance, msg) { var f, obj = { userid: jspb.Message.getFieldWithDefault(msg, 1, ""), isReserved: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.FindUserIDResponse} */ proto.identity.authenticated.FindUserIDResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.FindUserIDResponse; return proto.identity.authenticated.FindUserIDResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.FindUserIDResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.FindUserIDResponse} */ proto.identity.authenticated.FindUserIDResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setUserid(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); msg.setIsReserved(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.FindUserIDResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.FindUserIDResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.FindUserIDResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.FindUserIDResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { writer.writeString( 1, f ); } f = message.getIsReserved(); if (f) { writer.writeBool( 2, f ); } }; /** * optional string userID = 1; * @return {string} */ proto.identity.authenticated.FindUserIDResponse.prototype.getUserid = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.authenticated.FindUserIDResponse} returns this */ proto.identity.authenticated.FindUserIDResponse.prototype.setUserid = function(value) { return jspb.Message.setField(this, 1, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.authenticated.FindUserIDResponse} returns this */ proto.identity.authenticated.FindUserIDResponse.prototype.clearUserid = function() { return jspb.Message.setField(this, 1, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.authenticated.FindUserIDResponse.prototype.hasUserid = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional bool is_reserved = 2; * @return {boolean} */ proto.identity.authenticated.FindUserIDResponse.prototype.getIsReserved = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** * @param {boolean} value * @return {!proto.identity.authenticated.FindUserIDResponse} returns this */ proto.identity.authenticated.FindUserIDResponse.prototype.setIsReserved = function(value) { return jspb.Message.setProto3BooleanField(this, 2, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.UpdateUserPasswordStartRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.UpdateUserPasswordStartRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.UpdateUserPasswordStartRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.UpdateUserPasswordStartRequest.toObject = function(includeInstance, msg) { var f, obj = { opaqueregistrationrequest: msg.getOpaqueregistrationrequest_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.UpdateUserPasswordStartRequest} */ proto.identity.authenticated.UpdateUserPasswordStartRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.UpdateUserPasswordStartRequest; return proto.identity.authenticated.UpdateUserPasswordStartRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.UpdateUserPasswordStartRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.UpdateUserPasswordStartRequest} */ proto.identity.authenticated.UpdateUserPasswordStartRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setOpaqueregistrationrequest(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.UpdateUserPasswordStartRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.UpdateUserPasswordStartRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.UpdateUserPasswordStartRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.UpdateUserPasswordStartRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getOpaqueregistrationrequest_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } }; /** * optional bytes opaqueRegistrationRequest = 1; * @return {string} */ proto.identity.authenticated.UpdateUserPasswordStartRequest.prototype.getOpaqueregistrationrequest = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * optional bytes opaqueRegistrationRequest = 1; * This is a type-conversion wrapper around `getOpaqueregistrationrequest()` * @return {string} */ proto.identity.authenticated.UpdateUserPasswordStartRequest.prototype.getOpaqueregistrationrequest_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getOpaqueregistrationrequest())); }; /** * optional bytes opaqueRegistrationRequest = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getOpaqueregistrationrequest()` * @return {!Uint8Array} */ proto.identity.authenticated.UpdateUserPasswordStartRequest.prototype.getOpaqueregistrationrequest_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueregistrationrequest())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.authenticated.UpdateUserPasswordStartRequest} returns this */ proto.identity.authenticated.UpdateUserPasswordStartRequest.prototype.setOpaqueregistrationrequest = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.UpdateUserPasswordFinishRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.UpdateUserPasswordFinishRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.toObject = function(includeInstance, msg) { var f, obj = { sessionid: jspb.Message.getFieldWithDefault(msg, 1, ""), opaqueregistrationupload: msg.getOpaqueregistrationupload_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.UpdateUserPasswordFinishRequest} */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.UpdateUserPasswordFinishRequest; return proto.identity.authenticated.UpdateUserPasswordFinishRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.UpdateUserPasswordFinishRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.UpdateUserPasswordFinishRequest} */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setSessionid(value); break; case 2: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setOpaqueregistrationupload(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.UpdateUserPasswordFinishRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.UpdateUserPasswordFinishRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getSessionid(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getOpaqueregistrationupload_asU8(); if (f.length > 0) { writer.writeBytes( 2, f ); } }; /** * optional string sessionID = 1; * @return {string} */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.prototype.getSessionid = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.authenticated.UpdateUserPasswordFinishRequest} returns this */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.prototype.setSessionid = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaqueRegistrationUpload = 2; * @return {string} */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.prototype.getOpaqueregistrationupload = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * optional bytes opaqueRegistrationUpload = 2; * This is a type-conversion wrapper around `getOpaqueregistrationupload()` * @return {string} */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.prototype.getOpaqueregistrationupload_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getOpaqueregistrationupload())); }; /** * optional bytes opaqueRegistrationUpload = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getOpaqueregistrationupload()` * @return {!Uint8Array} */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.prototype.getOpaqueregistrationupload_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueregistrationupload())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.authenticated.UpdateUserPasswordFinishRequest} returns this */ proto.identity.authenticated.UpdateUserPasswordFinishRequest.prototype.setOpaqueregistrationupload = function(value) { return jspb.Message.setProto3BytesField(this, 2, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.authenticated.UpdateUserPasswordStartResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.authenticated.UpdateUserPasswordStartResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.authenticated.UpdateUserPasswordStartResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.UpdateUserPasswordStartResponse.toObject = function(includeInstance, msg) { var f, obj = { sessionid: jspb.Message.getFieldWithDefault(msg, 1, ""), opaqueregistrationresponse: msg.getOpaqueregistrationresponse_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.authenticated.UpdateUserPasswordStartResponse} */ proto.identity.authenticated.UpdateUserPasswordStartResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.authenticated.UpdateUserPasswordStartResponse; return proto.identity.authenticated.UpdateUserPasswordStartResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.authenticated.UpdateUserPasswordStartResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.authenticated.UpdateUserPasswordStartResponse} */ proto.identity.authenticated.UpdateUserPasswordStartResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setSessionid(value); break; case 2: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setOpaqueregistrationresponse(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.authenticated.UpdateUserPasswordStartResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.authenticated.UpdateUserPasswordStartResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.authenticated.UpdateUserPasswordStartResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.authenticated.UpdateUserPasswordStartResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getSessionid(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getOpaqueregistrationresponse_asU8(); if (f.length > 0) { writer.writeBytes( 2, f ); } }; /** * optional string sessionID = 1; * @return {string} */ proto.identity.authenticated.UpdateUserPasswordStartResponse.prototype.getSessionid = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.authenticated.UpdateUserPasswordStartResponse} returns this */ proto.identity.authenticated.UpdateUserPasswordStartResponse.prototype.setSessionid = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaqueRegistrationResponse = 2; * @return {string} */ proto.identity.authenticated.UpdateUserPasswordStartResponse.prototype.getOpaqueregistrationresponse = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * optional bytes opaqueRegistrationResponse = 2; * This is a type-conversion wrapper around `getOpaqueregistrationresponse()` * @return {string} */ proto.identity.authenticated.UpdateUserPasswordStartResponse.prototype.getOpaqueregistrationresponse_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getOpaqueregistrationresponse())); }; /** * optional bytes opaqueRegistrationResponse = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getOpaqueregistrationresponse()` * @return {!Uint8Array} */ proto.identity.authenticated.UpdateUserPasswordStartResponse.prototype.getOpaqueregistrationresponse_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueregistrationresponse())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.authenticated.UpdateUserPasswordStartResponse} returns this */ proto.identity.authenticated.UpdateUserPasswordStartResponse.prototype.setOpaqueregistrationresponse = function(value) { return jspb.Message.setProto3BytesField(this, 2, value); }; goog.object.extend(exports, proto.identity.authenticated); diff --git a/web/protobufs/identity-auth-structs.cjs.flow b/web/protobufs/identity-auth-structs.cjs.flow index 1e977122a..d9531c003 100644 --- a/web/protobufs/identity-auth-structs.cjs.flow +++ b/web/protobufs/identity-auth-structs.cjs.flow @@ -1,338 +1,338 @@ // @flow import { Message, BinaryWriter, BinaryReader, Map as ProtoMap, } from 'google-protobuf'; -import * as identityStructs from './identity-structs.cjs'; +import * as identityStructs from './identity-unauth-structs.cjs'; declare export class UploadOneTimeKeysRequest extends Message { getContentonetimeprekeysList(): Array; setContentonetimeprekeysList(value: Array): UploadOneTimeKeysRequest; clearContentonetimeprekeysList(): UploadOneTimeKeysRequest; addContentonetimeprekeys(value: string, index?: number): UploadOneTimeKeysRequest; getNotifonetimeprekeysList(): Array; setNotifonetimeprekeysList(value: Array): UploadOneTimeKeysRequest; clearNotifonetimeprekeysList(): UploadOneTimeKeysRequest; addNotifonetimeprekeys(value: string, index?: number): UploadOneTimeKeysRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UploadOneTimeKeysRequestObject; static toObject(includeInstance: boolean, msg: UploadOneTimeKeysRequest): UploadOneTimeKeysRequestObject; static serializeBinaryToWriter(message: UploadOneTimeKeysRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UploadOneTimeKeysRequest; static deserializeBinaryFromReader(message: UploadOneTimeKeysRequest, reader: BinaryReader): UploadOneTimeKeysRequest; } export type UploadOneTimeKeysRequestObject = { contentonetimeprekeysList: Array, notifonetimeprekeysList: Array, }; declare export class RefreshUserPreKeysRequest extends Message { getNewcontentprekeys(): identityStructs.PreKey | void; setNewcontentprekeys(value?: identityStructs.PreKey): RefreshUserPreKeysRequest; hasNewcontentprekeys(): boolean; clearNewcontentprekeys(): RefreshUserPreKeysRequest; getNewnotifprekeys(): identityStructs.PreKey | void; setNewnotifprekeys(value?: identityStructs.PreKey): RefreshUserPreKeysRequest; hasNewnotifprekeys(): boolean; clearNewnotifprekeys(): RefreshUserPreKeysRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): RefreshUserPreKeysRequestObject; static toObject(includeInstance: boolean, msg: RefreshUserPreKeysRequest): RefreshUserPreKeysRequestObject; static serializeBinaryToWriter(message: RefreshUserPreKeysRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): RefreshUserPreKeysRequest; static deserializeBinaryFromReader(message: RefreshUserPreKeysRequest, reader: BinaryReader): RefreshUserPreKeysRequest; } export type RefreshUserPreKeysRequestObject = { newcontentprekeys?: identityStructs.PreKeyObject, newnotifprekeys?: identityStructs.PreKeyObject, } declare export class OutboundKeyInfo extends Message { getIdentityinfo(): identityStructs.IdentityKeyInfo | void; setIdentityinfo(value?: identityStructs.IdentityKeyInfo): OutboundKeyInfo; hasIdentityinfo(): boolean; clearIdentityinfo(): OutboundKeyInfo; getContentprekey(): identityStructs.PreKey | void; setContentprekey(value?: identityStructs.PreKey): OutboundKeyInfo; hasContentprekey(): boolean; clearContentprekey(): OutboundKeyInfo; getNotifprekey(): identityStructs.PreKey | void; setNotifprekey(value?: identityStructs.PreKey): OutboundKeyInfo; hasNotifprekey(): boolean; clearNotifprekey(): OutboundKeyInfo; getOnetimecontentprekey(): string; setOnetimecontentprekey(value: string): OutboundKeyInfo; hasOnetimecontentprekey(): boolean; clearOnetimecontentprekey(): OutboundKeyInfo; getOnetimenotifprekey(): string; setOnetimenotifprekey(value: string): OutboundKeyInfo; hasOnetimenotifprekey(): boolean; clearOnetimenotifprekey(): OutboundKeyInfo; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): OutboundKeyInfoObject; static toObject(includeInstance: boolean, msg: OutboundKeyInfo): OutboundKeyInfoObject; static serializeBinaryToWriter(message: OutboundKeyInfo, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): OutboundKeyInfo; static deserializeBinaryFromReader(message: OutboundKeyInfo, reader: BinaryReader): OutboundKeyInfo; } export type OutboundKeyInfoObject = { identityinfo?: identityStructs.IdentityKeyInfoObject, contentprekey?: identityStructs.PreKeyObject, notifprekey?: identityStructs.PreKeyObject, onetimecontentprekey?: string, onetimenotifprekey?: string, }; declare export class KeyserverKeysResponse extends Message { getKeyserverinfo(): OutboundKeyInfo | void; setKeyserverinfo(value?: OutboundKeyInfo): KeyserverKeysResponse; hasKeyserverinfo(): boolean; clearKeyserverinfo(): KeyserverKeysResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): KeyserverKeysResponseObject; static toObject(includeInstance: boolean, msg: KeyserverKeysResponse): KeyserverKeysResponseObject; static serializeBinaryToWriter(message: KeyserverKeysResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): KeyserverKeysResponse; static deserializeBinaryFromReader(message: KeyserverKeysResponse, reader: BinaryReader): KeyserverKeysResponse; } export type KeyserverKeysResponseObject = { keyserverinfo?: OutboundKeyInfoObject, }; declare export class OutboundKeysForUserResponse extends Message { getDevicesMap(): ProtoMap; clearDevicesMap(): OutboundKeysForUserResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): OutboundKeysForUserResponseObject; static toObject(includeInstance: boolean, msg: OutboundKeysForUserResponse): OutboundKeysForUserResponseObject; static serializeBinaryToWriter(message: OutboundKeysForUserResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): OutboundKeysForUserResponse; static deserializeBinaryFromReader(message: OutboundKeysForUserResponse, reader: BinaryReader): OutboundKeysForUserResponse; } export type OutboundKeysForUserResponseObject = { devicesMap: Array<[string, OutboundKeyInfoObject]>, }; declare export class OutboundKeysForUserRequest extends Message { getUserid(): string; setUserid(value: string): OutboundKeysForUserRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): OutboundKeysForUserRequestObject; static toObject(includeInstance: boolean, msg: OutboundKeysForUserRequest): OutboundKeysForUserRequestObject; static serializeBinaryToWriter(message: OutboundKeysForUserRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): OutboundKeysForUserRequest; static deserializeBinaryFromReader(message: OutboundKeysForUserRequest, reader: BinaryReader): OutboundKeysForUserRequest; } export type OutboundKeysForUserRequestObject = { userid: string, }; declare export class InboundKeyInfo extends Message { getIdentityinfo(): identityStructs.IdentityKeyInfo | void; setIdentityinfo(value?: identityStructs.IdentityKeyInfo): InboundKeyInfo; hasIdentityinfo(): boolean; clearIdentityinfo(): InboundKeyInfo; getContentprekey(): identityStructs.PreKey | void; setContentprekey(value?: identityStructs.PreKey): InboundKeyInfo; hasContentprekey(): boolean; clearContentprekey(): InboundKeyInfo; getNotifprekey(): identityStructs.PreKey | void; setNotifprekey(value?: identityStructs.PreKey): InboundKeyInfo; hasNotifprekey(): boolean; clearNotifprekey(): InboundKeyInfo; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): InboundKeyInfoObject; static toObject(includeInstance: boolean, msg: InboundKeyInfo): InboundKeyInfoObject; static serializeBinaryToWriter(message: InboundKeyInfo, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): InboundKeyInfo; static deserializeBinaryFromReader(message: InboundKeyInfo, reader: BinaryReader): InboundKeyInfo; } export type InboundKeyInfoObject = { identityinfo?: identityStructs.IdentityKeyInfoObject, contentprekey?: identityStructs.PreKeyObject, notifprekey?: identityStructs.PreKeyObject, }; declare export class InboundKeysForUserResponse extends Message { getDevicesMap(): ProtoMap; clearDevicesMap(): InboundKeysForUserResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): InboundKeysForUserResponseObject; static toObject(includeInstance: boolean, msg: InboundKeysForUserResponse): InboundKeysForUserResponseObject; static serializeBinaryToWriter(message: InboundKeysForUserResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): InboundKeysForUserResponse; static deserializeBinaryFromReader(message: InboundKeysForUserResponse, reader: BinaryReader): InboundKeysForUserResponse; } export type InboundKeysForUserResponseObject = { devicesMap: Array<[string, InboundKeyInfoObject]>, } declare export class InboundKeysForUserRequest extends Message { getUsername(): string; setUsername(value: string): InboundKeysForUserRequest; getWalletaddress(): string; setWalletaddress(value: string): InboundKeysForUserRequest; getIdentifierCase(): IdentifierCase; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): InboundKeysForUserRequestObject; static toObject(includeInstance: boolean, msg: InboundKeysForUserRequest): InboundKeysForUserRequestObject; static serializeBinaryToWriter(message: InboundKeysForUserRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): InboundKeysForUserRequest; static deserializeBinaryFromReader(message: InboundKeysForUserRequest, reader: BinaryReader): InboundKeysForUserRequest; } export type InboundKeysForUserRequestObject = { userid: string, }; export type IdentifierCase = 0 | 1 | 2; declare export class FindUserIDRequest extends Message { getUsername(): string; setUsername(value: string): FindUserIDRequest; getWalletaddress(): string; setWalletaddress(value: string): FindUserIDRequest; getIdentifierCase(): IdentifierCase; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): FindUserIDRequestObject; static toObject(includeInstance: boolean, msg: FindUserIDRequest): FindUserIDRequestObject; static serializeBinaryToWriter(message: FindUserIDRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): FindUserIDRequest; static deserializeBinaryFromReader(message: FindUserIDRequest, reader: BinaryReader): FindUserIDRequest; } export type FindUserIDRequestObject = { username: string, walletaddress: string, } declare export class FindUserIDResponse extends Message { getUserid(): string; setUserid(value: string): FindUserIDResponse; hasUserid(): boolean; clearUserid(): FindUserIDResponse; getIsReserved(): boolean; setIsReserved(value: boolean): FindUserIDResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): FindUserIDResponseObject; static toObject(includeInstance: boolean, msg: FindUserIDResponse): FindUserIDResponseObject; static serializeBinaryToWriter(message: FindUserIDResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): FindUserIDResponse; static deserializeBinaryFromReader(message: FindUserIDResponse, reader: BinaryReader): FindUserIDResponse; } export type FindUserIDResponseObject = { userid?: string, isReserved: boolean, } declare export class UpdateUserPasswordStartRequest extends Message { getOpaqueregistrationrequest(): Uint8Array | string; getOpaqueregistrationrequest_asU8(): Uint8Array; getOpaqueregistrationrequest_asB64(): string; setOpaqueregistrationrequest(value: Uint8Array | string): UpdateUserPasswordStartRequest; getAccesstoken(): string; setAccesstoken(value: string): UpdateUserPasswordStartRequest; getUserid(): string; setUserid(value: string): UpdateUserPasswordStartRequest; getDeviceidkey(): string; setDeviceidkey(value: string): UpdateUserPasswordStartRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UpdateUserPasswordStartRequestObject; static toObject(includeInstance: boolean, msg: UpdateUserPasswordStartRequest): UpdateUserPasswordStartRequestObject; static serializeBinaryToWriter(message: UpdateUserPasswordStartRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UpdateUserPasswordStartRequest; static deserializeBinaryFromReader(message: UpdateUserPasswordStartRequest, reader: BinaryReader): UpdateUserPasswordStartRequest; } export type UpdateUserPasswordStartRequestObject = { opaqueregistrationrequest: Uint8Array | string, accesstoken: string, userid: string, deviceidkey: string, }; declare export class UpdateUserPasswordFinishRequest extends Message { getSessionid(): string; setSessionid(value: string): UpdateUserPasswordFinishRequest; getOpaqueregistrationupload(): Uint8Array | string; getOpaqueregistrationupload_asU8(): Uint8Array; getOpaqueregistrationupload_asB64(): string; setOpaqueregistrationupload(value: Uint8Array | string): UpdateUserPasswordFinishRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UpdateUserPasswordFinishRequestObject; static toObject(includeInstance: boolean, msg: UpdateUserPasswordFinishRequest): UpdateUserPasswordFinishRequestObject; static serializeBinaryToWriter(message: UpdateUserPasswordFinishRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UpdateUserPasswordFinishRequest; static deserializeBinaryFromReader(message: UpdateUserPasswordFinishRequest, reader: BinaryReader): UpdateUserPasswordFinishRequest; } export type UpdateUserPasswordFinishRequestObject = { sessionid: string, opaqueregistrationupload: Uint8Array | string, }; declare export class UpdateUserPasswordStartResponse extends Message { getSessionid(): string; setSessionid(value: string): UpdateUserPasswordStartResponse; getOpaqueregistrationresponse(): Uint8Array | string; getOpaqueregistrationresponse_asU8(): Uint8Array; getOpaqueregistrationresponse_asB64(): string; setOpaqueregistrationresponse(value: Uint8Array | string): UpdateUserPasswordStartResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UpdateUserPasswordStartResponseObject; static toObject(includeInstance: boolean, msg: UpdateUserPasswordStartResponse): UpdateUserPasswordStartResponseObject; static serializeBinaryToWriter(message: UpdateUserPasswordStartResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UpdateUserPasswordStartResponse; static deserializeBinaryFromReader(message: UpdateUserPasswordStartResponse, reader: BinaryReader): UpdateUserPasswordStartResponse; } export type UpdateUserPasswordStartResponseObject = { sessionid: string, opaqueregistrationresponse: Uint8Array | string, }; diff --git a/web/protobufs/identity-structs.cjs b/web/protobufs/identity-unauth-structs.cjs similarity index 100% rename from web/protobufs/identity-structs.cjs rename to web/protobufs/identity-unauth-structs.cjs diff --git a/web/protobufs/identity-structs.cjs.flow b/web/protobufs/identity-unauth-structs.cjs.flow similarity index 100% rename from web/protobufs/identity-structs.cjs.flow rename to web/protobufs/identity-unauth-structs.cjs.flow diff --git a/web/protobufs/identity-client.cjs b/web/protobufs/identity-unauth.cjs similarity index 99% rename from web/protobufs/identity-client.cjs rename to web/protobufs/identity-unauth.cjs index 0a0b7e47d..d1cf07b09 100644 --- a/web/protobufs/identity-client.cjs +++ b/web/protobufs/identity-unauth.cjs @@ -1,811 +1,811 @@ /** * @fileoverview gRPC-Web generated client stub for identity.client * @enhanceable * @public * @generated */ // Code generated by protoc-gen-grpc-web. DO NOT EDIT. // versions: // protoc-gen-grpc-web v1.4.2 // protoc v3.21.12 // source: identity_client.proto /* eslint-disable */ // @ts-nocheck const grpc = {}; grpc.web = require('grpc-web'); const proto = {}; proto.identity = {}; -proto.identity.client = require('./identity-structs.cjs'); +proto.identity.client = require('./identity-unauth-structs.cjs'); /** * @param {string} hostname * @param {?Object} credentials * @param {?grpc.web.ClientOptions} options * @constructor * @struct * @final */ proto.identity.client.IdentityClientServiceClient = function(hostname, credentials, options) { if (!options) options = {}; options.format = 'text'; /** * @private @const {!grpc.web.GrpcWebClientBase} The client */ this.client_ = new grpc.web.GrpcWebClientBase(options); /** * @private @const {string} The hostname */ this.hostname_ = hostname.replace(/\/+$/, ''); }; /** * @param {string} hostname * @param {?Object} credentials * @param {?grpc.web.ClientOptions} options * @constructor * @struct * @final */ proto.identity.client.IdentityClientServicePromiseClient = function(hostname, credentials, options) { if (!options) options = {}; options.format = 'text'; /** * @private @const {!grpc.web.GrpcWebClientBase} The client */ this.client_ = new grpc.web.GrpcWebClientBase(options); /** * @private @const {string} The hostname */ this.hostname_ = hostname.replace(/\/+$/, ''); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.RegistrationStartRequest, * !proto.identity.client.RegistrationStartResponse>} */ const methodDescriptor_IdentityClientService_RegisterPasswordUserStart = new grpc.web.MethodDescriptor( '/identity.client.IdentityClientService/RegisterPasswordUserStart', grpc.web.MethodType.UNARY, proto.identity.client.RegistrationStartRequest, proto.identity.client.RegistrationStartResponse, /** * @param {!proto.identity.client.RegistrationStartRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.client.RegistrationStartResponse.deserializeBinary ); /** * @param {!proto.identity.client.RegistrationStartRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.RegistrationStartResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.client.IdentityClientServiceClient.prototype.registerPasswordUserStart = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.client.IdentityClientService/RegisterPasswordUserStart', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterPasswordUserStart, callback); }; /** * @param {!proto.identity.client.RegistrationStartRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.client.IdentityClientServicePromiseClient.prototype.registerPasswordUserStart = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.client.IdentityClientService/RegisterPasswordUserStart', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterPasswordUserStart); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.ReservedRegistrationStartRequest, * !proto.identity.client.RegistrationStartResponse>} */ const methodDescriptor_IdentityClientService_RegisterReservedPasswordUserStart = new grpc.web.MethodDescriptor( '/identity.client.IdentityClientService/RegisterReservedPasswordUserStart', grpc.web.MethodType.UNARY, proto.identity.client.ReservedRegistrationStartRequest, proto.identity.client.RegistrationStartResponse, /** * @param {!proto.identity.client.ReservedRegistrationStartRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.client.RegistrationStartResponse.deserializeBinary ); /** * @param {!proto.identity.client.ReservedRegistrationStartRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.RegistrationStartResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.client.IdentityClientServiceClient.prototype.registerReservedPasswordUserStart = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.client.IdentityClientService/RegisterReservedPasswordUserStart', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterReservedPasswordUserStart, callback); }; /** * @param {!proto.identity.client.ReservedRegistrationStartRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.client.IdentityClientServicePromiseClient.prototype.registerReservedPasswordUserStart = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.client.IdentityClientService/RegisterReservedPasswordUserStart', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterReservedPasswordUserStart); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.RegistrationFinishRequest, * !proto.identity.client.RegistrationFinishResponse>} */ const methodDescriptor_IdentityClientService_RegisterPasswordUserFinish = new grpc.web.MethodDescriptor( '/identity.client.IdentityClientService/RegisterPasswordUserFinish', grpc.web.MethodType.UNARY, proto.identity.client.RegistrationFinishRequest, proto.identity.client.RegistrationFinishResponse, /** * @param {!proto.identity.client.RegistrationFinishRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.client.RegistrationFinishResponse.deserializeBinary ); /** * @param {!proto.identity.client.RegistrationFinishRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.RegistrationFinishResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.client.IdentityClientServiceClient.prototype.registerPasswordUserFinish = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.client.IdentityClientService/RegisterPasswordUserFinish', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterPasswordUserFinish, callback); }; /** * @param {!proto.identity.client.RegistrationFinishRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.client.IdentityClientServicePromiseClient.prototype.registerPasswordUserFinish = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.client.IdentityClientService/RegisterPasswordUserFinish', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterPasswordUserFinish); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.OpaqueLoginStartRequest, * !proto.identity.client.OpaqueLoginStartResponse>} */ const methodDescriptor_IdentityClientService_LoginPasswordUserStart = new grpc.web.MethodDescriptor( '/identity.client.IdentityClientService/LoginPasswordUserStart', grpc.web.MethodType.UNARY, proto.identity.client.OpaqueLoginStartRequest, proto.identity.client.OpaqueLoginStartResponse, /** * @param {!proto.identity.client.OpaqueLoginStartRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.client.OpaqueLoginStartResponse.deserializeBinary ); /** * @param {!proto.identity.client.OpaqueLoginStartRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.OpaqueLoginStartResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.client.IdentityClientServiceClient.prototype.loginPasswordUserStart = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.client.IdentityClientService/LoginPasswordUserStart', request, metadata || {}, methodDescriptor_IdentityClientService_LoginPasswordUserStart, callback); }; /** * @param {!proto.identity.client.OpaqueLoginStartRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.client.IdentityClientServicePromiseClient.prototype.loginPasswordUserStart = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.client.IdentityClientService/LoginPasswordUserStart', request, metadata || {}, methodDescriptor_IdentityClientService_LoginPasswordUserStart); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.OpaqueLoginFinishRequest, * !proto.identity.client.OpaqueLoginFinishResponse>} */ const methodDescriptor_IdentityClientService_LoginPasswordUserFinish = new grpc.web.MethodDescriptor( '/identity.client.IdentityClientService/LoginPasswordUserFinish', grpc.web.MethodType.UNARY, proto.identity.client.OpaqueLoginFinishRequest, proto.identity.client.OpaqueLoginFinishResponse, /** * @param {!proto.identity.client.OpaqueLoginFinishRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.client.OpaqueLoginFinishResponse.deserializeBinary ); /** * @param {!proto.identity.client.OpaqueLoginFinishRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.OpaqueLoginFinishResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.client.IdentityClientServiceClient.prototype.loginPasswordUserFinish = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.client.IdentityClientService/LoginPasswordUserFinish', request, metadata || {}, methodDescriptor_IdentityClientService_LoginPasswordUserFinish, callback); }; /** * @param {!proto.identity.client.OpaqueLoginFinishRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.client.IdentityClientServicePromiseClient.prototype.loginPasswordUserFinish = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.client.IdentityClientService/LoginPasswordUserFinish', request, metadata || {}, methodDescriptor_IdentityClientService_LoginPasswordUserFinish); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.WalletLoginRequest, * !proto.identity.client.WalletLoginResponse>} */ const methodDescriptor_IdentityClientService_LoginWalletUser = new grpc.web.MethodDescriptor( '/identity.client.IdentityClientService/LoginWalletUser', grpc.web.MethodType.UNARY, proto.identity.client.WalletLoginRequest, proto.identity.client.WalletLoginResponse, /** * @param {!proto.identity.client.WalletLoginRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.client.WalletLoginResponse.deserializeBinary ); /** * @param {!proto.identity.client.WalletLoginRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.WalletLoginResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.client.IdentityClientServiceClient.prototype.loginWalletUser = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.client.IdentityClientService/LoginWalletUser', request, metadata || {}, methodDescriptor_IdentityClientService_LoginWalletUser, callback); }; /** * @param {!proto.identity.client.WalletLoginRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.client.IdentityClientServicePromiseClient.prototype.loginWalletUser = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.client.IdentityClientService/LoginWalletUser', request, metadata || {}, methodDescriptor_IdentityClientService_LoginWalletUser); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.ReservedWalletLoginRequest, * !proto.identity.client.WalletLoginResponse>} */ const methodDescriptor_IdentityClientService_LoginReservedWalletUser = new grpc.web.MethodDescriptor( '/identity.client.IdentityClientService/LoginReservedWalletUser', grpc.web.MethodType.UNARY, proto.identity.client.ReservedWalletLoginRequest, proto.identity.client.WalletLoginResponse, /** * @param {!proto.identity.client.ReservedWalletLoginRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.client.WalletLoginResponse.deserializeBinary ); /** * @param {!proto.identity.client.ReservedWalletLoginRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.WalletLoginResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.client.IdentityClientServiceClient.prototype.loginReservedWalletUser = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.client.IdentityClientService/LoginReservedWalletUser', request, metadata || {}, methodDescriptor_IdentityClientService_LoginReservedWalletUser, callback); }; /** * @param {!proto.identity.client.ReservedWalletLoginRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.client.IdentityClientServicePromiseClient.prototype.loginReservedWalletUser = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.client.IdentityClientService/LoginReservedWalletUser', request, metadata || {}, methodDescriptor_IdentityClientService_LoginReservedWalletUser); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.Empty, * !proto.identity.client.GenerateNonceResponse>} */ const methodDescriptor_IdentityClientService_GenerateNonce = new grpc.web.MethodDescriptor( '/identity.client.IdentityClientService/GenerateNonce', grpc.web.MethodType.UNARY, proto.identity.client.Empty, proto.identity.client.GenerateNonceResponse, /** * @param {!proto.identity.client.Empty} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.client.GenerateNonceResponse.deserializeBinary ); /** * @param {!proto.identity.client.Empty} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.GenerateNonceResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.client.IdentityClientServiceClient.prototype.generateNonce = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.client.IdentityClientService/GenerateNonce', request, metadata || {}, methodDescriptor_IdentityClientService_GenerateNonce, callback); }; /** * @param {!proto.identity.client.Empty} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.client.IdentityClientServicePromiseClient.prototype.generateNonce = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.client.IdentityClientService/GenerateNonce', request, metadata || {}, methodDescriptor_IdentityClientService_GenerateNonce); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.VerifyUserAccessTokenRequest, * !proto.identity.client.VerifyUserAccessTokenResponse>} */ const methodDescriptor_IdentityClientService_VerifyUserAccessToken = new grpc.web.MethodDescriptor( '/identity.client.IdentityClientService/VerifyUserAccessToken', grpc.web.MethodType.UNARY, proto.identity.client.VerifyUserAccessTokenRequest, proto.identity.client.VerifyUserAccessTokenResponse, /** * @param {!proto.identity.client.VerifyUserAccessTokenRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.client.VerifyUserAccessTokenResponse.deserializeBinary ); /** * @param {!proto.identity.client.VerifyUserAccessTokenRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.VerifyUserAccessTokenResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.client.IdentityClientServiceClient.prototype.verifyUserAccessToken = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.client.IdentityClientService/VerifyUserAccessToken', request, metadata || {}, methodDescriptor_IdentityClientService_VerifyUserAccessToken, callback); }; /** * @param {!proto.identity.client.VerifyUserAccessTokenRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.client.IdentityClientServicePromiseClient.prototype.verifyUserAccessToken = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.client.IdentityClientService/VerifyUserAccessToken', request, metadata || {}, methodDescriptor_IdentityClientService_VerifyUserAccessToken); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.AddReservedUsernamesRequest, * !proto.identity.client.Empty>} */ const methodDescriptor_IdentityClientService_AddReservedUsernames = new grpc.web.MethodDescriptor( '/identity.client.IdentityClientService/AddReservedUsernames', grpc.web.MethodType.UNARY, proto.identity.client.AddReservedUsernamesRequest, proto.identity.client.Empty, /** * @param {!proto.identity.client.AddReservedUsernamesRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.client.Empty.deserializeBinary ); /** * @param {!proto.identity.client.AddReservedUsernamesRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.Empty)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.client.IdentityClientServiceClient.prototype.addReservedUsernames = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.client.IdentityClientService/AddReservedUsernames', request, metadata || {}, methodDescriptor_IdentityClientService_AddReservedUsernames, callback); }; /** * @param {!proto.identity.client.AddReservedUsernamesRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.client.IdentityClientServicePromiseClient.prototype.addReservedUsernames = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.client.IdentityClientService/AddReservedUsernames', request, metadata || {}, methodDescriptor_IdentityClientService_AddReservedUsernames); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.RemoveReservedUsernameRequest, * !proto.identity.client.Empty>} */ const methodDescriptor_IdentityClientService_RemoveReservedUsername = new grpc.web.MethodDescriptor( '/identity.client.IdentityClientService/RemoveReservedUsername', grpc.web.MethodType.UNARY, proto.identity.client.RemoveReservedUsernameRequest, proto.identity.client.Empty, /** * @param {!proto.identity.client.RemoveReservedUsernameRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.client.Empty.deserializeBinary ); /** * @param {!proto.identity.client.RemoveReservedUsernameRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.Empty)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.client.IdentityClientServiceClient.prototype.removeReservedUsername = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.client.IdentityClientService/RemoveReservedUsername', request, metadata || {}, methodDescriptor_IdentityClientService_RemoveReservedUsername, callback); }; /** * @param {!proto.identity.client.RemoveReservedUsernameRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.client.IdentityClientServicePromiseClient.prototype.removeReservedUsername = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.client.IdentityClientService/RemoveReservedUsername', request, metadata || {}, methodDescriptor_IdentityClientService_RemoveReservedUsername); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.client.Empty, * !proto.identity.client.Empty>} */ const methodDescriptor_IdentityClientService_Ping = new grpc.web.MethodDescriptor( '/identity.client.IdentityClientService/Ping', grpc.web.MethodType.UNARY, proto.identity.client.Empty, proto.identity.client.Empty, /** * @param {!proto.identity.client.Empty} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.client.Empty.deserializeBinary ); /** * @param {!proto.identity.client.Empty} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.client.Empty)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.client.IdentityClientServiceClient.prototype.ping = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.client.IdentityClientService/Ping', request, metadata || {}, methodDescriptor_IdentityClientService_Ping, callback); }; /** * @param {!proto.identity.client.Empty} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.client.IdentityClientServicePromiseClient.prototype.ping = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.client.IdentityClientService/Ping', request, metadata || {}, methodDescriptor_IdentityClientService_Ping); }; module.exports = proto.identity.client; diff --git a/web/protobufs/identity-client.cjs.flow b/web/protobufs/identity-unauth.cjs.flow similarity index 98% rename from web/protobufs/identity-client.cjs.flow rename to web/protobufs/identity-unauth.cjs.flow index 1960ae4e2..79a1b7ce1 100644 --- a/web/protobufs/identity-client.cjs.flow +++ b/web/protobufs/identity-unauth.cjs.flow @@ -1,163 +1,163 @@ // @flow import * as grpcWeb from 'grpc-web'; -import * as identityStructs from './identity-structs.cjs'; +import * as identityStructs from './identity-unauth-structs.cjs'; declare export class IdentityClientServiceClient { constructor (hostname: string, credentials?: null | { +[index: string]: string }, options?: null | { +[index: string]: any }): void; registerPasswordUserStart( request: identityStructs.RegistrationStartRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.RegistrationStartResponse) => void ): grpcWeb.ClientReadableStream; registerReservedPasswordUserStart( request: identityStructs.ReservedRegistrationStartRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.RegistrationStartResponse) => void ): grpcWeb.ClientReadableStream; registerPasswordUserFinish( request: identityStructs.RegistrationFinishRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.RegistrationFinishResponse) => void ): grpcWeb.ClientReadableStream; loginPasswordUserStart( request: identityStructs.OpaqueLoginStartRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.OpaqueLoginStartResponse) => void ): grpcWeb.ClientReadableStream; loginPasswordUserFinish( request: identityStructs.OpaqueLoginFinishRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.OpaqueLoginFinishResponse) => void ): grpcWeb.ClientReadableStream; loginWalletUser( request: identityStructs.WalletLoginRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.WalletLoginResponse) => void ): grpcWeb.ClientReadableStream; loginReservedWalletUser( request: identityStructs.ReservedWalletLoginRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.WalletLoginResponse) => void ): grpcWeb.ClientReadableStream; generateNonce( request: identityStructs.Empty, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.GenerateNonceResponse) => void ): grpcWeb.ClientReadableStream; verifyUserAccessToken( request: identityStructs.VerifyUserAccessTokenRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.VerifyUserAccessTokenResponse) => void ): grpcWeb.ClientReadableStream; addReservedUsernames( request: identityStructs.AddReservedUsernamesRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.Empty) => void ): grpcWeb.ClientReadableStream; removeReservedUsername( request: identityStructs.RemoveReservedUsernameRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.Empty) => void ): grpcWeb.ClientReadableStream; ping( request: identityStructs.Empty, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.Empty) => void ): grpcWeb.ClientReadableStream; } declare export class IdentityClientServicePromiseClient { constructor (hostname: string, credentials?: null | { +[index: string]: string }, options?: null | { +[index: string]: any }): void; registerPasswordUserStart( request: identityStructs.RegistrationStartRequest, metadata?: grpcWeb.Metadata ): Promise; registerReservedPasswordUserStart( request: identityStructs.ReservedRegistrationStartRequest, metadata?: grpcWeb.Metadata ): Promise; registerPasswordUserFinish( request: identityStructs.RegistrationFinishRequest, metadata?: grpcWeb.Metadata ): Promise; loginPasswordUserStart( request: identityStructs.OpaqueLoginStartRequest, metadata?: grpcWeb.Metadata ): Promise; loginPasswordUserFinish( request: identityStructs.OpaqueLoginFinishRequest, metadata?: grpcWeb.Metadata ): Promise; loginWalletUser( request: identityStructs.WalletLoginRequest, metadata?: grpcWeb.Metadata ): Promise; loginReservedWalletUser( request: identityStructs.ReservedWalletLoginRequest, metadata?: grpcWeb.Metadata ): Promise; generateNonce( request: identityStructs.Empty, metadata?: grpcWeb.Metadata ): Promise; verifyUserAccessToken( request: identityStructs.VerifyUserAccessTokenRequest, metadata?: grpcWeb.Metadata ): Promise; addReservedUsernames( request: identityStructs.AddReservedUsernamesRequest, metadata?: grpcWeb.Metadata ): Promise; removeReservedUsername( request: identityStructs.RemoveReservedUsernameRequest, metadata?: grpcWeb.Metadata ): Promise; ping( request: identityStructs.Empty, metadata?: grpcWeb.Metadata ): Promise; } diff --git a/web/scripts/codegen-identity-grpc.sh b/web/scripts/codegen-identity-grpc.sh index 91fc3dfd6..a0a35ad32 100755 --- a/web/scripts/codegen-identity-grpc.sh +++ b/web/scripts/codegen-identity-grpc.sh @@ -1,31 +1,32 @@ #!/usr/bin/env bash set -Eeuo pipefail PROTO_PATH="../shared/protos/" OUTPUT_DIR="protobufs" -protoc -I=$PROTO_PATH identity_client.proto identity_authenticated.proto \ +protoc -I=$PROTO_PATH identity_unauth.proto identity_auth.proto \ --js_out=import_style=commonjs:$OUTPUT_DIR \ --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:$OUTPUT_DIR -mv $OUTPUT_DIR/identity_client_pb.js \ - $OUTPUT_DIR/identity-structs.cjs -mv $OUTPUT_DIR/identity_client_grpc_web_pb.js \ - $OUTPUT_DIR/identity-client.cjs -mv $OUTPUT_DIR/identity_client_pb.d.ts \ - $OUTPUT_DIR/identity-structs.cjs.flow -mv $OUTPUT_DIR/identity_client_grpc_web_pb.d.ts \ - $OUTPUT_DIR/identity-client.cjs.flow -mv $OUTPUT_DIR/identity_authenticated_pb.js \ +mv $OUTPUT_DIR/identity_unauth_pb.js \ + $OUTPUT_DIR/identity-unauth-structs.cjs +mv $OUTPUT_DIR/identity_unauth_grpc_web_pb.js \ + $OUTPUT_DIR/identity-unauth.cjs +mv $OUTPUT_DIR/identity_unauth_pb.d.ts \ + $OUTPUT_DIR/identity-unauth-structs.cjs.flow +mv $OUTPUT_DIR/identity_unauth_grpc_web_pb.d.ts \ + $OUTPUT_DIR/identity-unauth.cjs.flow + +mv $OUTPUT_DIR/identity_auth_pb.js \ $OUTPUT_DIR/identity-auth-structs.cjs -mv $OUTPUT_DIR/identity_authenticated_grpc_web_pb.js \ +mv $OUTPUT_DIR/identity_auth_grpc_web_pb.js \ $OUTPUT_DIR/identity-auth-client.cjs -mv $OUTPUT_DIR/identity_authenticated_pb.d.ts \ +mv $OUTPUT_DIR/identity_auth_pb.d.ts \ $OUTPUT_DIR/identity-auth-structs.cjs.flow -mv $OUTPUT_DIR/identity_authenticated_grpc_web_pb.d.ts \ +mv $OUTPUT_DIR/identity_auth_grpc_web_pb.d.ts \ $OUTPUT_DIR/identity-auth-client.cjs.flow # This echo statement splits the string to ensure that Phabricator shows this file in reviews echo "Make sure to edit the files to correct import paths, reintroduce @""generated annotation, and convert TS to Flow!"