diff --git a/services/identity/src/database/device_list.rs b/services/identity/src/database/device_list.rs index b9ec328fa..53982d9a9 100644 --- a/services/identity/src/database/device_list.rs +++ b/services/identity/src/database/device_list.rs @@ -1,1343 +1,1395 @@ use std::collections::{HashMap, HashSet}; use chrono::{DateTime, Utc}; use comm_lib::{ aws::ddb::{ operation::{get_item::GetItemOutput, query::builders::QueryFluentBuilder}, types::{ error::TransactionCanceledException, AttributeValue, Delete, DeleteRequest, Put, TransactWriteItem, Update, WriteRequest, }, }, database::{ AttributeExtractor, AttributeMap, DBItemAttributeError, DBItemError, DynamoDBError, TryFromAttribute, }, }; use tracing::{debug, error, warn}; use crate::{ client_service::FlattenedDeviceKeyUpload, constants::{ devices_table::{self, *}, USERS_TABLE, USERS_TABLE_DEVICELIST_TIMESTAMP_ATTRIBUTE_NAME, USERS_TABLE_PARTITION_KEY, }, error::{DeviceListError, Error}, grpc_services::protos::{self, unauth::DeviceType}, grpc_utils::DeviceKeysInfo, }; use super::DatabaseClient; #[derive(Clone, Debug)] pub struct DeviceRow { pub user_id: String, pub device_id: String, pub device_type: DeviceType, pub device_key_info: IdentityKeyInfo, pub content_prekey: Prekey, pub notif_prekey: Prekey, // migration-related data pub code_version: u64, /// Timestamp of last login (access token generation) pub login_time: DateTime, } #[derive(Clone, Debug)] pub struct DeviceListRow { pub user_id: String, pub timestamp: DateTime, pub device_ids: Vec, } #[derive(Clone, Debug)] pub struct IdentityKeyInfo { pub key_payload: String, pub key_payload_signature: String, } #[derive(Clone, Debug)] pub struct Prekey { pub prekey: String, pub prekey_signature: String, } /// A struct representing device list update request /// payload; issued by the primary device #[derive(derive_more::Constructor)] pub struct DeviceListUpdate { pub devices: Vec, pub timestamp: DateTime, } impl DeviceRow { pub fn from_device_key_upload( user_id: impl Into, upload: FlattenedDeviceKeyUpload, code_version: u64, login_time: DateTime, ) -> Self { Self { user_id: user_id.into(), device_id: upload.device_id_key, device_type: DeviceType::from_str_name(upload.device_type.as_str_name()) .expect("DeviceType conversion failed. Identity client and server protos mismatch"), device_key_info: IdentityKeyInfo { key_payload: upload.key_payload, key_payload_signature: upload.key_payload_signature, }, content_prekey: Prekey { prekey: upload.content_prekey, prekey_signature: upload.content_prekey_signature, }, notif_prekey: Prekey { prekey: upload.notif_prekey, prekey_signature: upload.notif_prekey_signature, }, code_version, login_time, } } } impl DeviceListRow { /// Generates new device list row from given devices fn new(user_id: impl Into, device_ids: Vec) -> Self { Self { user_id: user_id.into(), device_ids, timestamp: Utc::now(), } } } // helper structs for converting to/from attribute values for sort key (a.k.a itemID) struct DeviceIDAttribute(String); struct DeviceListKeyAttribute(DateTime); impl From for AttributeValue { fn from(value: DeviceIDAttribute) -> Self { AttributeValue::S(format!("{DEVICE_ITEM_KEY_PREFIX}{}", value.0)) } } impl From for AttributeValue { fn from(value: DeviceListKeyAttribute) -> Self { AttributeValue::S(format!( "{DEVICE_LIST_KEY_PREFIX}{}", value.0.to_rfc3339() )) } } impl TryFrom> for DeviceIDAttribute { type Error = DBItemError; fn try_from(value: Option) -> Result { let item_id = String::try_from_attr(ATTR_ITEM_ID, value)?; // remove the device- prefix let device_id = item_id .strip_prefix(DEVICE_ITEM_KEY_PREFIX) .ok_or_else(|| DBItemError { attribute_name: ATTR_ITEM_ID.to_string(), attribute_value: item_id.clone().into(), attribute_error: DBItemAttributeError::InvalidValue, })? .to_string(); Ok(Self(device_id)) } } impl TryFrom> for DeviceListKeyAttribute { type Error = DBItemError; fn try_from(value: Option) -> Result { let item_id = String::try_from_attr(ATTR_ITEM_ID, value)?; // remove the device-list- prefix, then parse the timestamp let timestamp: DateTime = item_id .strip_prefix(DEVICE_LIST_KEY_PREFIX) .ok_or_else(|| DBItemError { attribute_name: ATTR_ITEM_ID.to_string(), attribute_value: item_id.clone().into(), attribute_error: DBItemAttributeError::InvalidValue, }) .and_then(|s| { s.parse().map_err(|e| { DBItemError::new( ATTR_ITEM_ID.to_string(), item_id.clone().into(), DBItemAttributeError::InvalidTimestamp(e), ) }) })?; Ok(Self(timestamp)) } } impl TryFrom for DeviceRow { type Error = DBItemError; fn try_from(mut attrs: AttributeMap) -> Result { let user_id = attrs.take_attr(ATTR_USER_ID)?; let DeviceIDAttribute(device_id) = attrs.remove(ATTR_ITEM_ID).try_into()?; let raw_device_type: String = attrs.take_attr(ATTR_DEVICE_TYPE)?; let device_type = DeviceType::from_str_name(&raw_device_type).ok_or_else(|| { DBItemError::new( ATTR_DEVICE_TYPE.to_string(), raw_device_type.into(), DBItemAttributeError::InvalidValue, ) })?; let device_key_info = attrs .take_attr::(ATTR_DEVICE_KEY_INFO) .and_then(IdentityKeyInfo::try_from)?; let content_prekey = attrs .take_attr::(ATTR_CONTENT_PREKEY) .and_then(Prekey::try_from)?; let notif_prekey = attrs .take_attr::(ATTR_NOTIF_PREKEY) .and_then(Prekey::try_from)?; let code_version = attrs .remove(ATTR_CODE_VERSION) .and_then(|attr| attr.as_n().ok().cloned()) .and_then(|val| val.parse::().ok()) .unwrap_or_default(); let login_time: DateTime = attrs.take_attr(ATTR_LOGIN_TIME)?; Ok(Self { user_id, device_id, device_type, device_key_info, content_prekey, notif_prekey, code_version, login_time, }) } } impl From for AttributeMap { fn from(value: DeviceRow) -> Self { HashMap::from([ (ATTR_USER_ID.to_string(), AttributeValue::S(value.user_id)), ( ATTR_ITEM_ID.to_string(), DeviceIDAttribute(value.device_id).into(), ), ( ATTR_DEVICE_TYPE.to_string(), AttributeValue::S(value.device_type.as_str_name().to_string()), ), ( ATTR_DEVICE_KEY_INFO.to_string(), value.device_key_info.into(), ), (ATTR_CONTENT_PREKEY.to_string(), value.content_prekey.into()), (ATTR_NOTIF_PREKEY.to_string(), value.notif_prekey.into()), // migration attributes ( ATTR_CODE_VERSION.to_string(), AttributeValue::N(value.code_version.to_string()), ), ( ATTR_LOGIN_TIME.to_string(), AttributeValue::S(value.login_time.to_rfc3339()), ), ]) } } impl From for protos::unauth::IdentityKeyInfo { fn from(value: IdentityKeyInfo) -> Self { Self { payload: value.key_payload, payload_signature: value.key_payload_signature, // social proof isn't stored in the devices table // it cannot be retrieved here social_proof: None, } } } impl From for AttributeValue { fn from(value: IdentityKeyInfo) -> Self { let attrs = HashMap::from([ ( ATTR_KEY_PAYLOAD.to_string(), AttributeValue::S(value.key_payload), ), ( ATTR_KEY_PAYLOAD_SIGNATURE.to_string(), AttributeValue::S(value.key_payload_signature), ), ]); AttributeValue::M(attrs) } } impl TryFrom for IdentityKeyInfo { type Error = DBItemError; fn try_from(mut attrs: AttributeMap) -> Result { let key_payload = attrs.take_attr(ATTR_KEY_PAYLOAD)?; let key_payload_signature = attrs.take_attr(ATTR_KEY_PAYLOAD_SIGNATURE)?; Ok(Self { key_payload, key_payload_signature, }) } } impl From for AttributeValue { fn from(value: Prekey) -> Self { let attrs = HashMap::from([ (ATTR_PREKEY.to_string(), AttributeValue::S(value.prekey)), ( ATTR_PREKEY_SIGNATURE.to_string(), AttributeValue::S(value.prekey_signature), ), ]); AttributeValue::M(attrs) } } impl From for protos::unauth::Prekey { fn from(value: Prekey) -> Self { Self { prekey: value.prekey, prekey_signature: value.prekey_signature, } } } impl From for Prekey { fn from(value: protos::unauth::Prekey) -> Self { Self { prekey: value.prekey, prekey_signature: value.prekey_signature, } } } impl TryFrom for Prekey { type Error = DBItemError; fn try_from(mut attrs: AttributeMap) -> Result { let prekey = attrs.take_attr(ATTR_PREKEY)?; let prekey_signature = attrs.take_attr(ATTR_PREKEY_SIGNATURE)?; Ok(Self { prekey, prekey_signature, }) } } impl TryFrom for DeviceListRow { type Error = DBItemError; fn try_from(mut attrs: AttributeMap) -> Result { let user_id = attrs.take_attr(ATTR_USER_ID)?; let DeviceListKeyAttribute(timestamp) = attrs.remove(ATTR_ITEM_ID).try_into()?; // validate timestamps are in sync let timestamps_match = attrs .remove(ATTR_TIMESTAMP) .and_then(|attr| attr.as_n().ok().cloned()) .and_then(|val| val.parse::().ok()) .filter(|val| *val == timestamp.timestamp_millis()) .is_some(); if !timestamps_match { warn!( "DeviceList timestamp mismatch for (userID={}, itemID={})", &user_id, timestamp.to_rfc3339() ); } let device_ids: Vec = attrs.take_attr(ATTR_DEVICE_IDS)?; Ok(Self { user_id, timestamp, device_ids, }) } } impl From for AttributeMap { fn from(device_list: DeviceListRow) -> Self { let mut attrs = HashMap::new(); attrs.insert( ATTR_USER_ID.to_string(), AttributeValue::S(device_list.user_id.clone()), ); attrs.insert( ATTR_ITEM_ID.to_string(), DeviceListKeyAttribute(device_list.timestamp).into(), ); attrs.insert( ATTR_TIMESTAMP.to_string(), AttributeValue::N(device_list.timestamp.timestamp_millis().to_string()), ); attrs.insert( ATTR_DEVICE_IDS.to_string(), AttributeValue::L( device_list .device_ids .into_iter() .map(AttributeValue::S) .collect(), ), ); attrs } } impl DatabaseClient { /// Retrieves user's current devices and their full data pub async fn get_current_devices( &self, user_id: impl Into, ) -> Result, Error> { let response = query_rows_with_prefix(self, user_id, DEVICE_ITEM_KEY_PREFIX) .send() .await .map_err(|e| { error!("Failed to get current devices: {:?}", e); Error::AwsSdk(e.into()) })?; let Some(rows) = response.items else { return Ok(Vec::new()); }; rows .into_iter() .map(DeviceRow::try_from) .collect::, DBItemError>>() .map_err(Error::from) } /// Gets user's device list history pub async fn get_device_list_history( &self, user_id: impl Into, since: Option>, ) -> Result, Error> { let rows = if let Some(since) = since { // When timestamp is provided, it's better to query device lists by timestamp LSI self .client .query() .table_name(devices_table::NAME) .index_name(devices_table::TIMESTAMP_INDEX_NAME) .consistent_read(true) .key_condition_expression("#user_id = :user_id AND #timestamp > :since") .expression_attribute_names("#user_id", ATTR_USER_ID) .expression_attribute_names("#timestamp", ATTR_TIMESTAMP) .expression_attribute_values( ":user_id", AttributeValue::S(user_id.into()), ) .expression_attribute_values( ":since", AttributeValue::N(since.timestamp_millis().to_string()), ) .send() .await .map_err(|e| { error!("Failed to query device list updates by index: {:?}", e); Error::AwsSdk(e.into()) })? .items } else { // Query all device lists for user query_rows_with_prefix(self, user_id, DEVICE_LIST_KEY_PREFIX) .send() .await .map_err(|e| { error!("Failed to query device list updates (all): {:?}", e); Error::AwsSdk(e.into()) })? .items }; rows .unwrap_or_default() .into_iter() .map(DeviceListRow::try_from) .collect::, DBItemError>>() .map_err(Error::from) } /// Returns all devices' keys for the given user. Response is in the same format /// as [DatabaseClient::get_keys_for_user] for compatibility reasons. pub async fn get_keys_for_user_devices( &self, user_id: impl Into, ) -> Result { let user_devices = self.get_current_devices(user_id).await?; let user_devices_keys = user_devices .into_iter() .map(|device| (device.device_id.clone(), DeviceKeysInfo::from(device))) .collect(); Ok(user_devices_keys) } pub async fn update_device_prekeys( &self, user_id: impl Into, device_id: impl Into, content_prekey: Prekey, notif_prekey: Prekey, ) -> Result<(), Error> { self .client .update_item() .table_name(devices_table::NAME) .key(ATTR_USER_ID, AttributeValue::S(user_id.into())) .key(ATTR_ITEM_ID, DeviceIDAttribute(device_id.into()).into()) .condition_expression( "attribute_exists(#user_id) AND attribute_exists(#item_id)", ) .update_expression( "SET #content_prekey = :content_prekey, #notif_prekey = :notif_prekey", ) .expression_attribute_names("#user_id", ATTR_USER_ID) .expression_attribute_names("#item_id", ATTR_ITEM_ID) .expression_attribute_names("#content_prekey", ATTR_CONTENT_PREKEY) .expression_attribute_names("#notif_prekey", ATTR_NOTIF_PREKEY) .expression_attribute_values(":content_prekey", content_prekey.into()) .expression_attribute_values(":notif_prekey", notif_prekey.into()) .send() .await .map_err(|e| { error!("Failed to update device prekeys: {:?}", e); Error::AwsSdk(e.into()) })?; Ok(()) } /// Checks if given device exists on user's current device list pub async fn device_exists( &self, user_id: impl Into, device_id: impl Into, ) -> Result { let GetItemOutput { item, .. } = self .client .get_item() .table_name(devices_table::NAME) .key(ATTR_USER_ID, AttributeValue::S(user_id.into())) .key(ATTR_ITEM_ID, DeviceIDAttribute(device_id.into()).into()) // only fetch the primary key, we don't need the rest .projection_expression(format!("{ATTR_USER_ID}, {ATTR_ITEM_ID}")) .send() .await .map_err(|e| { error!("Failed to check if device exists: {:?}", e); Error::AwsSdk(e.into()) })?; Ok(item.is_some()) } + pub async fn get_device_data( + &self, + user_id: impl Into, + device_id: impl Into, + ) -> Result, Error> { + let GetItemOutput { item, .. } = self + .client + .get_item() + .table_name(devices_table::NAME) + .key(ATTR_USER_ID, AttributeValue::S(user_id.into())) + .key(ATTR_ITEM_ID, DeviceIDAttribute(device_id.into()).into()) + .send() + .await + .map_err(|e| { + error!("Failed to fetch device data: {:?}", e); + Error::AwsSdk(e.into()) + })?; + + let Some(attrs) = item else { + return Ok(None); + }; + + let device_data = DeviceRow::try_from(attrs)?; + Ok(Some(device_data)) + } + + /// Fails if the device list is empty + pub async fn get_primary_device_data( + &self, + user_id: &str, + ) -> Result { + let device_list = self.get_current_device_list(user_id).await?; + let Some(primary_device_id) = device_list + .as_ref() + .and_then(|list| list.device_ids.first()) + else { + error!(user_id, "Device list is empty. Cannot fetch primary device"); + return Err(Error::DeviceList(DeviceListError::DeviceNotFound)); + }; + + self + .get_device_data(user_id, primary_device_id) + .await? + .ok_or_else(|| { + error!( + "Corrupt database. Missing primary device data for user {}", + user_id + ); + Error::MissingItem + }) + } + /// Required only for migration purposes (determining primary device) pub async fn update_device_login_time( &self, user_id: impl Into, device_id: impl Into, login_time: DateTime, ) -> Result<(), Error> { self .client .update_item() .table_name(devices_table::NAME) .key(ATTR_USER_ID, AttributeValue::S(user_id.into())) .key(ATTR_ITEM_ID, DeviceIDAttribute(device_id.into()).into()) .condition_expression( "attribute_exists(#user_id) AND attribute_exists(#item_id)", ) .update_expression("SET #login_time = :login_time") .expression_attribute_names("#user_id", ATTR_USER_ID) .expression_attribute_names("#item_id", ATTR_ITEM_ID) .expression_attribute_names("#login_time", ATTR_LOGIN_TIME) .expression_attribute_values( ":login_time", AttributeValue::S(login_time.to_rfc3339()), ) .send() .await .map_err(|e| { error!("Failed to update device login time: {:?}", e); Error::AwsSdk(e.into()) })?; Ok(()) } pub async fn get_current_device_list( &self, user_id: impl Into, ) -> Result, Error> { self .client .query() .table_name(devices_table::NAME) .index_name(devices_table::TIMESTAMP_INDEX_NAME) .consistent_read(true) .key_condition_expression("#user_id = :user_id") // sort descending .scan_index_forward(false) .expression_attribute_names("#user_id", ATTR_USER_ID) .expression_attribute_values( ":user_id", AttributeValue::S(user_id.into()), ) .limit(1) .send() .await .map_err(|e| { error!("Failed to query device list updates by index: {:?}", e); Error::AwsSdk(e.into()) })? .items .and_then(|mut items| items.pop()) .map(DeviceListRow::try_from) .transpose() .map_err(Error::from) } /// Adds device data to devices table. If the device already exists, its /// data is overwritten. This does not update the device list; the device ID /// should already be present in the device list. pub async fn put_device_data( &self, user_id: impl Into, device_key_upload: FlattenedDeviceKeyUpload, code_version: u64, login_time: DateTime, ) -> Result<(), Error> { let content_one_time_keys = device_key_upload.content_one_time_keys.clone(); let notif_one_time_keys = device_key_upload.notif_one_time_keys.clone(); let new_device = DeviceRow::from_device_key_upload( user_id, device_key_upload, code_version, login_time, ); let device_id = new_device.device_id.clone(); self .client .put_item() .table_name(devices_table::NAME) .set_item(Some(new_device.into())) .send() .await .map_err(|e| { error!("Failed to put device data: {:?}", e); Error::AwsSdk(e.into()) })?; self .append_one_time_prekeys( device_id, content_one_time_keys, notif_one_time_keys, ) .await?; Ok(()) } /// Adds new device to user's device list. If the device already exists, the /// operation fails. Transactionally generates new device list version. pub async fn add_device( &self, user_id: impl Into, device_key_upload: FlattenedDeviceKeyUpload, code_version: u64, login_time: DateTime, ) -> Result<(), Error> { let user_id: String = user_id.into(); self .transact_update_devicelist(&user_id, |device_ids, mut devices_data| { let new_device = DeviceRow::from_device_key_upload( &user_id, device_key_upload, code_version, login_time, ); if device_ids.iter().any(|id| &new_device.device_id == id) { warn!( "Device already exists in user's device list \ (userID={}, deviceID={})", &user_id, &new_device.device_id ); return Err(Error::DeviceList(DeviceListError::DeviceAlreadyExists)); } device_ids.push(new_device.device_id.clone()); // Reorder devices (determine primary device again) devices_data.push(new_device.clone()); migration::reorder_device_list(&user_id, device_ids, &devices_data); // Put new device let put_device = Put::builder() .table_name(devices_table::NAME) .set_item(Some(new_device.into())) .condition_expression( "attribute_not_exists(#user_id) AND attribute_not_exists(#item_id)", ) .expression_attribute_names("#user_id", ATTR_USER_ID) .expression_attribute_names("#item_id", ATTR_ITEM_ID) .build(); let put_device_operation = TransactWriteItem::builder().put(put_device).build(); Ok(Some(put_device_operation)) }) .await?; Ok(()) } /// Removes device from user's device list. If the device doesn't exist, the /// operation fails. Transactionally generates new device list version. pub async fn remove_device( &self, user_id: impl Into, device_id: impl AsRef, ) -> Result<(), Error> { let user_id: String = user_id.into(); let device_id = device_id.as_ref(); self .transact_update_devicelist(&user_id, |device_ids, mut devices_data| { let device_exists = device_ids.iter().any(|id| id == device_id); if !device_exists { warn!( "Device doesn't exist in user's device list \ (userID={}, deviceID={})", &user_id, device_id ); return Err(Error::DeviceList(DeviceListError::DeviceNotFound)); } device_ids.retain(|id| id != device_id); // Reorder devices (determine primary device again) devices_data.retain(|d| d.device_id != device_id); migration::reorder_device_list(&user_id, device_ids, &devices_data); // Delete device DDB operation let delete_device = Delete::builder() .table_name(devices_table::NAME) .key(ATTR_USER_ID, AttributeValue::S(user_id.clone())) .key( ATTR_ITEM_ID, DeviceIDAttribute(device_id.to_string()).into(), ) .condition_expression( "attribute_exists(#user_id) AND attribute_exists(#item_id)", ) .expression_attribute_names("#user_id", ATTR_USER_ID) .expression_attribute_names("#item_id", ATTR_ITEM_ID) .build(); let operation = TransactWriteItem::builder().delete(delete_device).build(); Ok(Some(operation)) }) .await?; Ok(()) } /// applies updated device list received from primary device pub async fn apply_devicelist_update( &self, user_id: &str, update: DeviceListUpdate, ) -> Result { let DeviceListUpdate { devices: new_list, .. } = update; self .transact_update_devicelist(user_id, |current_list, _| { // TODO: Add proper validation according to the whitepaper // currently only adding new device is supported (new.len - old.len = 1) let new_set: HashSet<_> = new_list.iter().collect(); let current_set: HashSet<_> = current_list.iter().collect(); // difference is A - B (only new devices) let difference: HashSet<_> = new_set.difference(¤t_set).collect(); if difference.len() != 1 { warn!("Received invalid device list update"); return Err(Error::DeviceList( DeviceListError::InvalidDeviceListUpdate, )); } debug!("Applying device list update. Difference: {:?}", difference); *current_list = new_list; Ok(None) }) .await } /// Performs a transactional update of the device list for the user. Afterwards /// generates a new device list and updates the timestamp in the users table. /// This is done in a transaction. Operation fails if the device list has been /// updated concurrently (timestamp mismatch). /// Returns the new device list row that has been saved to database. async fn transact_update_devicelist( &self, user_id: &str, // The closure performing a transactional update of the device list. // It receives two arguments: // 1. A mutable reference to the current device list (ordered device IDs). // 2. Details (full data) of the current devices (unordered). // The closure should return a transactional DDB // operation to be performed when updating the device list. action: impl FnOnce( &mut Vec, Vec, ) -> Result, Error>, ) -> Result { let previous_timestamp = get_current_devicelist_timestamp(self, user_id).await?; let current_devices_data = self.get_current_devices(user_id).await?; let mut device_ids = self .get_current_device_list(user_id) .await? .map(|device_list| device_list.device_ids) .unwrap_or_default(); // Perform the update action, then generate new device list let operation = action(&mut device_ids, current_devices_data)?; let new_device_list = DeviceListRow::new(user_id, device_ids); // Update timestamp in users table let timestamp_update_operation = device_list_timestamp_update_operation( user_id, previous_timestamp, new_device_list.timestamp, ); // Put updated device list (a new version) let put_device_list = Put::builder() .table_name(devices_table::NAME) .set_item(Some(new_device_list.clone().into())) .condition_expression( "attribute_not_exists(#user_id) AND attribute_not_exists(#item_id)", ) .expression_attribute_names("#user_id", ATTR_USER_ID) .expression_attribute_names("#item_id", ATTR_ITEM_ID) .build(); let put_device_list_operation = TransactWriteItem::builder().put(put_device_list).build(); let operations = if let Some(operation) = operation { vec![ operation, put_device_list_operation, timestamp_update_operation, ] } else { vec![put_device_list_operation, timestamp_update_operation] }; self .client .transact_write_items() .set_transact_items(Some(operations)) .send() .await .map_err(|e| match DynamoDBError::from(e) { DynamoDBError::TransactionCanceledException( TransactionCanceledException { cancellation_reasons: Some(reasons), .. }, ) if reasons .iter() .any(|reason| reason.code() == Some("ConditionalCheckFailed")) => { Error::DeviceList(DeviceListError::ConcurrentUpdateError) } other => { error!("Device list update transaction failed: {:?}", other); Error::AwsSdk(other) } })?; Ok(new_device_list) } /// Deletes all user data from devices table pub async fn delete_devices_table_rows_for_user( &self, user_id: impl Into, ) -> Result<(), Error> { // 1. get all rows // 2. batch write delete all // we project only the primary keys so we can pass these directly to delete requests let primary_keys = self .client .query() .table_name(devices_table::NAME) .projection_expression("#user_id, #item_id") .key_condition_expression("#user_id = :user_id") .expression_attribute_names("#user_id", ATTR_USER_ID) .expression_attribute_names("#item_id", ATTR_ITEM_ID) .expression_attribute_values( ":user_id", AttributeValue::S(user_id.into()), ) .consistent_read(true) .send() .await .map_err(|e| { error!("Failed to list user's items in devices table: {:?}", e); Error::AwsSdk(e.into()) })? .items .unwrap_or_default(); let delete_requests = primary_keys .into_iter() .map(|item| { let request = DeleteRequest::builder().set_key(Some(item)).build(); WriteRequest::builder().delete_request(request).build() }) .collect::>(); // TODO: We can use the batch write helper from comm-services-lib when integrated for batch in delete_requests.chunks(25) { self .client .batch_write_item() .request_items(devices_table::NAME, batch.to_vec()) .send() .await .map_err(|e| { error!("Failed to batch delete items from devices table: {:?}", e); Error::AwsSdk(e.into()) })?; } Ok(()) } } /// Gets timestamp of user's current device list. Returns None if the user /// doesn't have a device list yet. Storing the timestamp in the users table is /// required for consistency. It's used as a condition when updating the device /// list. async fn get_current_devicelist_timestamp( db: &crate::database::DatabaseClient, user_id: impl Into, ) -> Result>, Error> { let response = db .client .get_item() .table_name(USERS_TABLE) .key(USERS_TABLE_PARTITION_KEY, AttributeValue::S(user_id.into())) .projection_expression(USERS_TABLE_DEVICELIST_TIMESTAMP_ATTRIBUTE_NAME) .send() .await .map_err(|e| { error!("Failed to get user's device list timestamp: {:?}", e); Error::AwsSdk(e.into()) })?; let mut user_item = response.item.unwrap_or_default(); let raw_datetime = user_item.remove(USERS_TABLE_DEVICELIST_TIMESTAMP_ATTRIBUTE_NAME); // existing records will not have this field when // updating device list for the first time if raw_datetime.is_none() { return Ok(None); } let timestamp = DateTime::::try_from_attr( USERS_TABLE_DEVICELIST_TIMESTAMP_ATTRIBUTE_NAME, raw_datetime, )?; Ok(Some(timestamp)) } /// Generates update expression for current device list timestamp in users table. /// The previous timestamp is used as a condition to ensure that the value hasn't changed /// since we got it. This avoids race conditions when updating the device list. fn device_list_timestamp_update_operation( user_id: impl Into, previous_timestamp: Option>, new_timestamp: DateTime, ) -> TransactWriteItem { let update_builder = match previous_timestamp { Some(previous_timestamp) => Update::builder() .condition_expression("#device_list_timestamp = :previous_timestamp") .expression_attribute_values( ":previous_timestamp", AttributeValue::S(previous_timestamp.to_rfc3339()), ), // If there's no previous timestamp, the attribute shouldn't exist yet None => Update::builder() .condition_expression("attribute_not_exists(#device_list_timestamp)"), }; let update = update_builder .table_name(USERS_TABLE) .key(USERS_TABLE_PARTITION_KEY, AttributeValue::S(user_id.into())) .update_expression("SET #device_list_timestamp = :new_timestamp") .expression_attribute_names( "#device_list_timestamp", USERS_TABLE_DEVICELIST_TIMESTAMP_ATTRIBUTE_NAME, ) .expression_attribute_values( ":new_timestamp", AttributeValue::S(new_timestamp.to_rfc3339()), ) .build(); TransactWriteItem::builder().update(update).build() } /// Helper function to query rows by given sort key prefix fn query_rows_with_prefix( db: &crate::database::DatabaseClient, user_id: impl Into, prefix: &'static str, ) -> QueryFluentBuilder { db.client .query() .table_name(devices_table::NAME) .key_condition_expression( "#user_id = :user_id AND begins_with(#item_id, :device_prefix)", ) .expression_attribute_names("#user_id", ATTR_USER_ID) .expression_attribute_names("#item_id", ATTR_ITEM_ID) .expression_attribute_values(":user_id", AttributeValue::S(user_id.into())) .expression_attribute_values( ":device_prefix", AttributeValue::S(prefix.to_string()), ) .consistent_read(true) } // Helper module for "migration" code into new device list schema. // We can get rid of this when primary device takes over the responsibility // of managing the device list. mod migration { use std::{cmp::Ordering, collections::HashSet}; use tracing::{debug, error, info}; use super::*; pub(super) fn reorder_device_list( user_id: &str, list: &mut [String], devices_data: &[DeviceRow], ) { if !verify_device_list_match(list, devices_data) { error!("Found corrupt device list for user (userID={})!", user_id); return; } let Some(first_device) = list.first() else { debug!("Skipping device list rotation. Nothing to reorder."); return; }; let Some(primary_device) = determine_primary_device(devices_data) else { info!( "No valid primary device found for user (userID={}).\ Skipping device list reorder.", user_id ); return; }; if first_device == &primary_device.device_id { debug!("Skipping device list reorder. Primary device is already first"); return; } // swap primary device with the first one let Some(primary_device_idx) = list.iter().position(|id| id == &primary_device.device_id) else { error!( "Primary device not found in device list (userID={})", user_id ); return; }; list.swap(0, primary_device_idx); info!("Reordered device list for user (userID={})", user_id); } // checks if device list matches given devices data fn verify_device_list_match( list: &[String], devices_data: &[DeviceRow], ) -> bool { if list.len() != devices_data.len() { error!("Device list length mismatch!"); return false; } let actual_device_ids = devices_data .iter() .map(|device| &device.device_id) .collect::>(); let device_list_set = list.iter().collect::>(); if let Some(corrupt_device_id) = device_list_set .symmetric_difference(&actual_device_ids) .next() { error!( "Device list is corrupt (unknown deviceID={})", corrupt_device_id ); return false; } true } /// Returns reference to primary device (if any) from given list of devices /// or None if there's no valid primary device. fn determine_primary_device(devices: &[DeviceRow]) -> Option<&DeviceRow> { // 1. Find mobile devices with valid token // 2. Prioritize these with latest code version // 3. If there's a tie, select the one with latest login time let mut mobile_devices = devices .iter() .filter(|device| { device.device_type == DeviceType::Ios || device.device_type == DeviceType::Android }) .collect::>(); mobile_devices.sort_by(|a, b| { let code_version_cmp = b.code_version.cmp(&a.code_version); if code_version_cmp == Ordering::Equal { b.login_time.cmp(&a.login_time) } else { code_version_cmp } }); mobile_devices.first().cloned() } #[cfg(test)] mod tests { use super::*; use chrono::Duration; #[test] fn reorder_skips_no_devices() { let mut list = vec![]; reorder_device_list("", &mut list, &[]); assert_eq!(list, Vec::::new()); } #[test] fn reorder_skips_single_device() { let mut list = vec!["test".into()]; let devices_data = vec![create_test_device("test", DeviceType::Web, 0, Utc::now())]; reorder_device_list("", &mut list, &devices_data); assert_eq!(list, vec!["test"]); } #[test] fn reorder_skips_for_valid_list() { let mut list = vec!["mobile".into(), "web".into()]; let devices_data = vec![ create_test_device("mobile", DeviceType::Android, 1, Utc::now()), create_test_device("web", DeviceType::Web, 0, Utc::now()), ]; reorder_device_list("", &mut list, &devices_data); assert_eq!(list, vec!["mobile", "web"]); } #[test] fn reorder_swaps_primary_device_when_possible() { let mut list = vec!["web".into(), "mobile".into()]; let devices_data = vec![ create_test_device("web", DeviceType::Web, 0, Utc::now()), create_test_device("mobile", DeviceType::Android, 1, Utc::now()), ]; reorder_device_list("", &mut list, &devices_data); assert_eq!(list, vec!["mobile", "web"]); } #[test] fn determine_primary_device_returns_none_for_empty_list() { let devices = vec![]; assert!(determine_primary_device(&devices).is_none()); } #[test] fn determine_primary_device_returns_none_for_web_only() { let devices = vec![create_test_device("web", DeviceType::Web, 0, Utc::now())]; assert!( determine_primary_device(&devices).is_none(), "Primary device should be None for web-only devices" ); } #[test] fn determine_primary_device_prioritizes_mobile() { let devices = vec![ create_test_device("mobile", DeviceType::Android, 0, Utc::now()), create_test_device("web", DeviceType::Web, 0, Utc::now()), ]; let primary_device = determine_primary_device(&devices) .expect("Primary device should be present"); assert_eq!( primary_device.device_id, "mobile", "Primary device should be mobile" ); } #[test] fn determine_primary_device_prioritizes_latest_code_version() { let devices_with_latest_code_version = vec![ create_test_device("mobile1", DeviceType::Android, 1, Utc::now()), create_test_device("mobile2", DeviceType::Android, 2, Utc::now()), create_test_device("web", DeviceType::Web, 0, Utc::now()), ]; let primary_device = determine_primary_device(&devices_with_latest_code_version) .expect("Primary device should be present"); assert_eq!( primary_device.device_id, "mobile2", "Primary device should be mobile with latest code version" ); } #[test] fn determine_primary_device_prioritizes_latest_login_time() { let devices = vec![ create_test_device("mobile1_today", DeviceType::Ios, 1, Utc::now()), create_test_device( "mobile2_yesterday", DeviceType::Android, 1, Utc::now() - Duration::days(1), ), create_test_device("web", DeviceType::Web, 0, Utc::now()), ]; let primary_device = determine_primary_device(&devices) .expect("Primary device should be present"); assert_eq!( primary_device.device_id, "mobile1_today", "Primary device should be mobile with latest login time" ); } #[test] fn determine_primary_device_keeps_deterministic_order() { // Given two identical devices, the first one should be selected as primary let today = Utc::now(); let devices_with_latest_code_version = vec![ create_test_device("mobile1", DeviceType::Android, 1, today), create_test_device("mobile2", DeviceType::Android, 1, today), ]; let primary_device = determine_primary_device(&devices_with_latest_code_version) .expect("Primary device should be present"); assert_eq!( primary_device.device_id, "mobile1", "Primary device selection should be deterministic" ); } #[test] fn determine_primary_device_all_rules_together() { use DeviceType::{Android, Ios, Web}; let today = Utc::now(); let yesterday = today - Duration::days(1); let devices = vec![ create_test_device("mobile1_today", Android, 1, today), create_test_device("mobile2_today", Android, 2, today), create_test_device("mobile3_yesterday", Ios, 1, yesterday), create_test_device("mobile4_yesterday", Ios, 2, yesterday), create_test_device("web", Web, 5, today), ]; let primary_device = determine_primary_device(&devices) .expect("Primary device should be present"); assert_eq!( primary_device.device_id, "mobile2_today", "Primary device should be mobile with latest code version and login time" ); } fn create_test_device( id: &str, platform: DeviceType, code_version: u64, login_time: DateTime, ) -> DeviceRow { DeviceRow { user_id: "test".into(), device_id: id.into(), device_type: platform, device_key_info: IdentityKeyInfo { key_payload: "".into(), key_payload_signature: "".into(), }, content_prekey: Prekey { prekey: "".into(), prekey_signature: "".into(), }, notif_prekey: Prekey { prekey: "".into(), prekey_signature: "".into(), }, code_version, login_time, } } } } diff --git a/services/identity/src/grpc_services/authenticated.rs b/services/identity/src/grpc_services/authenticated.rs index 1999032d3..56852a248 100644 --- a/services/identity/src/grpc_services/authenticated.rs +++ b/services/identity/src/grpc_services/authenticated.rs @@ -1,617 +1,623 @@ use std::collections::HashMap; use crate::config::CONFIG; use crate::database::{DeviceListRow, DeviceListUpdate}; use crate::{ client_service::{handle_db_error, UpdateState, WorkflowInProgress}, constants::request_metadata, database::DatabaseClient, ddb_utils::DateTimeExt, grpc_services::shared::get_value, }; use chrono::{DateTime, Utc}; use comm_opaque2::grpc::protocol_error_to_grpc_status; use tonic::{Request, Response, Status}; use tracing::{debug, error, warn}; use super::protos::auth::{ identity, identity_client_service_server::IdentityClientService, GetDeviceListRequest, GetDeviceListResponse, Identity, InboundKeyInfo, InboundKeysForUserRequest, InboundKeysForUserResponse, KeyserverKeysResponse, LinkFarcasterAccountRequest, OutboundKeyInfo, OutboundKeysForUserRequest, OutboundKeysForUserResponse, RefreshUserPrekeysRequest, UpdateDeviceListRequest, UpdateUserPasswordFinishRequest, UpdateUserPasswordStartRequest, UpdateUserPasswordStartResponse, UploadOneTimeKeysRequest, }; use super::protos::auth::{UserIdentityRequest, UserIdentityResponse}; use super::protos::unauth::Empty; #[derive(derive_more::Constructor)] pub struct AuthenticatedService { db_client: DatabaseClient, } 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 .update_device_prekeys( user_id, device_id, content_keys.into(), notif_keys.into(), ) .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 user_id = &message.user_id; let devices_map = self .db_client .get_keys_for_user(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() .map(|(key, device_info)| (key, OutboundKeyInfo::from(device_info))) .collect::>(); Ok(tonic::Response::new(OutboundKeysForUserResponse { devices: transformed_devices, })) } async fn get_inbound_keys_for_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { use identity::IdentityInfo; let message = request.into_inner(); let user_id = &message.user_id; let devices_map = self .db_client .get_keys_for_user(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() .map(|(key, device_info)| (key, InboundKeyInfo::from(device_info))) .collect::>(); let identifier = self .db_client .get_user_identifier(user_id) .await .map_err(handle_db_error)? .ok_or_else(|| tonic::Status::not_found("user not found"))?; let identity_info = IdentityInfo::try_from(identifier)?; Ok(tonic::Response::new(InboundKeysForUserResponse { devices: transformed_devices, identity: Some(Identity { identity_info: Some(identity_info), }), })) } async fn get_keyserver_keys( &self, request: Request, ) -> Result, Status> { use identity::IdentityInfo; let message = request.into_inner(); - let keyserver_info = self - .db_client - .get_keyserver_keys_for_user(&message.user_id) - .await - .map_err(handle_db_error)? - .map(OutboundKeyInfo::from); - let identifier = self .db_client .get_user_identifier(&message.user_id) .await .map_err(handle_db_error)? .ok_or_else(|| tonic::Status::not_found("user not found"))?; - let identity_info = IdentityInfo::try_from(identifier)?; - let identity = Some(Identity { identity_info: Some(identity_info), }); + let keyserver_info = self + .db_client + .get_keyserver_keys_for_user(&message.user_id) + .await + .map_err(handle_db_error)? + .map(OutboundKeyInfo::from); + + let primary_device_data = self + .db_client + .get_primary_device_data(&message.user_id) + .await + .map_err(handle_db_error)?; + let primary_device_keys = primary_device_data.device_key_info; + let response = Response::new(KeyserverKeysResponse { keyserver_info, identity, + primary_device_identity_info: Some(primary_device_keys.into()), }); 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 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 .db_client .insert_workflow(WorkflowInProgress::Update(update_state)) .await .map_err(handle_db_error)?; 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 .db_client .get_workflow(message.session_id) .await .map_err(handle_db_error)? else { return Err(tonic::Status::not_found("session not found")); }; 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(&user_id, &device_id) .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, })) } async fn update_device_list( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, _device_id) = get_user_and_device_id(&request)?; // TODO: when we stop doing "primary device rotation" (migration procedure) // we should verify if this RPC is called by primary device only let new_list = SignedDeviceList::try_from(request.into_inner())?; let update = DeviceListUpdate::try_from(new_list)?; self .db_client .apply_devicelist_update(&user_id, update) .await .map_err(handle_db_error)?; Ok(Response::new(Empty {})) } async fn link_farcaster_account( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, _) = get_user_and_device_id(&request)?; let message = request.into_inner(); let mut get_farcaster_users_response = self .db_client .get_farcaster_users(vec![message.farcaster_id.clone()]) .await .map_err(handle_db_error)?; if get_farcaster_users_response.len() > 1 { error!("multiple users associated with the same Farcaster ID"); return Err(Status::failed_precondition("cannot link Farcaster ID")); } if let Some(u) = get_farcaster_users_response.pop() { if u.0.user_id == user_id { return Ok(Response::new(Empty {})); } else { return Err(Status::already_exists( "farcaster ID already associated with different user", )); } } self .db_client .add_farcaster_id(user_id, message.farcaster_id) .await .map_err(handle_db_error)?; let response = Empty {}; Ok(Response::new(response)) } async fn unlink_farcaster_account( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, _) = get_user_and_device_id(&request)?; self .db_client .remove_farcaster_id(user_id) .await .map_err(handle_db_error)?; let response = Empty {}; Ok(Response::new(response)) } async fn find_user_identity( &self, request: tonic::Request, ) -> Result, tonic::Status> { use identity::IdentityInfo; let message = request.into_inner(); let identifier = self .db_client .get_user_identifier(&message.user_id) .await .map_err(handle_db_error)? .ok_or_else(|| tonic::Status::not_found("user not found"))?; let identity_info = IdentityInfo::try_from(identifier)?; let identity = Some(Identity { identity_info: Some(identity_info), }); let response = Response::new(UserIdentityResponse { identity }); return Ok(response); } } // raw device list that can be serialized to JSON (and then signed in the future) #[derive(serde::Serialize, serde::Deserialize)] 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::Deserialize)] #[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, }) } fn as_raw(&self) -> Result { // The device list payload is sent as an escaped JSON payload. // Escaped double quotes need to be trimmed before attempting to deserialize serde_json::from_str(&self.raw_device_list.replace(r#"\""#, r#"""#)) .map_err(|err| { warn!("Failed to deserialize raw device list: {}", err); tonic::Status::invalid_argument("invalid device list payload") }) } } impl TryFrom for SignedDeviceList { type Error = tonic::Status; fn try_from(request: UpdateDeviceListRequest) -> Result { serde_json::from_str(&request.new_device_list).map_err(|err| { warn!("Failed to deserialize device list update: {}", err); tonic::Status::invalid_argument("invalid device list payload") }) } } impl TryFrom for DeviceListUpdate { type Error = tonic::Status; fn try_from(signed_list: SignedDeviceList) -> Result { let RawDeviceList { devices, timestamp: raw_timestamp, } = signed_list.as_raw()?; let timestamp = DateTime::::from_utc_timestamp_millis(raw_timestamp) .ok_or_else(|| { error!("Failed to parse RawDeviceList timestamp!"); tonic::Status::invalid_argument("invalid timestamp") })?; Ok(DeviceListUpdate::new(devices, timestamp)) } } #[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); } #[test] fn deserialize_device_list_update() { let raw_payload = r#"{"rawDeviceList":"{\"devices\":[\"device1\",\"device2\"],\"timestamp\":123456789}"}"#; let request = UpdateDeviceListRequest { new_device_list: raw_payload.to_string(), }; let signed_list = SignedDeviceList::try_from(request) .expect("Failed to parse SignedDeviceList"); let update = DeviceListUpdate::try_from(signed_list) .expect("Failed to parse DeviceListUpdate from signed list"); let expected_timestamp = DateTime::::from_utc_timestamp_millis(123456789).unwrap(); assert_eq!(update.timestamp, expected_timestamp); assert_eq!( update.devices, vec!["device1".to_string(), "device2".to_string()] ); } } diff --git a/shared/protos/identity_auth.proto b/shared/protos/identity_auth.proto index db40cc3f6..25ea2674c 100644 --- a/shared/protos/identity_auth.proto +++ b/shared/protos/identity_auth.proto @@ -1,228 +1,229 @@ syntax = "proto3"; import "identity_unauth.proto"; 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.unauth.Empty) {} // Rotate a device's prekey and prekey signature // Rotated for deniability of older messages rpc RefreshUserPrekeys(RefreshUserPrekeysRequest) 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 return // identity keys (both content and notif keys) and related prekeys per device, // but will not contain one-time keys. Additionally, the response will contain // the other user's username. rpc GetInboundKeysForUser(InboundKeysForUserRequest) returns (InboundKeysForUserResponse) {} // Called by clients to get required keys for opening a connection // to a user's keyserver rpc GetKeyserverKeys(OutboundKeysForUserRequest) returns (KeyserverKeysResponse) {} /* Account actions */ // Called by user to update password and receive new access token rpc UpdateUserPasswordStart(UpdateUserPasswordStartRequest) returns (UpdateUserPasswordStartResponse) {} rpc UpdateUserPasswordFinish(UpdateUserPasswordFinishRequest) returns (identity.unauth.Empty) {} // Called by user to log out (clears device's keys and access token) rpc LogOutUser(identity.unauth.Empty) returns (identity.unauth.Empty) {} // Called by a user to delete their own account rpc DeleteUser(identity.unauth.Empty) returns (identity.unauth.Empty) {} /* Device list actions */ // Returns device list history rpc GetDeviceListForUser(GetDeviceListRequest) returns (GetDeviceListResponse) {} rpc UpdateDeviceList(UpdateDeviceListRequest) returns (identity.unauth.Empty) {} /* Farcaster actions */ // Called by an existing user to link their Farcaster account rpc LinkFarcasterAccount(LinkFarcasterAccountRequest) returns (identity.unauth.Empty) {} // Called by an existing user to unlink their Farcaster account rpc UnlinkFarcasterAccount(identity.unauth.Empty) returns (identity.unauth.Empty) {} /* Miscellaneous actions */ rpc FindUserIdentity(UserIdentityRequest) returns (UserIdentityResponse) {} } // Helper types message EthereumIdentity { string wallet_address = 1; string social_proof = 2; } message Identity { oneof identity_info { string username = 1; EthereumIdentity eth_identity = 2; } } // 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.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.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; Identity identity = 2; + identity.unauth.IdentityKeyInfo primary_device_identity_info = 3; } // 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.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; Identity identity = 2; } message InboundKeysForUserRequest { string user_id = 1; } // 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; } // UpdateDeviceListForUser message UpdateDeviceListRequest { // A stringified JSON object of the following format: // { // "rawDeviceList": JSON.stringify({ // "devices": [, ...] // "timestamp": , // }) // } string new_device_list = 1; } // LinkFarcasterAccount message LinkFarcasterAccountRequest { string farcaster_id = 1; } // FindUserIdentity message UserIdentityRequest { // user ID for which we want to get the identity string user_id = 1; } message UserIdentityResponse { Identity identity = 1; } diff --git a/web/protobufs/identity-auth-structs.cjs b/web/protobufs/identity-auth-structs.cjs index ddaf34315..55213e5ba 100644 --- a/web/protobufs/identity-auth-structs.cjs +++ b/web/protobufs/identity-auth-structs.cjs @@ -1,4040 +1,4091 @@ // source: identity_auth.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_unauth_pb = require('./identity-unauth-structs.cjs'); goog.object.extend(proto, identity_unauth_pb); goog.exportSymbol('proto.identity.auth.EthereumIdentity', null, global); goog.exportSymbol('proto.identity.auth.GetDeviceListRequest', null, global); goog.exportSymbol('proto.identity.auth.GetDeviceListResponse', null, global); goog.exportSymbol('proto.identity.auth.Identity', null, global); goog.exportSymbol('proto.identity.auth.Identity.IdentityInfoCase', null, global); goog.exportSymbol('proto.identity.auth.InboundKeyInfo', null, global); goog.exportSymbol('proto.identity.auth.InboundKeysForUserRequest', null, global); goog.exportSymbol('proto.identity.auth.InboundKeysForUserResponse', null, global); goog.exportSymbol('proto.identity.auth.KeyserverKeysResponse', null, global); goog.exportSymbol('proto.identity.auth.LinkFarcasterAccountRequest', null, global); goog.exportSymbol('proto.identity.auth.OutboundKeyInfo', null, global); goog.exportSymbol('proto.identity.auth.OutboundKeysForUserRequest', null, global); goog.exportSymbol('proto.identity.auth.OutboundKeysForUserResponse', null, global); goog.exportSymbol('proto.identity.auth.RefreshUserPrekeysRequest', null, global); goog.exportSymbol('proto.identity.auth.UpdateDeviceListRequest', null, global); goog.exportSymbol('proto.identity.auth.UpdateUserPasswordFinishRequest', null, global); goog.exportSymbol('proto.identity.auth.UpdateUserPasswordStartRequest', null, global); goog.exportSymbol('proto.identity.auth.UpdateUserPasswordStartResponse', null, global); goog.exportSymbol('proto.identity.auth.UploadOneTimeKeysRequest', null, global); goog.exportSymbol('proto.identity.auth.UserIdentityRequest', null, global); goog.exportSymbol('proto.identity.auth.UserIdentityResponse', 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.auth.EthereumIdentity = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.EthereumIdentity, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.EthereumIdentity.displayName = 'proto.identity.auth.EthereumIdentity'; } /** * 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.auth.Identity = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, proto.identity.auth.Identity.oneofGroups_); }; goog.inherits(proto.identity.auth.Identity, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.Identity.displayName = 'proto.identity.auth.Identity'; } /** * 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.auth.UploadOneTimeKeysRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.identity.auth.UploadOneTimeKeysRequest.repeatedFields_, null); }; goog.inherits(proto.identity.auth.UploadOneTimeKeysRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UploadOneTimeKeysRequest.displayName = 'proto.identity.auth.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.auth.RefreshUserPrekeysRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.RefreshUserPrekeysRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.RefreshUserPrekeysRequest.displayName = 'proto.identity.auth.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.auth.OutboundKeyInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.OutboundKeyInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.OutboundKeyInfo.displayName = 'proto.identity.auth.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.auth.KeyserverKeysResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.KeyserverKeysResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.KeyserverKeysResponse.displayName = 'proto.identity.auth.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.auth.OutboundKeysForUserResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.OutboundKeysForUserResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.OutboundKeysForUserResponse.displayName = 'proto.identity.auth.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.auth.OutboundKeysForUserRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.OutboundKeysForUserRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.OutboundKeysForUserRequest.displayName = 'proto.identity.auth.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.auth.InboundKeyInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.InboundKeyInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.InboundKeyInfo.displayName = 'proto.identity.auth.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.auth.InboundKeysForUserResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.InboundKeysForUserResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.InboundKeysForUserResponse.displayName = 'proto.identity.auth.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.auth.InboundKeysForUserRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.InboundKeysForUserRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.InboundKeysForUserRequest.displayName = 'proto.identity.auth.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.auth.UpdateUserPasswordStartRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.UpdateUserPasswordStartRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UpdateUserPasswordStartRequest.displayName = 'proto.identity.auth.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.auth.UpdateUserPasswordFinishRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.UpdateUserPasswordFinishRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UpdateUserPasswordFinishRequest.displayName = 'proto.identity.auth.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.auth.UpdateUserPasswordStartResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.UpdateUserPasswordStartResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UpdateUserPasswordStartResponse.displayName = 'proto.identity.auth.UpdateUserPasswordStartResponse'; } /** * 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.auth.GetDeviceListRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.GetDeviceListRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.GetDeviceListRequest.displayName = 'proto.identity.auth.GetDeviceListRequest'; } /** * 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.auth.GetDeviceListResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.identity.auth.GetDeviceListResponse.repeatedFields_, null); }; goog.inherits(proto.identity.auth.GetDeviceListResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.GetDeviceListResponse.displayName = 'proto.identity.auth.GetDeviceListResponse'; } /** * 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.auth.UpdateDeviceListRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.UpdateDeviceListRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UpdateDeviceListRequest.displayName = 'proto.identity.auth.UpdateDeviceListRequest'; } /** * 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.auth.LinkFarcasterAccountRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.LinkFarcasterAccountRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.LinkFarcasterAccountRequest.displayName = 'proto.identity.auth.LinkFarcasterAccountRequest'; } /** * 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.auth.UserIdentityRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.UserIdentityRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UserIdentityRequest.displayName = 'proto.identity.auth.UserIdentityRequest'; } /** * 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.auth.UserIdentityResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.UserIdentityResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UserIdentityResponse.displayName = 'proto.identity.auth.UserIdentityResponse'; } 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.auth.EthereumIdentity.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.EthereumIdentity.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.auth.EthereumIdentity} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.EthereumIdentity.toObject = function(includeInstance, msg) { var f, obj = { walletAddress: jspb.Message.getFieldWithDefault(msg, 1, ""), socialProof: 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.auth.EthereumIdentity} */ proto.identity.auth.EthereumIdentity.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.EthereumIdentity; return proto.identity.auth.EthereumIdentity.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.EthereumIdentity} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.EthereumIdentity} */ proto.identity.auth.EthereumIdentity.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.setWalletAddress(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setSocialProof(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.EthereumIdentity.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.EthereumIdentity.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.auth.EthereumIdentity} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.EthereumIdentity.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getWalletAddress(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getSocialProof(); if (f.length > 0) { writer.writeString( 2, f ); } }; /** * optional string wallet_address = 1; * @return {string} */ proto.identity.auth.EthereumIdentity.prototype.getWalletAddress = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.EthereumIdentity} returns this */ proto.identity.auth.EthereumIdentity.prototype.setWalletAddress = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string social_proof = 2; * @return {string} */ proto.identity.auth.EthereumIdentity.prototype.getSocialProof = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.auth.EthereumIdentity} returns this */ proto.identity.auth.EthereumIdentity.prototype.setSocialProof = function(value) { return jspb.Message.setProto3StringField(this, 2, 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.auth.Identity.oneofGroups_ = [[1,2]]; /** * @enum {number} */ proto.identity.auth.Identity.IdentityInfoCase = { IDENTITY_INFO_NOT_SET: 0, USERNAME: 1, ETH_IDENTITY: 2 }; /** * @return {proto.identity.auth.Identity.IdentityInfoCase} */ proto.identity.auth.Identity.prototype.getIdentityInfoCase = function() { return /** @type {proto.identity.auth.Identity.IdentityInfoCase} */(jspb.Message.computeOneofCase(this, proto.identity.auth.Identity.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.auth.Identity.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.Identity.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.auth.Identity} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.Identity.toObject = function(includeInstance, msg) { var f, obj = { username: jspb.Message.getFieldWithDefault(msg, 1, ""), ethIdentity: (f = msg.getEthIdentity()) && proto.identity.auth.EthereumIdentity.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.auth.Identity} */ proto.identity.auth.Identity.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.Identity; return proto.identity.auth.Identity.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.Identity} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.Identity} */ proto.identity.auth.Identity.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 = new proto.identity.auth.EthereumIdentity; reader.readMessage(value,proto.identity.auth.EthereumIdentity.deserializeBinaryFromReader); msg.setEthIdentity(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.Identity.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.Identity.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.auth.Identity} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.Identity.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { writer.writeString( 1, f ); } f = message.getEthIdentity(); if (f != null) { writer.writeMessage( 2, f, proto.identity.auth.EthereumIdentity.serializeBinaryToWriter ); } }; /** * optional string username = 1; * @return {string} */ proto.identity.auth.Identity.prototype.getUsername = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.Identity} returns this */ proto.identity.auth.Identity.prototype.setUsername = function(value) { return jspb.Message.setOneofField(this, 1, proto.identity.auth.Identity.oneofGroups_[0], value); }; /** * Clears the field making it undefined. * @return {!proto.identity.auth.Identity} returns this */ proto.identity.auth.Identity.prototype.clearUsername = function() { return jspb.Message.setOneofField(this, 1, proto.identity.auth.Identity.oneofGroups_[0], undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.Identity.prototype.hasUsername = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional EthereumIdentity eth_identity = 2; * @return {?proto.identity.auth.EthereumIdentity} */ proto.identity.auth.Identity.prototype.getEthIdentity = function() { return /** @type{?proto.identity.auth.EthereumIdentity} */ ( jspb.Message.getWrapperField(this, proto.identity.auth.EthereumIdentity, 2)); }; /** * @param {?proto.identity.auth.EthereumIdentity|undefined} value * @return {!proto.identity.auth.Identity} returns this */ proto.identity.auth.Identity.prototype.setEthIdentity = function(value) { return jspb.Message.setOneofWrapperField(this, 2, proto.identity.auth.Identity.oneofGroups_[0], value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.Identity} returns this */ proto.identity.auth.Identity.prototype.clearEthIdentity = function() { return this.setEthIdentity(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.Identity.prototype.hasEthIdentity = function() { return jspb.Message.getField(this, 2) != null; }; /** * List of repeated fields within this message type. * @private {!Array} * @const */ proto.identity.auth.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.auth.UploadOneTimeKeysRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.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.auth.UploadOneTimeKeysRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.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.auth.UploadOneTimeKeysRequest} */ proto.identity.auth.UploadOneTimeKeysRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UploadOneTimeKeysRequest; return proto.identity.auth.UploadOneTimeKeysRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UploadOneTimeKeysRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UploadOneTimeKeysRequest} */ proto.identity.auth.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.auth.UploadOneTimeKeysRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.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.auth.UploadOneTimeKeysRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.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 content_one_time_prekeys = 1; * @return {!Array} */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.getContentOneTimePrekeysList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** * @param {!Array} value * @return {!proto.identity.auth.UploadOneTimeKeysRequest} returns this */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.setContentOneTimePrekeysList = function(value) { return jspb.Message.setField(this, 1, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.auth.UploadOneTimeKeysRequest} returns this */ proto.identity.auth.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.auth.UploadOneTimeKeysRequest} returns this */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.clearContentOneTimePrekeysList = function() { return this.setContentOneTimePrekeysList([]); }; /** * repeated string notif_one_time_prekeys = 2; * @return {!Array} */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.getNotifOneTimePrekeysList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; /** * @param {!Array} value * @return {!proto.identity.auth.UploadOneTimeKeysRequest} returns this */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.setNotifOneTimePrekeysList = function(value) { return jspb.Message.setField(this, 2, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.auth.UploadOneTimeKeysRequest} returns this */ proto.identity.auth.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.auth.UploadOneTimeKeysRequest} returns this */ proto.identity.auth.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.auth.RefreshUserPrekeysRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.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.auth.RefreshUserPrekeysRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.RefreshUserPrekeysRequest.toObject = function(includeInstance, msg) { var f, obj = { newContentPrekeys: (f = msg.getNewContentPrekeys()) && identity_unauth_pb.Prekey.toObject(includeInstance, f), newNotifPrekeys: (f = msg.getNewNotifPrekeys()) && identity_unauth_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.auth.RefreshUserPrekeysRequest} */ proto.identity.auth.RefreshUserPrekeysRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.RefreshUserPrekeysRequest; return proto.identity.auth.RefreshUserPrekeysRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.RefreshUserPrekeysRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.RefreshUserPrekeysRequest} */ proto.identity.auth.RefreshUserPrekeysRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new identity_unauth_pb.Prekey; reader.readMessage(value,identity_unauth_pb.Prekey.deserializeBinaryFromReader); msg.setNewContentPrekeys(value); break; case 2: var value = new identity_unauth_pb.Prekey; reader.readMessage(value,identity_unauth_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.auth.RefreshUserPrekeysRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.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.auth.RefreshUserPrekeysRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.RefreshUserPrekeysRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNewContentPrekeys(); if (f != null) { writer.writeMessage( 1, f, identity_unauth_pb.Prekey.serializeBinaryToWriter ); } f = message.getNewNotifPrekeys(); if (f != null) { writer.writeMessage( 2, f, identity_unauth_pb.Prekey.serializeBinaryToWriter ); } }; /** * optional identity.unauth.Prekey new_content_prekeys = 1; * @return {?proto.identity.unauth.Prekey} */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.getNewContentPrekeys = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.Prekey, 1)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.auth.RefreshUserPrekeysRequest} returns this */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.setNewContentPrekeys = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.RefreshUserPrekeysRequest} returns this */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.clearNewContentPrekeys = function() { return this.setNewContentPrekeys(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.hasNewContentPrekeys = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional identity.unauth.Prekey new_notif_prekeys = 2; * @return {?proto.identity.unauth.Prekey} */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.getNewNotifPrekeys = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.Prekey, 2)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.auth.RefreshUserPrekeysRequest} returns this */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.setNewNotifPrekeys = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.RefreshUserPrekeysRequest} returns this */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.clearNewNotifPrekeys = function() { return this.setNewNotifPrekeys(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.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.auth.OutboundKeyInfo.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.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.auth.OutboundKeyInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.OutboundKeyInfo.toObject = function(includeInstance, msg) { var f, obj = { identityInfo: (f = msg.getIdentityInfo()) && identity_unauth_pb.IdentityKeyInfo.toObject(includeInstance, f), contentPrekey: (f = msg.getContentPrekey()) && identity_unauth_pb.Prekey.toObject(includeInstance, f), notifPrekey: (f = msg.getNotifPrekey()) && identity_unauth_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.auth.OutboundKeyInfo} */ proto.identity.auth.OutboundKeyInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.OutboundKeyInfo; return proto.identity.auth.OutboundKeyInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.OutboundKeyInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.OutboundKeyInfo} */ proto.identity.auth.OutboundKeyInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new identity_unauth_pb.IdentityKeyInfo; reader.readMessage(value,identity_unauth_pb.IdentityKeyInfo.deserializeBinaryFromReader); msg.setIdentityInfo(value); break; case 2: var value = new identity_unauth_pb.Prekey; reader.readMessage(value,identity_unauth_pb.Prekey.deserializeBinaryFromReader); msg.setContentPrekey(value); break; case 3: var value = new identity_unauth_pb.Prekey; reader.readMessage(value,identity_unauth_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.auth.OutboundKeyInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.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.auth.OutboundKeyInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.OutboundKeyInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getIdentityInfo(); if (f != null) { writer.writeMessage( 1, f, identity_unauth_pb.IdentityKeyInfo.serializeBinaryToWriter ); } f = message.getContentPrekey(); if (f != null) { writer.writeMessage( 2, f, identity_unauth_pb.Prekey.serializeBinaryToWriter ); } f = message.getNotifPrekey(); if (f != null) { writer.writeMessage( 3, f, identity_unauth_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.unauth.IdentityKeyInfo identity_info = 1; * @return {?proto.identity.unauth.IdentityKeyInfo} */ proto.identity.auth.OutboundKeyInfo.prototype.getIdentityInfo = function() { return /** @type{?proto.identity.unauth.IdentityKeyInfo} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.IdentityKeyInfo, 1)); }; /** * @param {?proto.identity.unauth.IdentityKeyInfo|undefined} value * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.setIdentityInfo = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.clearIdentityInfo = function() { return this.setIdentityInfo(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.OutboundKeyInfo.prototype.hasIdentityInfo = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional identity.unauth.Prekey content_prekey = 2; * @return {?proto.identity.unauth.Prekey} */ proto.identity.auth.OutboundKeyInfo.prototype.getContentPrekey = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.Prekey, 2)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.setContentPrekey = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.clearContentPrekey = function() { return this.setContentPrekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.OutboundKeyInfo.prototype.hasContentPrekey = function() { return jspb.Message.getField(this, 2) != null; }; /** * optional identity.unauth.Prekey notif_prekey = 3; * @return {?proto.identity.unauth.Prekey} */ proto.identity.auth.OutboundKeyInfo.prototype.getNotifPrekey = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.Prekey, 3)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.setNotifPrekey = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.clearNotifPrekey = function() { return this.setNotifPrekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.OutboundKeyInfo.prototype.hasNotifPrekey = function() { return jspb.Message.getField(this, 3) != null; }; /** * optional string one_time_content_prekey = 4; * @return {string} */ proto.identity.auth.OutboundKeyInfo.prototype.getOneTimeContentPrekey = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * @param {string} value * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.setOneTimeContentPrekey = function(value) { return jspb.Message.setField(this, 4, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.clearOneTimeContentPrekey = function() { return jspb.Message.setField(this, 4, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.OutboundKeyInfo.prototype.hasOneTimeContentPrekey = function() { return jspb.Message.getField(this, 4) != null; }; /** * optional string one_time_notif_prekey = 5; * @return {string} */ proto.identity.auth.OutboundKeyInfo.prototype.getOneTimeNotifPrekey = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; /** * @param {string} value * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.setOneTimeNotifPrekey = function(value) { return jspb.Message.setField(this, 5, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.clearOneTimeNotifPrekey = function() { return jspb.Message.setField(this, 5, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.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.auth.KeyserverKeysResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.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.auth.KeyserverKeysResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.KeyserverKeysResponse.toObject = function(includeInstance, msg) { var f, obj = { keyserverInfo: (f = msg.getKeyserverInfo()) && proto.identity.auth.OutboundKeyInfo.toObject(includeInstance, f), - identity: (f = msg.getIdentity()) && proto.identity.auth.Identity.toObject(includeInstance, f) + identity: (f = msg.getIdentity()) && proto.identity.auth.Identity.toObject(includeInstance, f), + primaryDeviceIdentityInfo: (f = msg.getPrimaryDeviceIdentityInfo()) && identity_unauth_pb.IdentityKeyInfo.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.auth.KeyserverKeysResponse} */ proto.identity.auth.KeyserverKeysResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.KeyserverKeysResponse; return proto.identity.auth.KeyserverKeysResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.KeyserverKeysResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.KeyserverKeysResponse} */ proto.identity.auth.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.auth.OutboundKeyInfo; reader.readMessage(value,proto.identity.auth.OutboundKeyInfo.deserializeBinaryFromReader); msg.setKeyserverInfo(value); break; case 2: var value = new proto.identity.auth.Identity; reader.readMessage(value,proto.identity.auth.Identity.deserializeBinaryFromReader); msg.setIdentity(value); break; + case 3: + var value = new identity_unauth_pb.IdentityKeyInfo; + reader.readMessage(value,identity_unauth_pb.IdentityKeyInfo.deserializeBinaryFromReader); + msg.setPrimaryDeviceIdentityInfo(value); + break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.KeyserverKeysResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.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.auth.KeyserverKeysResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.KeyserverKeysResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getKeyserverInfo(); if (f != null) { writer.writeMessage( 1, f, proto.identity.auth.OutboundKeyInfo.serializeBinaryToWriter ); } f = message.getIdentity(); if (f != null) { writer.writeMessage( 2, f, proto.identity.auth.Identity.serializeBinaryToWriter ); } + f = message.getPrimaryDeviceIdentityInfo(); + if (f != null) { + writer.writeMessage( + 3, + f, + identity_unauth_pb.IdentityKeyInfo.serializeBinaryToWriter + ); + } }; /** * optional OutboundKeyInfo keyserver_info = 1; * @return {?proto.identity.auth.OutboundKeyInfo} */ proto.identity.auth.KeyserverKeysResponse.prototype.getKeyserverInfo = function() { return /** @type{?proto.identity.auth.OutboundKeyInfo} */ ( jspb.Message.getWrapperField(this, proto.identity.auth.OutboundKeyInfo, 1)); }; /** * @param {?proto.identity.auth.OutboundKeyInfo|undefined} value * @return {!proto.identity.auth.KeyserverKeysResponse} returns this */ proto.identity.auth.KeyserverKeysResponse.prototype.setKeyserverInfo = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.KeyserverKeysResponse} returns this */ proto.identity.auth.KeyserverKeysResponse.prototype.clearKeyserverInfo = function() { return this.setKeyserverInfo(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.KeyserverKeysResponse.prototype.hasKeyserverInfo = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional Identity identity = 2; * @return {?proto.identity.auth.Identity} */ proto.identity.auth.KeyserverKeysResponse.prototype.getIdentity = function() { return /** @type{?proto.identity.auth.Identity} */ ( jspb.Message.getWrapperField(this, proto.identity.auth.Identity, 2)); }; /** * @param {?proto.identity.auth.Identity|undefined} value * @return {!proto.identity.auth.KeyserverKeysResponse} returns this */ proto.identity.auth.KeyserverKeysResponse.prototype.setIdentity = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.KeyserverKeysResponse} returns this */ proto.identity.auth.KeyserverKeysResponse.prototype.clearIdentity = function() { return this.setIdentity(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.KeyserverKeysResponse.prototype.hasIdentity = function() { return jspb.Message.getField(this, 2) != null; }; +/** + * optional identity.unauth.IdentityKeyInfo primary_device_identity_info = 3; + * @return {?proto.identity.unauth.IdentityKeyInfo} + */ +proto.identity.auth.KeyserverKeysResponse.prototype.getPrimaryDeviceIdentityInfo = function() { + return /** @type{?proto.identity.unauth.IdentityKeyInfo} */ ( + jspb.Message.getWrapperField(this, identity_unauth_pb.IdentityKeyInfo, 3)); +}; + + +/** + * @param {?proto.identity.unauth.IdentityKeyInfo|undefined} value + * @return {!proto.identity.auth.KeyserverKeysResponse} returns this +*/ +proto.identity.auth.KeyserverKeysResponse.prototype.setPrimaryDeviceIdentityInfo = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.identity.auth.KeyserverKeysResponse} returns this + */ +proto.identity.auth.KeyserverKeysResponse.prototype.clearPrimaryDeviceIdentityInfo = function() { + return this.setPrimaryDeviceIdentityInfo(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.identity.auth.KeyserverKeysResponse.prototype.hasPrimaryDeviceIdentityInfo = 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.auth.OutboundKeysForUserResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.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.auth.OutboundKeysForUserResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.OutboundKeysForUserResponse.toObject = function(includeInstance, msg) { var f, obj = { devicesMap: (f = msg.getDevicesMap()) ? f.toObject(includeInstance, proto.identity.auth.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.auth.OutboundKeysForUserResponse} */ proto.identity.auth.OutboundKeysForUserResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.OutboundKeysForUserResponse; return proto.identity.auth.OutboundKeysForUserResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.OutboundKeysForUserResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.OutboundKeysForUserResponse} */ proto.identity.auth.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.auth.OutboundKeyInfo.deserializeBinaryFromReader, "", new proto.identity.auth.OutboundKeyInfo()); }); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.OutboundKeysForUserResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.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.auth.OutboundKeysForUserResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.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.auth.OutboundKeyInfo.serializeBinaryToWriter); } }; /** * map devices = 1; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.identity.auth.OutboundKeysForUserResponse.prototype.getDevicesMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 1, opt_noLazyCreate, proto.identity.auth.OutboundKeyInfo)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.identity.auth.OutboundKeysForUserResponse} returns this */ proto.identity.auth.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.auth.OutboundKeysForUserRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.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.auth.OutboundKeysForUserRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.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.auth.OutboundKeysForUserRequest} */ proto.identity.auth.OutboundKeysForUserRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.OutboundKeysForUserRequest; return proto.identity.auth.OutboundKeysForUserRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.OutboundKeysForUserRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.OutboundKeysForUserRequest} */ proto.identity.auth.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.auth.OutboundKeysForUserRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.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.auth.OutboundKeysForUserRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.OutboundKeysForUserRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.auth.OutboundKeysForUserRequest.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.OutboundKeysForUserRequest} returns this */ proto.identity.auth.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.auth.InboundKeyInfo.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.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.auth.InboundKeyInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.InboundKeyInfo.toObject = function(includeInstance, msg) { var f, obj = { identityInfo: (f = msg.getIdentityInfo()) && identity_unauth_pb.IdentityKeyInfo.toObject(includeInstance, f), contentPrekey: (f = msg.getContentPrekey()) && identity_unauth_pb.Prekey.toObject(includeInstance, f), notifPrekey: (f = msg.getNotifPrekey()) && identity_unauth_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.auth.InboundKeyInfo} */ proto.identity.auth.InboundKeyInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.InboundKeyInfo; return proto.identity.auth.InboundKeyInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.InboundKeyInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.InboundKeyInfo} */ proto.identity.auth.InboundKeyInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new identity_unauth_pb.IdentityKeyInfo; reader.readMessage(value,identity_unauth_pb.IdentityKeyInfo.deserializeBinaryFromReader); msg.setIdentityInfo(value); break; case 2: var value = new identity_unauth_pb.Prekey; reader.readMessage(value,identity_unauth_pb.Prekey.deserializeBinaryFromReader); msg.setContentPrekey(value); break; case 3: var value = new identity_unauth_pb.Prekey; reader.readMessage(value,identity_unauth_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.auth.InboundKeyInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.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.auth.InboundKeyInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.InboundKeyInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getIdentityInfo(); if (f != null) { writer.writeMessage( 1, f, identity_unauth_pb.IdentityKeyInfo.serializeBinaryToWriter ); } f = message.getContentPrekey(); if (f != null) { writer.writeMessage( 2, f, identity_unauth_pb.Prekey.serializeBinaryToWriter ); } f = message.getNotifPrekey(); if (f != null) { writer.writeMessage( 3, f, identity_unauth_pb.Prekey.serializeBinaryToWriter ); } }; /** * optional identity.unauth.IdentityKeyInfo identity_info = 1; * @return {?proto.identity.unauth.IdentityKeyInfo} */ proto.identity.auth.InboundKeyInfo.prototype.getIdentityInfo = function() { return /** @type{?proto.identity.unauth.IdentityKeyInfo} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.IdentityKeyInfo, 1)); }; /** * @param {?proto.identity.unauth.IdentityKeyInfo|undefined} value * @return {!proto.identity.auth.InboundKeyInfo} returns this */ proto.identity.auth.InboundKeyInfo.prototype.setIdentityInfo = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.InboundKeyInfo} returns this */ proto.identity.auth.InboundKeyInfo.prototype.clearIdentityInfo = function() { return this.setIdentityInfo(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.InboundKeyInfo.prototype.hasIdentityInfo = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional identity.unauth.Prekey content_prekey = 2; * @return {?proto.identity.unauth.Prekey} */ proto.identity.auth.InboundKeyInfo.prototype.getContentPrekey = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.Prekey, 2)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.auth.InboundKeyInfo} returns this */ proto.identity.auth.InboundKeyInfo.prototype.setContentPrekey = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.InboundKeyInfo} returns this */ proto.identity.auth.InboundKeyInfo.prototype.clearContentPrekey = function() { return this.setContentPrekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.InboundKeyInfo.prototype.hasContentPrekey = function() { return jspb.Message.getField(this, 2) != null; }; /** * optional identity.unauth.Prekey notif_prekey = 3; * @return {?proto.identity.unauth.Prekey} */ proto.identity.auth.InboundKeyInfo.prototype.getNotifPrekey = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.Prekey, 3)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.auth.InboundKeyInfo} returns this */ proto.identity.auth.InboundKeyInfo.prototype.setNotifPrekey = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.InboundKeyInfo} returns this */ proto.identity.auth.InboundKeyInfo.prototype.clearNotifPrekey = function() { return this.setNotifPrekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.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.auth.InboundKeysForUserResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.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.auth.InboundKeysForUserResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.InboundKeysForUserResponse.toObject = function(includeInstance, msg) { var f, obj = { devicesMap: (f = msg.getDevicesMap()) ? f.toObject(includeInstance, proto.identity.auth.InboundKeyInfo.toObject) : [], identity: (f = msg.getIdentity()) && proto.identity.auth.Identity.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.auth.InboundKeysForUserResponse} */ proto.identity.auth.InboundKeysForUserResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.InboundKeysForUserResponse; return proto.identity.auth.InboundKeysForUserResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.InboundKeysForUserResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.InboundKeysForUserResponse} */ proto.identity.auth.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.auth.InboundKeyInfo.deserializeBinaryFromReader, "", new proto.identity.auth.InboundKeyInfo()); }); break; case 2: var value = new proto.identity.auth.Identity; reader.readMessage(value,proto.identity.auth.Identity.deserializeBinaryFromReader); msg.setIdentity(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.InboundKeysForUserResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.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.auth.InboundKeysForUserResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.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.auth.InboundKeyInfo.serializeBinaryToWriter); } f = message.getIdentity(); if (f != null) { writer.writeMessage( 2, f, proto.identity.auth.Identity.serializeBinaryToWriter ); } }; /** * map devices = 1; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.identity.auth.InboundKeysForUserResponse.prototype.getDevicesMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 1, opt_noLazyCreate, proto.identity.auth.InboundKeyInfo)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.identity.auth.InboundKeysForUserResponse} returns this */ proto.identity.auth.InboundKeysForUserResponse.prototype.clearDevicesMap = function() { this.getDevicesMap().clear(); return this; }; /** * optional Identity identity = 2; * @return {?proto.identity.auth.Identity} */ proto.identity.auth.InboundKeysForUserResponse.prototype.getIdentity = function() { return /** @type{?proto.identity.auth.Identity} */ ( jspb.Message.getWrapperField(this, proto.identity.auth.Identity, 2)); }; /** * @param {?proto.identity.auth.Identity|undefined} value * @return {!proto.identity.auth.InboundKeysForUserResponse} returns this */ proto.identity.auth.InboundKeysForUserResponse.prototype.setIdentity = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.InboundKeysForUserResponse} returns this */ proto.identity.auth.InboundKeysForUserResponse.prototype.clearIdentity = function() { return this.setIdentity(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.InboundKeysForUserResponse.prototype.hasIdentity = 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.auth.InboundKeysForUserRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.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.auth.InboundKeysForUserRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.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.auth.InboundKeysForUserRequest} */ proto.identity.auth.InboundKeysForUserRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.InboundKeysForUserRequest; return proto.identity.auth.InboundKeysForUserRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.InboundKeysForUserRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.InboundKeysForUserRequest} */ proto.identity.auth.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.auth.InboundKeysForUserRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.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.auth.InboundKeysForUserRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.InboundKeysForUserRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.auth.InboundKeysForUserRequest.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.InboundKeysForUserRequest} returns this */ proto.identity.auth.InboundKeysForUserRequest.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.auth.UpdateUserPasswordStartRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.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.auth.UpdateUserPasswordStartRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.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.auth.UpdateUserPasswordStartRequest} */ proto.identity.auth.UpdateUserPasswordStartRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UpdateUserPasswordStartRequest; return proto.identity.auth.UpdateUserPasswordStartRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UpdateUserPasswordStartRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UpdateUserPasswordStartRequest} */ proto.identity.auth.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.auth.UpdateUserPasswordStartRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.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.auth.UpdateUserPasswordStartRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UpdateUserPasswordStartRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getOpaqueRegistrationRequest_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } }; /** * optional bytes opaque_registration_request = 1; * @return {string} */ proto.identity.auth.UpdateUserPasswordStartRequest.prototype.getOpaqueRegistrationRequest = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * optional bytes opaque_registration_request = 1; * This is a type-conversion wrapper around `getOpaqueRegistrationRequest()` * @return {string} */ proto.identity.auth.UpdateUserPasswordStartRequest.prototype.getOpaqueRegistrationRequest_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getOpaqueRegistrationRequest())); }; /** * optional bytes opaque_registration_request = 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.auth.UpdateUserPasswordStartRequest.prototype.getOpaqueRegistrationRequest_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueRegistrationRequest())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.auth.UpdateUserPasswordStartRequest} returns this */ proto.identity.auth.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.auth.UpdateUserPasswordFinishRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.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.auth.UpdateUserPasswordFinishRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.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.auth.UpdateUserPasswordFinishRequest} */ proto.identity.auth.UpdateUserPasswordFinishRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UpdateUserPasswordFinishRequest; return proto.identity.auth.UpdateUserPasswordFinishRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UpdateUserPasswordFinishRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UpdateUserPasswordFinishRequest} */ proto.identity.auth.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.auth.UpdateUserPasswordFinishRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.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.auth.UpdateUserPasswordFinishRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.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 session_id = 1; * @return {string} */ proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.getSessionId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.UpdateUserPasswordFinishRequest} returns this */ proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.setSessionId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaque_registration_upload = 2; * @return {string} */ proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.getOpaqueRegistrationUpload = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * optional bytes opaque_registration_upload = 2; * This is a type-conversion wrapper around `getOpaqueRegistrationUpload()` * @return {string} */ proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.getOpaqueRegistrationUpload_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getOpaqueRegistrationUpload())); }; /** * optional bytes opaque_registration_upload = 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.auth.UpdateUserPasswordFinishRequest.prototype.getOpaqueRegistrationUpload_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueRegistrationUpload())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.auth.UpdateUserPasswordFinishRequest} returns this */ proto.identity.auth.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.auth.UpdateUserPasswordStartResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.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.auth.UpdateUserPasswordStartResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.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.auth.UpdateUserPasswordStartResponse} */ proto.identity.auth.UpdateUserPasswordStartResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UpdateUserPasswordStartResponse; return proto.identity.auth.UpdateUserPasswordStartResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UpdateUserPasswordStartResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UpdateUserPasswordStartResponse} */ proto.identity.auth.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.auth.UpdateUserPasswordStartResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.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.auth.UpdateUserPasswordStartResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.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 session_id = 1; * @return {string} */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.getSessionId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.UpdateUserPasswordStartResponse} returns this */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.setSessionId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaque_registration_response = 2; * @return {string} */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.getOpaqueRegistrationResponse = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * optional bytes opaque_registration_response = 2; * This is a type-conversion wrapper around `getOpaqueRegistrationResponse()` * @return {string} */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.getOpaqueRegistrationResponse_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getOpaqueRegistrationResponse())); }; /** * optional bytes opaque_registration_response = 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.auth.UpdateUserPasswordStartResponse.prototype.getOpaqueRegistrationResponse_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueRegistrationResponse())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.auth.UpdateUserPasswordStartResponse} returns this */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.setOpaqueRegistrationResponse = 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.auth.GetDeviceListRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.GetDeviceListRequest.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.auth.GetDeviceListRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.GetDeviceListRequest.toObject = function(includeInstance, msg) { var f, obj = { userId: jspb.Message.getFieldWithDefault(msg, 1, ""), sinceTimestamp: jspb.Message.getFieldWithDefault(msg, 2, 0) }; 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.auth.GetDeviceListRequest} */ proto.identity.auth.GetDeviceListRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.GetDeviceListRequest; return proto.identity.auth.GetDeviceListRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.GetDeviceListRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.GetDeviceListRequest} */ proto.identity.auth.GetDeviceListRequest.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 {number} */ (reader.readInt64()); msg.setSinceTimestamp(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.GetDeviceListRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.GetDeviceListRequest.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.auth.GetDeviceListRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.GetDeviceListRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { writer.writeString( 1, f ); } f = /** @type {number} */ (jspb.Message.getField(message, 2)); if (f != null) { writer.writeInt64( 2, f ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.auth.GetDeviceListRequest.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.GetDeviceListRequest} returns this */ proto.identity.auth.GetDeviceListRequest.prototype.setUserId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional int64 since_timestamp = 2; * @return {number} */ proto.identity.auth.GetDeviceListRequest.prototype.getSinceTimestamp = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value * @return {!proto.identity.auth.GetDeviceListRequest} returns this */ proto.identity.auth.GetDeviceListRequest.prototype.setSinceTimestamp = function(value) { return jspb.Message.setField(this, 2, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.auth.GetDeviceListRequest} returns this */ proto.identity.auth.GetDeviceListRequest.prototype.clearSinceTimestamp = function() { return jspb.Message.setField(this, 2, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.GetDeviceListRequest.prototype.hasSinceTimestamp = function() { return jspb.Message.getField(this, 2) != null; }; /** * List of repeated fields within this message type. * @private {!Array} * @const */ proto.identity.auth.GetDeviceListResponse.repeatedFields_ = [1]; 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.auth.GetDeviceListResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.GetDeviceListResponse.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.auth.GetDeviceListResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.GetDeviceListResponse.toObject = function(includeInstance, msg) { var f, obj = { deviceListUpdatesList: (f = jspb.Message.getRepeatedField(msg, 1)) == 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.auth.GetDeviceListResponse} */ proto.identity.auth.GetDeviceListResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.GetDeviceListResponse; return proto.identity.auth.GetDeviceListResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.GetDeviceListResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.GetDeviceListResponse} */ proto.identity.auth.GetDeviceListResponse.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.addDeviceListUpdates(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.GetDeviceListResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.GetDeviceListResponse.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.auth.GetDeviceListResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.GetDeviceListResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDeviceListUpdatesList(); if (f.length > 0) { writer.writeRepeatedString( 1, f ); } }; /** * repeated string device_list_updates = 1; * @return {!Array} */ proto.identity.auth.GetDeviceListResponse.prototype.getDeviceListUpdatesList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** * @param {!Array} value * @return {!proto.identity.auth.GetDeviceListResponse} returns this */ proto.identity.auth.GetDeviceListResponse.prototype.setDeviceListUpdatesList = function(value) { return jspb.Message.setField(this, 1, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.auth.GetDeviceListResponse} returns this */ proto.identity.auth.GetDeviceListResponse.prototype.addDeviceListUpdates = 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.auth.GetDeviceListResponse} returns this */ proto.identity.auth.GetDeviceListResponse.prototype.clearDeviceListUpdatesList = function() { return this.setDeviceListUpdatesList([]); }; 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.auth.UpdateDeviceListRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.UpdateDeviceListRequest.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.auth.UpdateDeviceListRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UpdateDeviceListRequest.toObject = function(includeInstance, msg) { var f, obj = { newDeviceList: 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.auth.UpdateDeviceListRequest} */ proto.identity.auth.UpdateDeviceListRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UpdateDeviceListRequest; return proto.identity.auth.UpdateDeviceListRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UpdateDeviceListRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UpdateDeviceListRequest} */ proto.identity.auth.UpdateDeviceListRequest.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.setNewDeviceList(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.UpdateDeviceListRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.UpdateDeviceListRequest.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.auth.UpdateDeviceListRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UpdateDeviceListRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNewDeviceList(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string new_device_list = 1; * @return {string} */ proto.identity.auth.UpdateDeviceListRequest.prototype.getNewDeviceList = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.UpdateDeviceListRequest} returns this */ proto.identity.auth.UpdateDeviceListRequest.prototype.setNewDeviceList = 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.auth.LinkFarcasterAccountRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.LinkFarcasterAccountRequest.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.auth.LinkFarcasterAccountRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.LinkFarcasterAccountRequest.toObject = function(includeInstance, msg) { var f, obj = { farcasterId: 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.auth.LinkFarcasterAccountRequest} */ proto.identity.auth.LinkFarcasterAccountRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.LinkFarcasterAccountRequest; return proto.identity.auth.LinkFarcasterAccountRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.LinkFarcasterAccountRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.LinkFarcasterAccountRequest} */ proto.identity.auth.LinkFarcasterAccountRequest.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.setFarcasterId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.LinkFarcasterAccountRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.LinkFarcasterAccountRequest.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.auth.LinkFarcasterAccountRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.LinkFarcasterAccountRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getFarcasterId(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string farcaster_id = 1; * @return {string} */ proto.identity.auth.LinkFarcasterAccountRequest.prototype.getFarcasterId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.LinkFarcasterAccountRequest} returns this */ proto.identity.auth.LinkFarcasterAccountRequest.prototype.setFarcasterId = 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.auth.UserIdentityRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.UserIdentityRequest.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.auth.UserIdentityRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UserIdentityRequest.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.auth.UserIdentityRequest} */ proto.identity.auth.UserIdentityRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UserIdentityRequest; return proto.identity.auth.UserIdentityRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UserIdentityRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UserIdentityRequest} */ proto.identity.auth.UserIdentityRequest.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.auth.UserIdentityRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.UserIdentityRequest.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.auth.UserIdentityRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UserIdentityRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.auth.UserIdentityRequest.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.UserIdentityRequest} returns this */ proto.identity.auth.UserIdentityRequest.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.auth.UserIdentityResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.UserIdentityResponse.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.auth.UserIdentityResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UserIdentityResponse.toObject = function(includeInstance, msg) { var f, obj = { identity: (f = msg.getIdentity()) && proto.identity.auth.Identity.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.auth.UserIdentityResponse} */ proto.identity.auth.UserIdentityResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UserIdentityResponse; return proto.identity.auth.UserIdentityResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UserIdentityResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UserIdentityResponse} */ proto.identity.auth.UserIdentityResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.identity.auth.Identity; reader.readMessage(value,proto.identity.auth.Identity.deserializeBinaryFromReader); msg.setIdentity(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.UserIdentityResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.UserIdentityResponse.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.auth.UserIdentityResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UserIdentityResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getIdentity(); if (f != null) { writer.writeMessage( 1, f, proto.identity.auth.Identity.serializeBinaryToWriter ); } }; /** * optional Identity identity = 1; * @return {?proto.identity.auth.Identity} */ proto.identity.auth.UserIdentityResponse.prototype.getIdentity = function() { return /** @type{?proto.identity.auth.Identity} */ ( jspb.Message.getWrapperField(this, proto.identity.auth.Identity, 1)); }; /** * @param {?proto.identity.auth.Identity|undefined} value * @return {!proto.identity.auth.UserIdentityResponse} returns this */ proto.identity.auth.UserIdentityResponse.prototype.setIdentity = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.UserIdentityResponse} returns this */ proto.identity.auth.UserIdentityResponse.prototype.clearIdentity = function() { return this.setIdentity(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.UserIdentityResponse.prototype.hasIdentity = function() { return jspb.Message.getField(this, 1) != null; }; goog.object.extend(exports, proto.identity.auth); diff --git a/web/protobufs/identity-auth-structs.cjs.flow b/web/protobufs/identity-auth-structs.cjs.flow index 4f5f46960..a6b739af7 100644 --- a/web/protobufs/identity-auth-structs.cjs.flow +++ b/web/protobufs/identity-auth-structs.cjs.flow @@ -1,440 +1,446 @@ // @flow import { Message, BinaryWriter, BinaryReader, Map as ProtoMap, } from 'google-protobuf'; import * as identityStructs from './identity-unauth-structs.cjs'; declare export class EthereumIdentity extends Message { getWalletAddress(): string; setWalletAddress(value: string): EthereumIdentity; getSocialProof(): string; setSocialProof(value: string): EthereumIdentity; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): EthereumIdentityObject; static toObject(includeInstance: boolean, msg: EthereumIdentity): EthereumIdentityObject; static serializeBinaryToWriter(message: EthereumIdentity, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): EthereumIdentity; static deserializeBinaryFromReader(message: EthereumIdentity, reader: BinaryReader): EthereumIdentity; } export type EthereumIdentityObject = { walletAddress: string, socialProof: string, } export type IdentityInfoCase = 0 | 1 | 2; declare export class Identity extends Message { getUsername(): string; setUsername(value: string): Identity; getEthIdentity(): EthereumIdentity | void; setEthIdentity(value?: EthereumIdentity): Identity; hasEthIdentity(): boolean; clearEthIdentity(): Identity; getIdentityInfoCase(): IdentityInfoCase; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): IdentityObject; static toObject(includeInstance: boolean, msg: Identity): IdentityObject; static serializeBinaryToWriter(message: Identity, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): Identity; static deserializeBinaryFromReader(message: Identity, reader: BinaryReader): Identity; } export type IdentityObject = { username: string, ethIdentity: ?EthereumIdentityObject, } 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; getIdentity(): Identity | void; setIdentity(value?: Identity): KeyserverKeysResponse; hasIdentity(): boolean; clearIdentity(): KeyserverKeysResponse; + getPrimaryDeviceIdentityInfo(): identityStructs.IdentityKeyInfo | void; + setPrimaryDeviceIdentityInfo(value?: identityStructs.IdentityKeyInfo): KeyserverKeysResponse; + hasPrimaryDeviceIdentityInfo(): boolean; + clearPrimaryDeviceIdentityInfo(): 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, identity: ?IdentityObject, + primaryDeviceIdentityInfo: ?identityStructs.IdentityKeyInfoObject, }; 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; getIdentity(): Identity | void; setIdentity(value?: Identity): InboundKeysForUserResponse; hasIdentity(): boolean; clearIdentity(): 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]>, identity: ?IdentityObject, } declare export class InboundKeysForUserRequest extends Message { getUserId(): string; setUserId(value: string): InboundKeysForUserRequest; 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, }; declare export class UpdateUserPasswordStartRequest extends Message { getOpaqueRegistrationRequest(): Uint8Array | string; getOpaqueRegistrationRequest_asU8(): Uint8Array; getOpaqueRegistrationRequest_asB64(): string; setOpaqueRegistrationRequest(value: Uint8Array | 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, }; 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, }; export type SinceTimestampCase = 0 | 2; declare export class GetDeviceListRequest extends Message { getUserId(): string; setUserId(value: string): GetDeviceListRequest; getSinceTimestamp(): number; setSinceTimestamp(value: number): GetDeviceListRequest; hasSinceTimestamp(): boolean; clearSinceTimestamp(): GetDeviceListRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): GetDeviceListRequestObject; static toObject(includeInstance: boolean, msg: GetDeviceListRequest): GetDeviceListRequestObject; static serializeBinaryToWriter(message: GetDeviceListRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): GetDeviceListRequest; static deserializeBinaryFromReader(message: GetDeviceListRequest, reader: BinaryReader): GetDeviceListRequest; } export type GetDeviceListRequestObject = { userId: string, sinceTimestamp?: number, } declare export class GetDeviceListResponse extends Message { getDeviceListUpdatesList(): Array; setDeviceListUpdatesList(value: Array): GetDeviceListResponse; clearDeviceListUpdatesList(): GetDeviceListResponse; addDeviceListUpdates(value: string, index?: number): GetDeviceListResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): GetDeviceListResponseObject; static toObject(includeInstance: boolean, msg: GetDeviceListResponse): GetDeviceListResponseObject; static serializeBinaryToWriter(message: GetDeviceListResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): GetDeviceListResponse; static deserializeBinaryFromReader(message: GetDeviceListResponse, reader: BinaryReader): GetDeviceListResponse; } export type GetDeviceListResponseObject = { deviceListUpdatesList: Array, } declare export class UpdateDeviceListRequest extends Message { getNewDeviceList(): string; setNewDeviceList(value: string): UpdateDeviceListRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UpdateDeviceListRequestObject; static toObject(includeInstance: boolean, msg: UpdateDeviceListRequest): UpdateDeviceListRequestObject; static serializeBinaryToWriter(message: UpdateDeviceListRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UpdateDeviceListRequest; static deserializeBinaryFromReader(message: UpdateDeviceListRequest, reader: BinaryReader): UpdateDeviceListRequest; } export type UpdateDeviceListRequestObject = { newDeviceList: string, } declare export class LinkFarcasterAccountRequest extends Message { getFarcasterId(): string; setFarcasterId(value: string): LinkFarcasterAccountRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): LinkFarcasterAccountRequestObject; static toObject(includeInstance: boolean, msg: LinkFarcasterAccountRequest): LinkFarcasterAccountRequestObject; static serializeBinaryToWriter(message: LinkFarcasterAccountRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): LinkFarcasterAccountRequest; static deserializeBinaryFromReader(message: LinkFarcasterAccountRequest, reader: BinaryReader): LinkFarcasterAccountRequest; } export type LinkFarcasterAccountRequestObject = { farcasterId: string, } declare export class UserIdentityRequest extends Message { getUserId(): string; setUserId(value: string): UserIdentityRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UserIdentityRequestObject; static toObject(includeInstance: boolean, msg: UserIdentityRequest): UserIdentityRequestObject; static serializeBinaryToWriter(message: UserIdentityRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UserIdentityRequest; static deserializeBinaryFromReader(message: UserIdentityRequest, reader: BinaryReader): UserIdentityRequest; } export type UserIdentityRequestObject = { userId: string, } declare export class UserIdentityResponse extends Message { getIdentity(): Identity | void; setIdentity(value?: Identity): UserIdentityResponse; hasIdentity(): boolean; clearIdentity(): UserIdentityResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UserIdentityResponseObject; static toObject(includeInstance: boolean, msg: UserIdentityResponse): UserIdentityResponseObject; static serializeBinaryToWriter(message: UserIdentityResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UserIdentityResponse; static deserializeBinaryFromReader(message: UserIdentityResponse, reader: BinaryReader): UserIdentityResponse; } export type UserIdentityResponseObject = { identity: ?IdentityObject, }