From 1c17e60c0bf952cce37cae83a9bfaa2339845267 Mon Sep 17 00:00:00 2001 From: lee Date: Thu, 16 Apr 2026 02:35:29 +0800 Subject: [PATCH 1/8] Add proto files --- .../accessibility_annotation_specifics.proto | 272 ++++++ .../proto/account_setting_specifics.proto | 26 + .../proto/ai_thread_specifics.proto | 41 + .../proto/app_list_specifics.proto | 90 ++ .../proto/app_setting_specifics.proto | 26 + crates/sync-server/proto/app_specifics.proto | 101 +++ .../proto/arc_package_specifics.proto | 30 + .../proto/autofill_offer_specifics.proto | 108 +++ .../proto/autofill_specifics.proto | 840 ++++++++++++++++++ ...autofill_valuable_metadata_specifics.proto | 48 + .../proto/autofill_valuable_specifics.proto | 299 +++++++ ...autofill_wallet_credential_specifics.proto | 27 + .../autofill_wallet_usage_specifics.proto | 43 + .../proto/bookmark_model_metadata.proto | 85 ++ .../proto/bookmark_specifics.proto | 95 ++ .../sync-server/proto/client_commands.proto | 55 ++ .../sync-server/proto/client_debug_info.proto | 92 ++ .../proto/collaboration_group_metadata.proto | 23 + .../proto/collaboration_group_specifics.proto | 37 + .../proto/contact_info_specifics.proto | 257 ++++++ .../proto/contextual_task_specifics.proto | 58 ++ .../sync-server/proto/cookie_specifics.proto | 92 ++ .../proto/data_type_progress_marker.proto | 173 ++++ .../sync-server/proto/data_type_state.proto | 94 ++ .../data_type_store_schema_descriptor.proto | 22 + .../sync-server/proto/deletion_origin.proto | 75 ++ .../proto/device_info_specifics.proto | 240 +++++ .../proto/dictionary_specifics.proto | 23 + crates/sync-server/proto/encryption.proto | 34 + .../sync-server/proto/entity_metadata.proto | 117 +++ .../sync-server/proto/entity_specifics.proto | 213 +++++ .../proto/extension_setting_specifics.proto | 29 + .../proto/extension_specifics.proto | 64 ++ .../proto/gaia_password_reuse.proto | 105 +++ .../proto/gemini_thread_specifics.proto | 26 + .../proto/get_updates_caller_info.proto | 25 + .../history_delete_directive_specifics.proto | 75 ++ .../sync-server/proto/history_specifics.proto | 152 ++++ crates/sync-server/proto/history_status.proto | 23 + .../sync-server/proto/loopback_server.proto | 48 + .../managed_user_setting_specifics.proto | 23 + .../sync-server/proto/nigori_local_data.proto | 131 +++ .../sync-server/proto/nigori_specifics.proto | 300 +++++++ crates/sync-server/proto/note_entity.proto | 36 + .../proto/os_preference_specifics.proto | 26 + .../os_priority_preference_specifics.proto | 26 + ...assword_sharing_invitation_specifics.proto | 134 +++ .../proto/password_sharing_recipients.proto | 39 + .../proto/password_specifics.proto | 378 ++++++++ .../proto/persisted_entity_data.proto | 26 + .../plus_address_setting_specifics.proto | 27 + .../proto/plus_address_specifics.proto | 27 + .../proto/power_bookmark_specifics.proto | 57 ++ .../proto/preference_specifics.proto | 23 + .../sync-server/proto/printer_specifics.proto | 81 ++ ...nters_authorization_server_specifics.proto | 25 + .../proto/priority_preference_specifics.proto | 24 + .../proto/product_comparison_specifics.proto | 74 ++ .../proto/reading_list_specifics.proto | 46 + .../proto/saved_tab_group_specifics.proto | 114 +++ .../proto/search_engine_specifics.proto | 96 ++ .../proto/security_event_specifics.proto | 27 + .../proto/send_tab_to_self_specifics.proto | 117 +++ .../sync-server/proto/session_specifics.proto | 98 ++ .../proto/shared_comment_specifics.proto | 141 +++ ...red_tab_group_account_data_specifics.proto | 66 ++ .../shared_tab_group_data_specifics.proto | 118 +++ .../proto/sharing_message_specifics.proto | 122 +++ .../sync-server/proto/skill_specifics.proto | 68 ++ crates/sync-server/proto/sync.proto | 511 +++++++++++ .../sync_collaboration_attribution.proto | 54 ++ crates/sync-server/proto/sync_entity.proto | 281 ++++++ crates/sync-server/proto/sync_enums.proto | 259 ++++++ .../proto/sync_invalidations_payload.proto | 37 + .../tab_group_attribution_metadata.proto | 42 + crates/sync-server/proto/tab_navigation.proto | 123 +++ crates/sync-server/proto/test.proto | 23 + .../proto/theme_android_specifics.proto | 46 + .../proto/theme_ios_specifics.proto | 26 + .../sync-server/proto/theme_specifics.proto | 67 ++ crates/sync-server/proto/theme_types.proto | 50 ++ .../proto/typed_url_specifics.proto | 40 + .../proto/unencrypted_sharing_message.proto | 128 +++ .../sync-server/proto/unique_position.proto | 82 ++ .../proto/user_consent_specifics.proto | 125 +++ .../proto/user_consent_types.proto | 197 ++++ .../proto/user_event_specifics.proto | 140 +++ .../sync-server/proto/web_apk_specifics.proto | 50 ++ .../sync-server/proto/web_app_specifics.proto | 108 +++ .../proto/webauthn_credential_specifics.proto | 199 +++++ .../proto/wifi_configuration_specifics.proto | 92 ++ .../proto/workspace_desk_specifics.proto | 309 +++++++ 92 files changed, 9742 insertions(+) create mode 100644 crates/sync-server/proto/accessibility_annotation_specifics.proto create mode 100644 crates/sync-server/proto/account_setting_specifics.proto create mode 100644 crates/sync-server/proto/ai_thread_specifics.proto create mode 100644 crates/sync-server/proto/app_list_specifics.proto create mode 100644 crates/sync-server/proto/app_setting_specifics.proto create mode 100644 crates/sync-server/proto/app_specifics.proto create mode 100644 crates/sync-server/proto/arc_package_specifics.proto create mode 100644 crates/sync-server/proto/autofill_offer_specifics.proto create mode 100644 crates/sync-server/proto/autofill_specifics.proto create mode 100644 crates/sync-server/proto/autofill_valuable_metadata_specifics.proto create mode 100644 crates/sync-server/proto/autofill_valuable_specifics.proto create mode 100644 crates/sync-server/proto/autofill_wallet_credential_specifics.proto create mode 100644 crates/sync-server/proto/autofill_wallet_usage_specifics.proto create mode 100644 crates/sync-server/proto/bookmark_model_metadata.proto create mode 100644 crates/sync-server/proto/bookmark_specifics.proto create mode 100644 crates/sync-server/proto/client_commands.proto create mode 100644 crates/sync-server/proto/client_debug_info.proto create mode 100644 crates/sync-server/proto/collaboration_group_metadata.proto create mode 100644 crates/sync-server/proto/collaboration_group_specifics.proto create mode 100644 crates/sync-server/proto/contact_info_specifics.proto create mode 100644 crates/sync-server/proto/contextual_task_specifics.proto create mode 100644 crates/sync-server/proto/cookie_specifics.proto create mode 100644 crates/sync-server/proto/data_type_progress_marker.proto create mode 100644 crates/sync-server/proto/data_type_state.proto create mode 100644 crates/sync-server/proto/data_type_store_schema_descriptor.proto create mode 100644 crates/sync-server/proto/deletion_origin.proto create mode 100644 crates/sync-server/proto/device_info_specifics.proto create mode 100644 crates/sync-server/proto/dictionary_specifics.proto create mode 100644 crates/sync-server/proto/encryption.proto create mode 100644 crates/sync-server/proto/entity_metadata.proto create mode 100644 crates/sync-server/proto/entity_specifics.proto create mode 100644 crates/sync-server/proto/extension_setting_specifics.proto create mode 100644 crates/sync-server/proto/extension_specifics.proto create mode 100644 crates/sync-server/proto/gaia_password_reuse.proto create mode 100644 crates/sync-server/proto/gemini_thread_specifics.proto create mode 100644 crates/sync-server/proto/get_updates_caller_info.proto create mode 100644 crates/sync-server/proto/history_delete_directive_specifics.proto create mode 100644 crates/sync-server/proto/history_specifics.proto create mode 100644 crates/sync-server/proto/history_status.proto create mode 100644 crates/sync-server/proto/loopback_server.proto create mode 100644 crates/sync-server/proto/managed_user_setting_specifics.proto create mode 100644 crates/sync-server/proto/nigori_local_data.proto create mode 100644 crates/sync-server/proto/nigori_specifics.proto create mode 100644 crates/sync-server/proto/note_entity.proto create mode 100644 crates/sync-server/proto/os_preference_specifics.proto create mode 100644 crates/sync-server/proto/os_priority_preference_specifics.proto create mode 100644 crates/sync-server/proto/password_sharing_invitation_specifics.proto create mode 100644 crates/sync-server/proto/password_sharing_recipients.proto create mode 100644 crates/sync-server/proto/password_specifics.proto create mode 100644 crates/sync-server/proto/persisted_entity_data.proto create mode 100644 crates/sync-server/proto/plus_address_setting_specifics.proto create mode 100644 crates/sync-server/proto/plus_address_specifics.proto create mode 100644 crates/sync-server/proto/power_bookmark_specifics.proto create mode 100644 crates/sync-server/proto/preference_specifics.proto create mode 100644 crates/sync-server/proto/printer_specifics.proto create mode 100644 crates/sync-server/proto/printers_authorization_server_specifics.proto create mode 100644 crates/sync-server/proto/priority_preference_specifics.proto create mode 100644 crates/sync-server/proto/product_comparison_specifics.proto create mode 100644 crates/sync-server/proto/reading_list_specifics.proto create mode 100644 crates/sync-server/proto/saved_tab_group_specifics.proto create mode 100644 crates/sync-server/proto/search_engine_specifics.proto create mode 100644 crates/sync-server/proto/security_event_specifics.proto create mode 100644 crates/sync-server/proto/send_tab_to_self_specifics.proto create mode 100644 crates/sync-server/proto/session_specifics.proto create mode 100644 crates/sync-server/proto/shared_comment_specifics.proto create mode 100644 crates/sync-server/proto/shared_tab_group_account_data_specifics.proto create mode 100644 crates/sync-server/proto/shared_tab_group_data_specifics.proto create mode 100644 crates/sync-server/proto/sharing_message_specifics.proto create mode 100644 crates/sync-server/proto/skill_specifics.proto create mode 100644 crates/sync-server/proto/sync.proto create mode 100644 crates/sync-server/proto/sync_collaboration_attribution.proto create mode 100644 crates/sync-server/proto/sync_entity.proto create mode 100644 crates/sync-server/proto/sync_enums.proto create mode 100644 crates/sync-server/proto/sync_invalidations_payload.proto create mode 100644 crates/sync-server/proto/tab_group_attribution_metadata.proto create mode 100644 crates/sync-server/proto/tab_navigation.proto create mode 100644 crates/sync-server/proto/test.proto create mode 100644 crates/sync-server/proto/theme_android_specifics.proto create mode 100644 crates/sync-server/proto/theme_ios_specifics.proto create mode 100644 crates/sync-server/proto/theme_specifics.proto create mode 100644 crates/sync-server/proto/theme_types.proto create mode 100644 crates/sync-server/proto/typed_url_specifics.proto create mode 100644 crates/sync-server/proto/unencrypted_sharing_message.proto create mode 100644 crates/sync-server/proto/unique_position.proto create mode 100644 crates/sync-server/proto/user_consent_specifics.proto create mode 100644 crates/sync-server/proto/user_consent_types.proto create mode 100644 crates/sync-server/proto/user_event_specifics.proto create mode 100644 crates/sync-server/proto/web_apk_specifics.proto create mode 100644 crates/sync-server/proto/web_app_specifics.proto create mode 100644 crates/sync-server/proto/webauthn_credential_specifics.proto create mode 100644 crates/sync-server/proto/wifi_configuration_specifics.proto create mode 100644 crates/sync-server/proto/workspace_desk_specifics.proto diff --git a/crates/sync-server/proto/accessibility_annotation_specifics.proto b/crates/sync-server/proto/accessibility_annotation_specifics.proto new file mode 100644 index 0000000..9867f56 --- /dev/null +++ b/crates/sync-server/proto/accessibility_annotation_specifics.proto @@ -0,0 +1,272 @@ +// Copyright 2026 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Specifics for accessibility annotations. +message AccessibilityAnnotationSpecifics { + // A unique identifier for the entity. + optional string id = 1; + + // Oneof to support different data types. + oneof entity { + Order order = 2; + Shipment shipment = 3; + DriversLicense drivers_license = 4; + Passport passport = 5; + NationalId national_id = 6; + FlightReservation flight_reservation = 7; + Vehicle vehicle = 8; + } + + // The source(s) of the entity. + repeated Source sources = 9; + + message Source { + // Deeplink to the source. + optional string deeplink = 1; + + // Oneof to support different source types. + oneof source { + GmailSource gmail_source = 2; + CalendarSource calendar_source = 3; + PhotosSource photos_source = 4; + } + } + + // Represents a completed purchase transaction from a retail merchant. + message Order { + // A unique alphanumeric ID generated by the retail merchant to identify the + // order. + optional string order_id = 1; + + // The unique ID to identify the user's account, typically an email address, + // under which the order was placed. + optional string account = 2; + + reserved 3; + reserved "order_date_unix_epoch_seconds"; + + // The date when the order was placed. + optional NaiveDate order_date = 8; + + // The name of the merchant. + optional string merchant_name = 4; + + // The domain (eTLD+1) of the merchant. + optional string merchant_domain = 5; + + // The names of the products contained within the order. + repeated string product_names = 6; + + // The total amount of the purchase, including taxes and shipping + // (e.g., "$123.45"). + optional string grand_total = 7; + } + + // Represents a shipment of physical goods delivered by a courier or + // logistics service. + message Shipment { + // A unique alphanumeric ID assigned to a shipment by a courier or + // logistics service. + optional string tracking_number = 1; + + // The order ID(s) associated with this shipment. + repeated string associated_order_ids = 2; + + // The postal address to which the shipment is being delivered. + optional string delivery_address = 3; + + // The name of the courier or logistics service delivering the shipment. + optional string carrier_name = 4; + + // The domain (eTLD+1) of the courier or logistics service. + optional string carrier_domain = 5; + + reserved 6; + reserved "estimated_delivery_date_unix_epoch_seconds"; + + // The date on which the shipment is estimated to be delivered. + optional NaiveDate estimated_delivery_date = 7; + } + + // Represents a government-issued driver's license. + message DriversLicense { + // The name of the user as it appears on the driver's license. + optional string name = 1; + + // The unique identifier number for the driver's license. + optional string number = 2; + + reserved 3; + reserved "expiration_date_unix_epoch_seconds"; + reserved 4; + reserved "issue_date_unix_epoch_seconds"; + + // The expiration date of the driver's license. + optional NaiveDate expiration_date = 6; + + // The issue date of the driver's license. + optional NaiveDate issue_date = 7; + + // The state or province that issued the driver's license. + optional string state = 5; + } + + // Represents a government-issued passport. + message Passport { + // The name of the user as it appears on the passport. + optional string name = 1; + + // The unique identifier number for the passport. + optional string number = 2; + + reserved 3; + reserved "expiration_date_unix_epoch_seconds"; + reserved 4; + reserved "issue_date_unix_epoch_seconds"; + + // The expiration date of the passport. + optional NaiveDate expiration_date = 6; + + // The issue date of the passport. + optional NaiveDate issue_date = 7; + + // The country that issued the passport, normalized as a two-letter country + // code (ISO 3166-1 alpha-2). + optional string issuing_country = 5; + } + + // Represents a government-issued national identity document. + message NationalId { + // The name of the user as it appears on the ID. + optional string name = 1; + + // The unique identifier number for the national ID. + optional string number = 2; + + reserved 3; + reserved "expiration_date_unix_epoch_seconds"; + reserved 4; + reserved "issue_date_unix_epoch_seconds"; + + // The expiration date of the ID. + optional NaiveDate expiration_date = 6; + + // The issue date of the ID. + optional NaiveDate issue_date = 7; + + // The country that issued the ID, normalized as a two-letter country code + // (ISO 3166-1 alpha-2). + optional string issuing_country = 5; + } + + // Represents a record of a reserved flight for a passenger. + message FlightReservation { + // The alphanumeric designation for a specific flight route (e.g., "AA123"). + optional string flight_number = 1; + + // A unique number issued by an airline or travel agency for the ticket, + // typically 13 digits. + optional string flight_ticket_number = 2; + + // A unique alphanumeric identifier for the booking (also known as Record + // Locator or PNR). + optional string flight_confirmation_code = 3; + + // The name of the person traveling as it appears on the reservation. + optional string passenger_name = 4; + + // The name or IATA code of the airport where the flight originates. + optional string departure_airport = 5; + + // The name or IATA code of the airport where the flight terminates. + optional string arrival_airport = 6; + + // The scheduled date and time of departure. + optional int64 departure_date_unix_epoch_seconds = 7; + + // The scheduled date and time of arrival. + optional int64 arrival_date_unix_epoch_seconds = 8; + } + + // Represents a motor vehicle. + message Vehicle { + // The manufacturer of the vehicle. + optional string vehicle_make = 1; + + // The specific product name of the vehicle. + optional string vehicle_model = 2; + + // The manufacturing year of the vehicle. + optional string vehicle_year = 3; + + // The unique 17-character Vehicle Identification Number. + optional string vehicle_identification_number = 4; + + // The alphanumeric identifier on the vehicle's license plate. + optional string vehicle_license_plate = 5; + + // The state or region that issued the vehicle's license plate. + optional string license_plate_region = 6; + + // The country that issued the license plate, normalized to ISO 3166-1 + // alpha-2. + optional string license_plate_country = 7; + + // The name of the primary owner of the vehicle. + optional string owner_name = 8; + } + + // Represents a Gmail message. + message GmailSource { + // The thread id of the Gmail message. + optional string thread_id = 1; + + // The message id of the Gmail message. + optional string message_id = 2; + + // The thread locator of the Gmail message. + optional string thread_locator = 3; + + // The message received timestamp. + optional int64 received_time_unix_epoch_seconds = 4; + } + + // Represents a calendar event. + message CalendarSource { + // The unique identifier for the calendar event. + optional string event_id = 1; + + // The last modified time of the calendar event. + optional int64 modified_time_unix_epoch_seconds = 2; + } + + // Represents a photo. + message PhotosSource { + // The unique identifier for the photo. + optional string photo_id = 1; + + // The creation time of the photo. + optional int64 creation_time_unix_epoch_seconds = 2; + } + + // Represents a date without a time zone. This is useful for dates on physical + // documents, like an issue date of a passport. + message NaiveDate { + optional int32 day = 1; + optional int32 month = 2; + optional int32 year = 3; + } +} diff --git a/crates/sync-server/proto/account_setting_specifics.proto b/crates/sync-server/proto/account_setting_specifics.proto new file mode 100644 index 0000000..79ae0a2 --- /dev/null +++ b/crates/sync-server/proto/account_setting_specifics.proto @@ -0,0 +1,26 @@ +// Copyright 2025 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Used to sync the user account settings. +message AccountSettingSpecifics { + optional string name = 1; + // The value of the setting. Which variant is set depends on the setting. + oneof Value { + bool bool_value = 2; + string string_value = 3; + int64 int_value = 4; + } +} diff --git a/crates/sync-server/proto/ai_thread_specifics.proto b/crates/sync-server/proto/ai_thread_specifics.proto new file mode 100644 index 0000000..45ac328 --- /dev/null +++ b/crates/sync-server/proto/ai_thread_specifics.proto @@ -0,0 +1,41 @@ +// Copyright 2025 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Represents the most recent snapshot of a thread when a user is interacting +// with AI features. +// LINT.IfChange(AiThreadSpecifics) +message AiThreadSpecifics { + enum ThreadType { + UNKNOWN = 0; + AI_MODE = 1; + } + + // Type of the thread. + optional ThreadType type = 1; + + // Unique identifier for the thread. + optional string server_id = 2; + + // Latest encrypted state token of the conversation. + optional string conversation_turn_id = 3; + + // Title of the thread. + optional string title = 4; + + // Tracks the time the most recent turn in the thread was created. + optional int64 last_turn_time_unix_epoch_millis = 5; +} +// LINT.ThenChange(//components/contextual_tasks/internal/ai_thread_sync_bridge.cc:TrimAllSupportedFieldsFromRemoteSpecifics) diff --git a/crates/sync-server/proto/app_list_specifics.proto b/crates/sync-server/proto/app_list_specifics.proto new file mode 100644 index 0000000..375b99c --- /dev/null +++ b/crates/sync-server/proto/app_list_specifics.proto @@ -0,0 +1,90 @@ +// Copyright 2013 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Sync protocol datatype extension for the app list (aka app launcher). + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Properties of app list objects. +message AppListSpecifics { + // Unique identifier for the item: + // * TYPE_FOLDER: Folder id (generated) + // * TYPE_APP: App Id + optional string item_id = 1; + + // What type of item this is. + enum AppListItemType { + // An app, whether a web app, Android app, etc. + // + // For bookmark apps (URL shortcuts), additional information such as their + // URLs are kept in the AppSpecifics.bookmark_app_foobar fields. + TYPE_APP = 1; + // A request to remove any matching default installed apps. + TYPE_REMOVE_DEFAULT_APP = 2; + // A folder containing entries whose `parent_id` matches `item_id`. + TYPE_FOLDER = 3; + // Obsolete type, intended for URL shortcuts, that was never implemented. + TYPE_OBSOLETE_URL = 4; + // A "page break" item (Indicate creation of a new page in app list). + TYPE_PAGE_BREAK = 5; + } + optional AppListItemType item_type = 2; + + // Item name (FOLDER). + optional string item_name = 3; + + // Id of the parent (folder) item. + optional string parent_id = 4; + + // Marked OBSOLETE because this is unused for the app list. + // Which page this item will appear on in the app list. + optional string OBSOLETE_page_ordinal = 5 [deprecated = true]; + + // Where on a page this item will appear. + optional string item_ordinal = 6; + + // Where on a shelf this item will appear. + optional string item_pin_ordinal = 7; + + // The color groups used for grouping together icons by colors. + enum ColorGroup { + COLOR_EMPTY = 0; + COLOR_WHITE = 1; + COLOR_RED = 2; + COLOR_ORANGE = 3; + COLOR_YELLOW = 4; + COLOR_GREEN = 5; + COLOR_BLUE = 6; + COLOR_MAGENTA = 7; + COLOR_BLACK = 8; + } + + message IconColor { + // The item icon's background color. + optional ColorGroup background_color = 1; + + // The item icon's hue. + optional int32 hue = 2; + } + optional IconColor item_color = 8; + + // This field previously stored the is_user_pinned value, which has been + // removed. + reserved 9; + + // Identifier for the app package of the item. Package Ids are stable and + // globally unique across app platforms, whereas App Id stored in item_id is + // not. + optional string promise_package_id = 10; +} diff --git a/crates/sync-server/proto/app_setting_specifics.proto b/crates/sync-server/proto/app_setting_specifics.proto new file mode 100644 index 0000000..a8ebca3 --- /dev/null +++ b/crates/sync-server/proto/app_setting_specifics.proto @@ -0,0 +1,26 @@ +// Copyright 2012 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Sync protocol datatype extension for an app setting. +// This is the same as for an extension setting, but uses a separate datatype +// in order to control syncability separately. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +import "extension_setting_specifics.proto"; + +// Properties of app setting sync objects; just an extension setting. +message AppSettingSpecifics { + optional ExtensionSettingSpecifics extension_setting = 1; +} diff --git a/crates/sync-server/proto/app_specifics.proto b/crates/sync-server/proto/app_specifics.proto new file mode 100644 index 0000000..3efa21b --- /dev/null +++ b/crates/sync-server/proto/app_specifics.proto @@ -0,0 +1,101 @@ +// Copyright 2012 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Sync protocol datatype extension for apps. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +import "extension_specifics.proto"; + +// Settings related to push notifications for apps. +message AppNotificationSettings { + // DEPRECATED: Use oauth_client_id below. + // Whether or not the user has setup notifications at least once. + // The value for this field will start out false and will be set + // to true when the user accepts receiving notifications for the + // first time and then it will always remain true. + optional bool initial_setup_done = 1 [deprecated = true]; + + // Whether or not the user has disabled notifications. + optional bool disabled = 2; + + // OAuth2 client id to which the user granted the notification permission. + // This field will start out empty. + // It will be set when the user accepts receiving notifications. + // This field is used when the user revokes the notifications permission. + // Note that it is never cleared after it was set once. Hence, the presence + // of this field can be used to determine if the user has setup notifications + // at least once for the given app. + optional string oauth_client_id = 3; +} + +// Information about a linked app icon. +message LinkedAppIconInfo { + // The URL of the app icon. + optional string url = 1; + + // The size of the app icon in DIPs. + optional uint32 size = 2; +} + +// Properties of app sync objects. +// +// For now, an app is just an extension. We keep the two data types +// separate for future-proofing purposes. +message AppSpecifics { + // Extension data. + optional ExtensionSpecifics extension = 1; + + // Notification settings. + optional AppNotificationSettings notification_settings = 2; + + // This controls where on a page this application icon will appear. + optional string app_launch_ordinal = 3; + + // This specifics which page the application icon will appear on in the NTP. + // This values only provide the order within the application pages, not within + // all of the panels in the NTP. + optional string page_ordinal = 4; + + // The possible launch types for an app. + // This enum should be kept in sync with extensions::LaunchType. + enum LaunchType { + PINNED = 0; + REGULAR = 1; + FULLSCREEN = 2; + WINDOW = 3; + } + + // This describes how the extension should be launched. + optional LaunchType launch_type = 5; + + // DEPRECATED. See https://crbug.com/1233303. + optional string bookmark_app_url = 6 [deprecated = true]; + + // DEPRECATED. See https://crbug.com/1233303. + optional string bookmark_app_description = 7 [deprecated = true]; + + // DEPRECATED. See https://crbug.com/1233303. + optional string bookmark_app_icon_color = 8 [deprecated = true]; + + // This is information about linked icons (that is, icons that are downloaded + // from outside the app's bundle of files. + repeated LinkedAppIconInfo linked_app_icons = 9; + + // DEPRECATED. See https://crbug.com/1233303. + optional string bookmark_app_scope = 10 [deprecated = true]; + + // DEPRECATED. See https://crbug.com/1233303. + optional uint32 bookmark_app_theme_color = 11 [deprecated = true]; +} diff --git a/crates/sync-server/proto/arc_package_specifics.proto b/crates/sync-server/proto/arc_package_specifics.proto new file mode 100644 index 0000000..6720158 --- /dev/null +++ b/crates/sync-server/proto/arc_package_specifics.proto @@ -0,0 +1,30 @@ +// Copyright 2016 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Sync protocol datatype extension for ARC pakcages. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Properties of arc package objects. +message ArcPackageSpecifics { + // Unique identifier for the item: + // Android package name. + optional string package_name = 1; + // Android package version. + optional int32 package_version = 2; + // Last Android id generated when Android side backups data. + optional int64 last_backup_android_id = 3; + // Last time internal value that Android side backups data. + optional int64 last_backup_time = 4; +} diff --git a/crates/sync-server/proto/autofill_offer_specifics.proto b/crates/sync-server/proto/autofill_offer_specifics.proto new file mode 100644 index 0000000..c92e98d --- /dev/null +++ b/crates/sync-server/proto/autofill_offer_specifics.proto @@ -0,0 +1,108 @@ +// Copyright 2020 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Properties of Autofill wallet offer related objects. + +// Next tag: 11 +message AutofillOfferSpecifics { + // The id for this offer data. Will be used as the client tag. + optional int64 id = 1; + + // The link leading to the offer details page on Gpay app. Will be populated + // on Android only. + optional string offer_details_url = 2; + + // Merchant domain and merchant app package name refers to the merchant this + // offer is applied to. + repeated string merchant_domain = 3; + repeated string merchant_app_package = 4; + + // The expiry of this offer. Will be represented in the form of unix epoch + // time in seconds. Once the offer is expired it will not be shown in the + // client. + optional int64 offer_expiry_date = 5; + + // Proto containing data specific to a card-linked offer. + message CardLinkedOfferData { + reserved 1, 2; + + // The server id of the card to which the offer is linked. + repeated int64 instrument_id = 3; + } + + // Proto containing data specific to a promo code offer. + message PromoCodeOfferData { + // The actual promo code which can be applied at checkout. + optional string promo_code = 1; + } + + // The unique offer data for different offer types. + oneof type_specific_offer_data { + CardLinkedOfferData card_linked_offer_data = 6; + PromoCodeOfferData promo_code_offer_data = 9; + } + + // Strings to be shown in client UI, based on the offer type and details. + message DisplayStrings { + // A message translated in the user's GPay app locale, explaining the value + // of the offer. For example, a promo code offer might display + // "$5 off on shoes, up to $50." + optional string value_prop_text = 1; + + // A message translated in the user's GPay app locale and shown on mobile as + // a link, prompting the user to click it to learn more about the offer. + // Generally, "See details". + optional string see_details_text_mobile = 2; + + // A message translated in the user's GPay app locale and shown on desktop + // (not as a link), informing the user that exclusions and restrictions may + // apply to the value prop text. Generally, "Terms apply." + optional string see_details_text_desktop = 3; + + // A message translated in the user's GPay app locale and shown on mobile, + // instructing them on how to redeem the offer. For example, a promo code + // offer might display "Tap the promo code field at checkout to autofill + // it." + optional string usage_instructions_text_mobile = 4; + + // A message translated in the user's GPay app locale and shown on desktop, + // instructing them on how to redeem the offer. For example, a promo code + // offer might display "Click the promo code field at checkout to autofill + // it." + optional string usage_instructions_text_desktop = 5; + } + optional DisplayStrings display_strings = 10; + + // This value will be shown in the offer text template as "XXX% cashback". + // Percentage has a range of (0, 100]. + message PercentageReward { + // The string contains a number and a percent sign. + optional string percentage = 1; + } + + // This value will be shown in the offer text template as "XXX$ off". + message FixedAmountReward { + // The string contains a number and a currency sign. + optional string amount = 1; + } + + // The reward type of the offer. Will be used to generate the display text in + // the UI. Each type has its own client side text template. + oneof reward_type { + PercentageReward percentage_reward = 7; + FixedAmountReward fixed_amount_reward = 8; + } +} diff --git a/crates/sync-server/proto/autofill_specifics.proto b/crates/sync-server/proto/autofill_specifics.proto new file mode 100644 index 0000000..33cd9db --- /dev/null +++ b/crates/sync-server/proto/autofill_specifics.proto @@ -0,0 +1,840 @@ +// Copyright 2012 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Sync protocol datatype extension for autofill. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Properties of autofill sync objects. + +// An AutofillProfile. +message AutofillProfileSpecifics { + // Represents the validation status of value stored in the AutofillProfile. + enum VerificationStatus { + // No verification status assigned. + VERIFICATION_STATUS_UNSPECIFIED = 0; + // The value token was parsed from a parent token. + // For example, the first name was derived by splitting a full name into + // its components. + PARSED = 1; + // Value was built from its subcomponents. + // For example, the full name was built from the first, middle and last + // name. + FORMATTED = 2; + // The value was observed in a form transmission. + // For example, the user filled a form that contained at NAME_FULL field. + // The value of NAME_FULL will be stored as OBSERVED. + OBSERVED = 3; + // The user used the autofill settings to verify and store this token. + // This is currently only applicable to the full name, since users cannot + // edit individual components of their name. + USER_VERIFIED = 4; + // The token was parsed remotely. + SERVER_PARSED = 5; + } + + optional string guid = 15; + // Starting from M115, Autofill ignores the origin and doesn't distinguish + // between verified (meaning `deprecated_origin == kSettingsOrigin`) and + // unverified profiles anymore. However, clients prior to this milestone only + // accept updates to verified profiles through Sync if the remote profile is + // verified as well. For this reason, M115 clients and above always set the + // origin to kSettingsOrigin. + // TODO(crbug.com/40266694): Remove in a few milestones. + optional string deprecated_origin = 16; + optional int64 use_count = 22; + + // The time_t value of the last time this profile was used. This + // value makes sense wrt base::Time::To/FromTimeT, which measures + // from the Windows epoch. + optional int64 use_date = 23; + + // A label intended to be chosen by the user. This was however never + // implemented and is currently unused. + optional string profile_label = 62; + + // Contact info name fields. + repeated string name_first = 2; + repeated string name_middle = 3; + repeated string name_last = 4; + + reserved 99; + reserved "name_last_prefix"; + reserved 100; + reserved "name_last_core"; + + // Sometimes the last name is composed of two names as it is common for + // Hispanic/Latinx names. In the unstructured representation of the last name, + // there may be even a conjunction between the first and the second last + // name. For example, the more-complete version of Pablo Picasso's surname is + // "Ruiz y Picasso" containing a first last name, a conjunction (the y) and a + // second last name. + repeated string name_last_first = 27; + repeated string name_last_conjunction = 28; + repeated string name_last_second = 29; + repeated string name_full = 21; + + reserved 60; + reserved "name_full_with_honorific"; + + // Contact info alternative name fields (e.g. phonetic names in Japan). + optional string alternative_full_name = 93; + optional string alternative_given_name = 94; + optional string alternative_family_name = 95; + + // Validation status records for name fields. + reserved 30; + reserved "name_honorific_status"; + repeated VerificationStatus name_first_status = 31; + repeated VerificationStatus name_middle_status = 32; + repeated VerificationStatus name_last_status = 33; + reserved 101; + reserved "name_last_prefix_status"; + reserved 102; + reserved "name_last_core_status"; + repeated VerificationStatus name_last_first_status = 34; + repeated VerificationStatus name_last_conjunction_status = 35; + repeated VerificationStatus name_last_second_status = 36; + repeated VerificationStatus name_full_status = 37; + reserved 61; + reserved "name_full_with_honorific_status"; + + // Validation status records for alternative name fields. + optional VerificationStatus alternative_full_name_status = 96; + optional VerificationStatus alternative_given_name_status = 97; + optional VerificationStatus alternative_family_name_status = 98; + + // Contact info additional fields. + repeated string email_address = 5; + optional string company_name = 6; + + // Address field. + // The address_home_line1/2 fields are deprecated and + // address_home_street_address should be used instead by + // joining address_home_line1/2 with a newline ("\n"). + // Full deprecation can not be achieved before all sync profiles have been + // updated with a M86+ client. + // TODO(crbug.com/40142711): Remove usages of address_home_line1/2 and mark + // field as deprecated. + optional string address_home_line1 = 7; + optional string address_home_line2 = 8; + optional string address_home_city = 9; + optional string address_home_state = 10; + optional string address_home_zip = 11; + optional string address_home_country = 12; + optional string address_home_admin_level_2 = 71; + + // Additional address fields for i18n. + optional string address_home_street_address = 17; + optional string address_home_sorting_code = 18; + optional string address_home_dependent_locality = 19; + optional string address_home_language_code = 20; + optional string address_home_thoroughfare_name = 38; + optional string address_home_thoroughfare_number = 39; + optional string address_home_street_location = 73; + optional string address_home_subpremise_name = 42; + // All the information related to the apartment. Normally a combination of the + // apartment type (address_home_apt_type) and number (address_home_apt_num). + // E.g. "Apt 5". + optional string address_home_apt = 85; + // The raw number (or identifier) of an apartment (e.g. "5") but without a + // prefix. The value "apt 5" would correspond to the address_home_apt. + optional string address_home_apt_num = 56; + // Information describing the type of apartment (e.g. Apt, Apartamento, Sala, + // Departamento). + optional string address_home_apt_type = 87; + optional string address_home_floor = 57; + optional string address_home_landmark = 67; + // The type indicates that the address is at the intersection between two + // streets. This is a common way of writing addresses in Mexico. + optional string address_home_between_streets = 69; + // The meaning of the field is similar to address_home_between_streets. The + // type should be used for "Entre calle 1" in MX addresses which also + // contain the "Entre calle 2" field. + optional string address_home_between_streets_1 = 77; + // The meaning of the field is similar to address_home_between_streets. The + // type should be used for "Entre calle 2" in MX addresses which also + // contain the "Entre calle 1" field. + optional string address_home_between_streets_2 = 79; + optional string address_home_overflow = 75; + // Combination of types address_home_between_streets or address_home_landmark. + // Note that some address forms require the combination of both in a single + // field as opposed to each one separately. + optional string address_home_between_streets_or_landmark = 81; + // Combination of types address_home_overflow and address_home_landmark. + // Note that some address forms require the combination of both in a single + // field as opposed to each one separately. + optional string address_home_overflow_and_landmark = 83; + // Combination of types address_home_street_location and + // address_home_dependent_locality. Note that some address forms require the + // combination of both in a single field as opposed to each one separately. + optional string address_home_street_location_and_locality = 89; + // Combination of types address_home_thoroughfare_number and + // address_home_apt. Note that some address forms require the combination of + // both in a single field as opposed to each one separately. + optional string address_home_thoroughfare_number_and_apt = 91; + // Sometimes address_home_zip consists of two parts. + // For example, address_home_zip = 12345-6789, + // prefix = 12345, suffix = 6789. + optional string address_home_zip_prefix = 103; + optional string address_home_zip_suffix = 104; + + // Validation status records for address fields. + optional VerificationStatus address_home_city_status = 43; + optional VerificationStatus address_home_state_status = 44; + optional VerificationStatus address_home_zip_status = 45; + optional VerificationStatus address_home_country_status = 46; + optional VerificationStatus address_home_landmark_status = 68; + optional VerificationStatus address_home_between_streets_status = 70; + optional VerificationStatus address_home_between_streets_1_status = 78; + optional VerificationStatus address_home_between_streets_2_status = 80; + optional VerificationStatus address_home_admin_level_2_status = 72; + optional VerificationStatus address_home_overflow_status = 76; + optional VerificationStatus address_home_between_streets_or_landmark_status = + 82; + optional VerificationStatus address_home_overflow_and_landmark_status = 84; + optional VerificationStatus address_home_street_location_and_locality_status = + 90; + optional VerificationStatus address_home_thoroughfare_number_and_apt_status = + 92; + optional VerificationStatus address_home_street_address_status = 47; + optional VerificationStatus address_home_sorting_code_status = 48; + optional VerificationStatus address_home_dependent_locality_status = 49; + optional VerificationStatus address_home_language_code_status = 50; + optional VerificationStatus address_home_thoroughfare_name_status = 51; + optional VerificationStatus address_home_thoroughfare_number_status = 52; + optional VerificationStatus address_home_street_location_status = 74; + optional VerificationStatus address_home_subpremise_name_status = 55; + optional VerificationStatus address_home_apt_status = 86; + optional VerificationStatus address_home_apt_num_status = 58; + optional VerificationStatus address_home_apt_type_status = 88; + optional VerificationStatus address_home_floor_status = 59; + optional VerificationStatus address_home_zip_prefix_status = 105; + optional VerificationStatus address_home_zip_suffix_status = 106; + + // Phone. + repeated string phone_home_whole_number = 13; + + reserved 63; + reserved "disallow_settings_visible_updates"; + + // Removed in M123. + reserved 64; + reserved "birthdate_day"; + reserved 65; + reserved "birthdate_month"; + reserved 66; + reserved "birthdate_year"; + + // Deprecated. + optional string deprecated_label = 1 [deprecated = true]; + optional string phone_fax_whole_number = 14 [deprecated = true]; + // The following validity-related fields have only been used in combination + // with an experimental features that are disabled for all clients and have + // been removed in M100. + optional int64 validity_state_bitfield = 24 [deprecated = true]; + optional bool is_client_validity_states_updated = 25 [deprecated = true]; + // Removed in M118. + reserved 40; + reserved "address_home_dependent_thoroughfare_name"; + reserved 41; + reserved "address_home_premise_name"; + reserved 53; + reserved "address_home_dependent_thoroughfare_name_status"; + reserved 54; + reserved "address_home_premise_name_status"; + // Removed in M122. + reserved 26; + reserved "name_honorific"; +} + +message AutofillSpecifics { + // If any of these 3 fields are present, then all 3 should be, and it implies + // that this entity represents a classic autofill object. In this case, + // none of the autofill++ objects below should be present. + optional string name = 1; + optional string value = 2; + repeated int64 usage_timestamp = 3; + + // An autofill++ profile object. If present, indicates this entity + // represents an AutofillProfile exclusively, and no other fields (such as + // name/value or credit_card) should be present. + optional AutofillProfileSpecifics profile = 4; + + reserved 5; + reserved "encrypted_credit_card"; + reserved 6; + reserved "credit_card"; +} + +// TODO(crbug.com/40105930): Deprecated, remove this once dependent change is +// done. Use WalletCreditCardCloudTokenData instead. +message CloudTokenData { + // Last 4-5 digits of the Cloud Primary Account Number (CPAN). + optional string suffix = 1; + + // CPAN Month number 1-12. + optional int32 exp_month = 2; + + // CPAN Four-digit year (e.g. 2017). + optional int32 exp_year = 3; + + // URL of the card art to be displayed for CPAN. + optional string art_fife_url = 4; + + // Opaque identifier for the cloud token associated with the payment + // instrument. + optional string instrument_token = 5; +} + +// Next id: 8 +message CardBenefit { + // The unique identifier of the benefit. Generated originally in Chrome Sync + // server. + optional string benefit_id = 7; + + // The benefit description (Engligh only currently) to be shown in the UI. + optional string benefit_description = 1; + + // When the benefit should be displayed, in UTC time. + optional int64 start_time_unix_epoch_milliseconds = 2; + optional int64 end_time_unix_epoch_milliseconds = 3; + + // Proto containing data specific to a flat rate benefit. Empty as flat rate + // benefits don't have unique fields. The actual benefit (e.g. "2% cash back") + // is already included in the `benefit_description`. + message FlatRateBenefit {} + + // For category benefits, represents the category of purchases that the + // benefit can be applied to. + enum CategoryBenefitType { + CATEGORY_BENEFIT_TYPE_UNKNOWN = 0; + SUBSCRIPTION = 1; + FLIGHTS = 2; + DINING = 3; + ENTERTAINMENT = 4; + STREAMING = 5; + GROCERY_STORES = 6; + AIR_MILES_PARTNER = 7; + ALCOHOL_STORES = 8; + DRUGSTORES = 9; + OFFICE_SUPPLIES = 10; + RECURRING_BILLS = 11; + TRANSIT = 12; + TRAVEL = 13; + WHOLESALE_CLUBS = 14; + } + + // Proto containing data specific to a category benefit. + message CategoryBenefit { + // The type of category purchases the benefit is eligible on. + optional CategoryBenefitType category_benefit_type = 1; + } + + // Proto containing data specific to a merchant benefit. + message MerchantBenefit { + // The merchant domain that the benefit is eligible on. + // Example: https://www.acme.com + repeated string merchant_domain = 1; + } + + // Proto data representing the actual data of the credit card benefit, + // depending on the benefit type. + oneof DomainSpecificBenefit { + FlatRateBenefit flat_rate_benefit = 4; + CategoryBenefit category_benefit = 5; + MerchantBenefit merchant_benefit = 6; + } +} + +message CardIssuer { + enum Issuer { + ISSUER_UNKNOWN = 0; + // Card where the issuer is Google. + GOOGLE = 1; + // Card where the issuer is external. + EXTERNAL_ISSUER = 2; + } + optional Issuer issuer = 1; + + // Uniquely identifies the issuer of the card. This field is required when + // Issuer is EXTERNAL_ISSUER. + // Example: capitalone, amex. + optional string issuer_id = 2; +} + +message WalletMaskedCreditCard { + reserved 9, 14; + reserved "card_class"; + + enum WalletCardStatus { + VALID = 0; + EXPIRED = 1; + } + + enum WalletCardType { + UNKNOWN = 0; + AMEX = 1; + DISCOVER = 2; + JCB = 3; + MAESTRO = 4; + MASTER_CARD = 5; + SOLO = 6; + SWITCH = 7; + VISA = 8; + UNIONPAY = 9; + ELO = 10; + VERVE = 11; + } + + enum VirtualCardEnrollmentState { + UNSPECIFIED = 0; + UNENROLLED = 1 [deprecated = true]; + ENROLLED = 2; + UNENROLLED_AND_NOT_ELIGIBLE = 3; + UNENROLLED_AND_ELIGIBLE = 4; + } + + enum VirtualCardEnrollmentType { + TYPE_UNSPECIFIED = 0; + ISSUER = 1; + NETWORK = 2; + } + + enum CardInfoRetrievalEnrollmentState { + RETRIEVAL_UNSPECIFIED = 0; + RETRIEVAL_ENROLLED = 1; + RETRIEVAL_UNENROLLED_AND_NOT_ELIGIBLE = 2; + RETRIEVAL_UNENROLLED_AND_ELIGIBLE = 3; + } + + enum CardBenefitSource { + SOURCE_UNKNOWN = 0; + SOURCE_AMEX = 1; + SOURCE_BMO = 2; + SOURCE_CURINOS = 3; + } + + enum CardCreationSource { + CREATION_SOURCE_UNSPECIFIED = 0; + CREATION_SOURCE_CHROME_PAYMENTS = 1; + CREATION_SOURCE_NON_CHROME_PAYMENTS = 2; + } + + // Server-generated unique ID string. This is opaque to the client. + // This is the legacy version of `instrument_id`. + optional string id = 1; + + // What the server thinks of this card. + optional WalletCardStatus status = 2; + + optional string name_on_card = 3; + + optional WalletCardType type = 4; + + // Last 4 digits of the credit card number. + optional string last_four = 5; + + // Month number 1-12. + optional int32 exp_month = 6; + + // Four-digit year (e.g. 2017). + optional int32 exp_year = 7; + + // The WalletPostalAddress.id of the billing address. + optional string billing_address_id = 8; + + // Issuing Bank name which is internationalized (e.g. "Chase", "工商银行") + optional string bank_name = 10; + + // TODO(crbug.com/40105930): Deprecated, remove this once dependent change is + // done. + // Use WalletCreditCardCloudTokenData instead. This field will be set if + // a cloud token is available for the instrument. + optional CloudTokenData cloud_token_data = 11; + + // The card's nickname, if it exists. + optional string nickname = 12; + + // Issuer of the card. + optional CardIssuer card_issuer = 13; + + // Server-generated unique ID. This is opaque to the client. + // `id` is the legacy version of this. + optional int64 instrument_id = 15; + + // The state of virtual card enrollment. + optional VirtualCardEnrollmentState virtual_card_enrollment_state = 16; + + // The URL for the client to fetch the card art image. + optional string card_art_url = 17; + + // The product description for the card. Used to be shown in the UI. + optional string product_description = 18; + + // The type of virtual card enrollment. kTypeUnspecified indicates that the + // card is unenrolled. + optional VirtualCardEnrollmentType virtual_card_enrollment_type = 19; + + // The benefits (e.g. points or discounts) associated with purchases made + // with the card. + repeated CardBenefit card_benefit = 20; + + // Separate link from the card issuer which provides additional context or + // terms and conditions regarding the credit card product and its benefits. + optional string product_terms_url = 21; + + // The state of enrollement for runtime card info retrieval. Enrollment in + // 'CardInfoRetrieval' will enable runtime retrieval of card information from + // card issuer including card number, expiry and CVC. + optional CardInfoRetrievalEnrollmentState + card_info_retrieval_enrollment_state = 22; + + // The source of the card's benefits. eg: Curinos. Each card can only have one + // single benefit source, even if there are multiple benefits. + optional CardBenefitSource card_benefit_source = 23; + + // The source of the card creation, indicating whether the card was added + // through a Chrome-related service, or through an external service (which + // includes Android Autofill). + optional CardCreationSource card_creation_source = 24; +} + +// Unused by the client since M121. +// TODO(crbug.com/40273491): Some server-side code still relies on this message. +// To keep the protos in sync, it is kept until that code is cleaned up. +// Different than an AutofillProfile because this represents some known address +// on the server that is pulled down rather than synced between Chromes. +message WalletPostalAddress { + optional string id = 1; + + optional string recipient_name = 12; + optional string company_name = 2; + + // This is the street address, of which there may be multiple lines. This + // corresponds to "address_home_line[1|2] in the AutofillProfileSpecifics + // message above. In some locales there may be more than two lines. + repeated string street_address = 3; + + // Also known as "administrative area". This is normally the state or + // province in most countries. + optional string address_1 = 4; + + // Also known as "locality". In the US this is the city. + optional string address_2 = 5; + + // A sub-classification beneath the city, e.g. an inner-city district or + // suburb. Also known as "dependent_locality" + optional string address_3 = 6; + + // Used in certain countries. Also known as "sub_dependent_locality". + optional string address_4 = 7; + + optional string postal_code = 8; + + // Similar to the zipcode column, but used for businesses or organizations + // that might not be geographically contiguous. The canonical example is + // CEDEX in France. + optional string sorting_code = 9; + + optional string country_code = 10; + optional string language_code = 11; + + // Phone number. The format is unspecified and will be explicitly ignored. + optional string phone_number = 13; +} + +// Contains information about a Payments Customer. +message PaymentsCustomerData { + // The billable customer ID associated with the account. + optional string id = 1; +} + +// Contains information about the cloud token data of server credit cards. +message WalletCreditCardCloudTokenData { + // Server-generated ID string for the card this cloud token data is related + // to. This should match the id in WalletMaskedCreditCard for to fetch the + // corresponding actual card data. Note this is not unique across all cloud + // token data, which means one card can have multiple sets of cloud token data + // with the same masked_card_id. + optional string masked_card_id = 1; + + // Last 4-5 digits of the Cloud Primary Account Number (CPAN). + optional string suffix = 2; + + // CPAN Month number 1-12. + optional int32 exp_month = 3; + + // CPAN Four-digit year (e.g. 2017). + optional int32 exp_year = 4; + + // URL of the card art to be displayed for CPAN. + optional string art_fife_url = 5; + + // Opaque identifier for the cloud token. + optional string instrument_token = 6; +} + +// Contains information of payment instruments that can be used by the user. +message PaymentInstrument { + // Opaque identifier for the account stored in Payments Platform. + // This will be used to initiate the payment. + optional int64 instrument_id = 1; + + // Supported payment infrastructures (rail) that allow users to send money + // between the payer and the payee. https://en.wikipedia.org/wiki/Payment_rail + enum SupportedRail { + SUPPORTED_RAIL_UNKNOWN = 0; + // Payment rails for Brazil Open Banking. + PIX = 1; + // International Bank Account Numbers. + IBAN = 2; + // This rail can be used for making payments to push payment targets + // represented as payment hyperlinks that are supported by the instrument + // issuer. The hyperlink will be specified in the href attribute within a + // tag in the DOM representing the payment page. + // More details on payment links can be found at + // https://github.com/aneeshali/paymentlink/blob/main/docs/explainer.md. + PAYMENT_HYPERLINK = 3; + // This rail is used for making payments via card numbers. Example use case: + // Credit/Debit cards, BuyNowPayLater (BNPL), eWallet Fronting cards etc. + CARD_NUMBER = 4; + } + // The supported rails for which a payment can be made for the given account. + // For example, Pix is the open-banking rail in Brazil, UPI is the + // open-banking rail in India. + repeated SupportedRail supported_rails = 2; + + // The URL for the image to be displayed when showing the account to the + // user. + optional string display_icon_url = 3; + + // Nickname for the instrument. + optional string nickname = 4; + + // The backing source for the applicable rails. + oneof instrument_details { + BankAccountDetails bank_account = 5; + WalletMaskedIban iban = 6; + EwalletDetails ewallet_details = 7; + BnplIssuerDetails bnpl_issuer_details = 9; + } + + optional DeviceDetails device_details = 8; + + enum ActionRequired { + ACTION_REQUIRED_UNKNOWN = 0; + // The user needs to accept the relevant ToS to make the instrument usable. + ACCEPT_TOS = 1; + } + + // The action to take to update the instrument. + repeated ActionRequired action_required = 10; +} + +// Details for user's linked and unlinked Buy Now Pay Later issuers. +message BnplIssuerDetails { + // Unique identifier for the BNPL partner. Example: 'affirm'. + optional string issuer_id = 1; + // Eligible price range that the BNPL issuer supports. + repeated EligiblePriceRange eligible_price_range = 2; +} + +// Details for payment instruments that the user is eligible to create an +// instrument with. +message PaymentInstrumentCreationOption { + // Identifier for the payment instrument creation option. + optional string id = 1; + + oneof creation_option { + BnplCreationOption buy_now_pay_later_option = 2; + } +} + +// Buy Now Pay Later details that the user is eligible to create an instrument +// from. +message BnplCreationOption { + // Unique identifier for the BNPL partner. Example: 'affirm'. + optional string issuer_id = 1; + // Eligible price range that the BNPL issuer supports. + repeated EligiblePriceRange eligible_price_range = 2; +} + +// Details the eligible price range that a BNPL issuer supports. Server +// should set min and max price and ensure that they are both for the same +// currency. +message EligiblePriceRange { + // Currency of the price range. This field contains a three-letter currency + // code. + optional string currency = 1; + // Min and max eligible price in micros of currency, i.e. one millionths of + // the base unit (dollars, not cents for example). e.g. $1.05 == 1050000 + // micros. + optional int64 min_price_in_micros = 2; + optional int64 max_price_in_micros = 3; +} + +// Contains information of server IBAN (International Bank Account Number). +message WalletMaskedIban { + // Opaque identifier for the account stored in Payments Platform. + optional string instrument_id = 1; + + // Prefix of the full IBAN value, if available. + optional string prefix = 2; + + // Suffix of the full IBAN value, if available. + optional string suffix = 3; + + // Length of the full IBAN value, if available. + optional int32 length = 4; + + // Nickname for the IBAN, if available. + optional string nickname = 5; +} + +// Details of a bank account required to show it in the payment instrument +// selector. +message BankAccountDetails { + // The name of the bank where the user has an account. + optional string bank_name = 1; + + // The last four digits of the account number to help the user identify their + // account. + optional string account_number_suffix = 2; + + enum AccountType { + ACCOUNT_TYPE_UNSPECIFIED = 0; + CHECKING = 1; + SAVINGS = 2; + CURRENT = 3; + SALARY = 4; + TRANSACTING_ACCOUNT = 5; + } + // The type of bank account. + optional AccountType account_type = 3; +} + +// Details of an eWallet account required to show it in the payment instrument +// selector. +message EwalletDetails { + // Name of the ewallet provider. + optional string ewallet_name = 1; + + // Display name of the ewallet account. + optional string account_display_name = 2; + + // Payment hyperlinks will be embedded in payment web pages. Chrome will match + // the payment link against the list of payment link URI regexes below. If + // there is a match, the payment flow will be initiated via the Payments + // Server. The regex matching approach makes it possible to launch new payment + // methods without requiring any client side changes. More details on payment + // links can be found at + // https://github.com/aneeshali/paymentlink/blob/main/docs/explainer.md. + repeated string supported_payment_link_uris = 3; +} + +// This field captures all of the information related to the instrument-device +// combo that is required for the payment flows. +message DeviceDetails { + // Whether the device is enrolled in FIDO for this instrument. Depending on + // the FIDO state, the Chrome client will show a different UI for the + // user. For an unbound device, there will be some user-education content and + // the user will be asked to complete FIDO binding. For an already-bound + // device, the user will see a more simplified UI. + optional bool is_fido_enrolled = 1; +} + +message AutofillWalletSpecifics { + enum WalletInfoType { + UNKNOWN = 0; + MASKED_CREDIT_CARD = 1; + // POSTAL_ADDRESS is unused by the client since M121. + POSTAL_ADDRESS = 2; + CUSTOMER_DATA = 3; + CREDIT_CARD_CLOUD_TOKEN_DATA = 4; + PAYMENT_INSTRUMENT = 5; + MASKED_IBAN = 6 [deprecated = true]; + PAYMENT_INSTRUMENT_CREATION_OPTION = 7; + } + + optional WalletInfoType type = 1; + + // This field exists if and only if the "type" field equals to + // MASKED_CREDIT_CARD. + optional WalletMaskedCreditCard masked_card = 2; + + // Unused by the client since M121. + // This field exists if and only if the `type` equals POSTAL_ADDRESS. + // TODO(crbug.com/40273491): Some server-side code still relies on this field. + // To keep the protos in sync, it is kept until that code is cleaned up. + optional WalletPostalAddress address = 3; + + // This field exists if and only if the "type" field equals to CUSTOMER_DATA. + optional PaymentsCustomerData customer_data = 4; + + // This field exists if and only if the "type" field equals to + // CREDIT_CARD_CLOUD_TOKEN_DATA. + optional WalletCreditCardCloudTokenData cloud_token_data = 5; + + // This field exists if and only if the "type" field equals to + // PAYMENT_INSTRUMENT. + optional PaymentInstrument payment_instrument = 6; + + // This field exists if and only if the `type` field equals to + // MASKED_IBAN. + optional WalletMaskedIban masked_iban = 7 [deprecated = true]; + + // This field exists if and only if the "type" field equals to + // PAYMENT_INSTRUMENT_CREATION_OPTION. + optional PaymentInstrumentCreationOption payment_instrument_creation_option = + 8; +} + +// Wallet card usage information that can be synced. +message WalletMetadataSpecifics { + enum Type { + UNKNOWN = 0; + CARD = 1; + // Unused by the client since M121. + // TODO(crbug.com/40273491): Some server-side code still relies on this. + // To keep the protos in sync, it is kept until that code is cleaned up. + ADDRESS = 2; + IBAN = 3; + } + + // The type of the Wallet metadata. + optional Type type = 1; + + // Base64 encoding of the unique ID string of the corresponding + // AutofillMetadata. + // For Wallet cards, this value is WalletMaskedCreditCard::id. + // For Wallet IBANs, this value is WalletMaskedIban::instrument_id. + optional string id = 2; + + // The number of times that this Wallet card or address was used. + optional int64 use_count = 3; + + // The last use date of this Wallet card or address. Measured in microseconds + // since the Windows epoch (1601). + optional int64 use_date = 4; + + // The id of the profile/address that represents the billing address of this + // Wallet card. + optional string card_billing_address_id = 5; + + // Unused by the client since M121. + // TODO(crbug.com/40273491): Some server-side code still relies on this field. + // To keep the protos in sync, it is kept until that code is cleaned up. + optional bool address_has_converted = 6; +} diff --git a/crates/sync-server/proto/autofill_valuable_metadata_specifics.proto b/crates/sync-server/proto/autofill_valuable_metadata_specifics.proto new file mode 100644 index 0000000..4263156 --- /dev/null +++ b/crates/sync-server/proto/autofill_valuable_metadata_specifics.proto @@ -0,0 +1,48 @@ +// Copyright 2025 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// LINT.IfChange(AutofillValuableMetadataSpecifics) +// Usage metadata for Google Wallet passes. +message AutofillValuableMetadataSpecifics { + // Represents the type of the pass. + enum PassType { + PASS_TYPE_UNSPECIFIED = 0; + LOYALTY_CARD = 1; + VEHICLE_REGISTRATION = 2; + FLIGHT_RESERVATION = 3; + PASSPORT = 4; + DRIVER_LICENSE = 5; + NATIONAL_ID_CARD = 6; + REDRESS_NUMBER = 7; + KNOWN_TRAVELER_NUMBER = 8; + } + + // The id of the Valuabe this metadata belongs to. Used as the client tag. + optional string valuable_id = 1; + + // The amount of times this Valuable was used. + optional int64 use_count = 2; + + // The timestamp of the last use of the Valuable. + optional int64 last_used_date_unix_epoch_micros = 3; + + // The timestamp of the last time the Valuable was modified. + optional int64 last_modified_date_unix_epoch_micros = 4; + + // The type of the pass. + optional PassType pass_type = 5; +} +// LINT.ThenChange(//components/autofill/core/browser/webdata/valuables/valuables_sync_util.cc:TrimAutofillValuableMetadataSpecificsDataForCaching) diff --git a/crates/sync-server/proto/autofill_valuable_specifics.proto b/crates/sync-server/proto/autofill_valuable_specifics.proto new file mode 100644 index 0000000..6da0f18 --- /dev/null +++ b/crates/sync-server/proto/autofill_valuable_specifics.proto @@ -0,0 +1,299 @@ +// Copyright 2025 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// LINT.IfChange(AutofillValuableSpecifics) +// This is a copy of google.protobuf.Any. +message Any { + // A URL/resource name that uniquely identifies the type of the serialized + // protocol buffer message. + optional string type_url = 1; + + // Must be a valid serialized protocol buffer of the above specified type. + optional bytes value = 2; +} + +// Represents a date without a time zone. This is useful for dates on physical +// documents, like an issue date of a passport. +message NaiveDate { + optional int32 day = 1; + optional int32 month = 2; + optional int32 year = 3; +} + +// Represents a loyalty card from Google Wallet. +message LoyaltyCard { + // The merchant name e.g. "Deutsche Bahn". + optional string merchant_name = 1; + + // The program name e.g. "BahnBonus". + optional string program_name = 2; + + // The logo URL. + optional string program_logo = 3; + + // The loyalty card text code. + optional string loyalty_card_number = 4; + + // Merchant domains associated to the loyalty card. + repeated string merchant_domains = 5; +} + +// Represents a vehicle registration from Google Wallet. +message VehicleRegistration { + // The vehicle make e.g. "Ford". + optional string vehicle_make = 1; + + // The vehicle model e.g. "Fiesta". + optional string vehicle_model = 2; + + // The year when model was first made e.g. "2018". + optional string vehicle_year = 3; + + // The Vehicle Identification Number (VIN). + optional string vehicle_identification_number = 4; + + // The license plate number. + optional string vehicle_license_plate = 5; + + // The region that issued the license plate. + optional string license_plate_region = 6; + + // The country that issued the license plate, normalized to ISO 3166-1 + // alpha-2. + optional string license_plate_country = 7; + + // The owner of the vehicle as it appears on their vehicle registration + // documents. + optional string owner_name = 8; + + // The name of the issuer of the vehicle registration, e.g. "DMV". + // Note that this field is currently not used in Chrome. + optional string issuer_name = 9; +} + +// Represents a flight reservation from Google Wallet. +message FlightReservation { + // The flight number. + optional string flight_number = 1; + + // The flight ticket number. + optional string flight_ticket_number = 2; + + // The flight confirmation code (normally ~6 digits made of alphanumeric + // characters). + optional string flight_confirmation_code = 3; + + // The passenger's full name. + optional string passenger_name = 4; + + // The departure airport in IATA format e.g AMS for Amsterdam Schiphol. + optional string departure_airport = 5; + + // The arrival airport in IATA format e.g LHR for London Heathrow. + optional string arrival_airport = 6; + + // The departure date. This is a server-provided timestamp in microseconds. + optional int64 departure_date_unix_epoch_micros = 7; + + // The arrival date. This is a server-provided timestamp with units in + // microseconds. + optional int64 arrival_date_unix_epoch_micros = 8; + + // The airline logo. This is a Google URI pointing to an image. + optional string airline_logo = 9; + + // The carrier code e.g. BA for British Airways. + optional string carrier_code = 10; + + // The UTC offset of the departure airport's time zone in seconds. + optional int64 departure_airport_utc_offset_seconds = 11; + + // The UTC offset of the arrival airport's time zone in seconds. + optional int64 arrival_airport_utc_offset_seconds = 12; +} + +// Represents a passport information from Google Wallet. +message Passport { + // The masked passport number (typically only the last 4 digits are provided). + optional string masked_number = 1; + + // The owner of the passport. + optional string owner_name = 2; + + // The country that issued the passport, normalized to ISO 3166-1 alpha-2. + optional string country_code = 3; + + reserved 4; + reserved "issue_date_unix_epoch_micros"; + reserved 5; + reserved "expiration_date_unix_epoch_micros"; + + // The issue date of the passport. + optional NaiveDate issue_date = 6; + + // The expiration date of the passport. + optional NaiveDate expiration_date = 7; +} + +// Represents a driver's license from Google Wallet. +message DriverLicense { + // The masked driver's license number (typically only the last 4 digits are + // provided). + optional string masked_number = 1; + + // The owner of the driver's license. + optional string owner_name = 2; + + // The country that issued the driver's license, normalized to ISO 3166-1 + // alpha-2. + optional string country_code = 3; + + // The region that issued the driver's license. + optional string region = 4; + + reserved 5; + reserved "issue_date_unix_epoch_micros"; + reserved 6; + reserved "expiration_date_unix_epoch_micros"; + + // The issue date of the driver's license. + optional NaiveDate issue_date = 7; + + // The expiration date of the driver's license. + optional NaiveDate expiration_date = 8; +} + +// Represents a national ID card from Google Wallet. +message NationalIdCard { + // The masked national ID card number (typically only the last 4 digits are + // provided). + optional string masked_number = 1; + + // The owner of the national ID card. + optional string owner_name = 2; + + // The country that issued the national ID card, normalized to ISO 3166-1 + // alpha-2. + optional string country_code = 3; + + reserved 4; + reserved "issue_date_unix_epoch_micros"; + reserved 5; + reserved "expiry_date_unix_epoch_micros"; + + // The issue date of the national ID card. + optional NaiveDate issue_date = 6; + + // The expiration date of the national ID card. + optional NaiveDate expiration_date = 7; +} + +// Represents a redress number from Google Wallet. +message RedressNumber { + // The masked redress number (typically only the last 4 digits are provided). + optional string masked_number = 1; + + // The owner of the redress number. + optional string owner_name = 2; +} + +// Represents a known traveler number from Google Wallet. +message KnownTravelerNumber { + // The masked known traveler number (typically only the last 4 digits are + // provided). + optional string masked_number = 1; + + // The owner of the known traveler number. + optional string owner_name = 2; + + reserved 3; + reserved "expiry_date_unix_epoch_micros"; + + // The expiration date of the known traveler number. + optional NaiveDate expiration_date = 4; +} + +// Represents an event ticket from Google Wallet. Note that this field is +// currently used by Android but not used in Chrome. +message EventTicket { + // Name of the person assigned to the event ticket. Not necessarily the person + // who owns the ticket in Wallet. + optional string ticket_holder_name = 1; + + // The name of the event, such as "LA Dodgers at SF Giants". + optional string event_name = 2; + + // The name of the venue, such as "AT&T Park". + optional string event_venue_name = 3; + + // The address of the venue, such as "24 Willie Mays Plaza". + optional string event_venue_address = 4; + + // The ticket number of the event ticket. + optional string ticket_number = 5; + + // The issuer of the event ticket. + optional string issuer_name = 6; + + // The start time of the event in windows epoch microseconds. + optional int64 event_start_time_windows_epoch_micros = 7; +} + +// Represents a transit pass from Google Wallet. Note that this field is +// currently used by Android but not used in Chrome. +message TransitPass { + // The transit agency that the transit pass is for. + optional string agency_name = 1; + + // The name of the passenger that the transit pass is for. + optional string passenger_name = 2; + + // The number of the transit pass. + optional string transit_pass_number = 3; + + // The url of the logo of the transit agency. + optional string agency_logo_url = 4; +} + +// Valuables coming from Google Wallet. +message AutofillValuableSpecifics { + // The valuable id. + optional string id = 1; + + // True if the pass is editable by external clients. + optional bool is_editable = 6; + + oneof valuable_data { + LoyaltyCard loyalty_card = 2; + VehicleRegistration vehicle_registration = 3; + FlightReservation flight_reservation = 5; + Passport passport = 7; + DriverLicense driver_license = 8; + NationalIdCard national_id_card = 9; + RedressNumber redress_number = 10; + KnownTravelerNumber known_traveler_number = 11; + // Note that EventTicket is not used in Chrome. + EventTicket event_ticket = 12; + // Note that TransitPass is not used in Chrome. + TransitPass transit_pass = 13; + // add other valuable types here. + } + + // Contains information that is used by Chrome and needs to be persisted + // across clients. + optional Any serialized_chrome_valuables_metadata = 4; +} +// LINT.ThenChange(//components/autofill/core/browser/webdata/valuables/valuables_sync_util.cc:TrimAutofillValuableSpecificsDataForCaching) diff --git a/crates/sync-server/proto/autofill_wallet_credential_specifics.proto b/crates/sync-server/proto/autofill_wallet_credential_specifics.proto new file mode 100644 index 0000000..d3dcd94 --- /dev/null +++ b/crates/sync-server/proto/autofill_wallet_credential_specifics.proto @@ -0,0 +1,27 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Autofill wallet data which stores the relevant card credential data. +message AutofillWalletCredentialSpecifics { + // A server-generated unique ID for the instrument/card. + optional string instrument_id = 1; + + // A 3 or 4 digit card verification code. + optional string cvc = 2; + + // The timestamp of the last update. Used to determine data freshness. + optional int64 last_updated_time_unix_epoch_millis = 3; +} diff --git a/crates/sync-server/proto/autofill_wallet_usage_specifics.proto b/crates/sync-server/proto/autofill_wallet_usage_specifics.proto new file mode 100644 index 0000000..6d81241 --- /dev/null +++ b/crates/sync-server/proto/autofill_wallet_usage_specifics.proto @@ -0,0 +1,43 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Autofill usage data related objects which contains usage data of a payment +// method related to a specific merchant. + +message AutofillWalletUsageSpecifics { + // A unique ID identifying this item. Used as the client tag. + optional string guid = 1; + + // The type of usage data this entity is associated with. + oneof usage_data_type { + VirtualCardUsageData virtual_card_usage_data = 2; + } + + message VirtualCardUsageData { + // The instrument id of the actual card that the virtual card is related to. + optional int64 instrument_id = 1; + + // The last four of the virtual card number. This is tied to the usage + // data because the virtual card number may vary depending on merchants. + optional string virtual_card_last_four = 2; + + // The url of the merchant where the virtual card is used. + optional string merchant_url = 3; + + // The merchant the usage data is related to on the Android platform. + optional string merchant_app_package = 4; + } +} diff --git a/crates/sync-server/proto/bookmark_model_metadata.proto b/crates/sync-server/proto/bookmark_model_metadata.proto new file mode 100644 index 0000000..dcdd2aa --- /dev/null +++ b/crates/sync-server/proto/bookmark_model_metadata.proto @@ -0,0 +1,85 @@ +// Copyright 2018 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto2"; + +package sync_pb; + +import "data_type_state.proto"; +import "entity_metadata.proto"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; +option optimize_for = LITE_RUNTIME; + +// Corresponds to a single bookmark id/metadata pair. +message BookmarkMetadata { + // Bookmark local id. + optional int64 id = 1; + + // Bookmarks sync metadata. + optional EntityMetadata metadata = 2; +} + +// Sync proto to carry the sync metadata for the bookmarks model. It is used for +// persisting and loading sync metadata from disk. +message BookmarkModelMetadata { + // Bookmark global metadata. + optional DataTypeState data_type_state = 1; + + // A set of all bookmarks metadata. + repeated BookmarkMetadata bookmarks_metadata = 2; + + reserved 3; + + reserved 4; + + reserved 5; + + // Indicates whether the reupload of bookmarks has been triggered such that + // they include fields like `type`, `unique_position` and `parent_guid`, which + // means that their sequence number has been increased (independently of + // whether the commit has succeeded or even started). + // TODO(crbug.com/40780588): remove this code when most of bookmarks are + // reuploaded. + optional bool bookmarks_hierarchy_fields_reuploaded = 6; + + // Number of remote updates that were ignored because the parent folder could + // not be determined since sync (bookmark sync) started (since initial sync, + // including initial sync itself). Note that this excludes updates + // representing changes (moves) to existing/tracked bookmarks (i.e. the parent + // folder used to be known, but the new one specified in the update isn't). + // + // Only a minority of users should have a non-zero value, due to a) corrupt + // data, reasons unknown; or b) permanent folders that were unsupported at the + // time the update was received (either for the permanent folder itself or for + // descendants). The absence of this field should be interpreted as 'unknown', + // which roughly means the counter wasn't supported by the browser -M77 or + // below- at the time sync was enabled (it also means, it will remain + // 'unknown' until initial sync is exercised, e.g. sync disabled and + // reenabled). + optional int64 num_ignored_updates_due_to_missing_parent = 7; + + // See field above. Among such ignored updates, this field tracks which was + // the highest server version. This may be useful -in the future- to get a + // sense of "time" (or, since versions are opaque to the client, at least a + // notion of ordering with respect to other updates). The absence of this + // field should be interpreted as 'unknown' and does not distinguish the + // case between a) no updates ignored; and b) field wasn't supported at the + // time the last update was ignored. To distinguish between these two, the + // field above can be used. + optional int64 max_version_among_ignored_updates_due_to_missing_parent = 8; + + // Indicates whether the count of remote updates during the latest initial + // merge exceeded the bookmark limit. This field is mutually exclusive to all + // the other fields and is managed completely by the processor. + // TODO(454302754): Remove this field once + // `last_initial_merge_remote_updates_exceeded_limit_timestamp_windows_epoch_micros` + // is stable. + optional bool last_initial_merge_remote_updates_exceeded_limit = 9; + // The timestamp (in microseconds) when the above limit was exceeded. + optional int64 + initial_merge_remote_updates_exceeded_limit_timestamp_windows_epoch_micros = + 10; +} diff --git a/crates/sync-server/proto/bookmark_specifics.proto b/crates/sync-server/proto/bookmark_specifics.proto new file mode 100644 index 0000000..cdf7d2d --- /dev/null +++ b/crates/sync-server/proto/bookmark_specifics.proto @@ -0,0 +1,95 @@ +// Copyright 2012 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Sync protocol datatype extension for bookmarks. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +import "unique_position.proto"; + +// Corresponds to a single meta info key/value pair for a bookmark node. +message MetaInfo { + optional string key = 1; + optional string value = 2; +} + +// Properties of bookmark sync objects. +message BookmarkSpecifics { + // URL of the bookmarked page (unset for folders). + optional string url = 1; + // PNG-encoded content of the favicon image (in practice 16x16, as determined + // by `kFaviconSize`). Empty if the bookmark has no favicon (which includes + // bookmark folders). + optional bytes favicon = 2; + // Contains legacy title which is truncated and may contain escaped symbols. + optional string legacy_canonicalized_title = 3; + // Corresponds to BookmarkNode::date_added() represented as microseconds since + // the Windows epoch. + optional int64 creation_time_us = 4; + // The URL of the favicon image encoded in field `favicon`. Note that there + // are various cases where this URL may be missing (field unset or empty) even + // if the `favicon` field (image content) is populated: + // 1. WebUI pages such as "chrome://bookmarks/" are missing a favicon URL but + // they have a favicon. + // 2. Data generated by ancient clients (prior to M25) may not contain the + // favicon URL. + // 3. If the favicon URL is too large (determined by `kMaxFaviconUrlSize`) it + // may be omitted by clients to avoid running into the max-entity-size + // limit. Most notably, this includes URLs prefixed with the data: scheme + // that may encode the image content itself in the URL. + optional string icon_url = 5; + repeated MetaInfo meta_info = 6; + reserved 7; + reserved 8; + reserved 9; + // Introduced in M81, it represents a globally unique and immutable ID. + // + // If present, it must be the same as originator_client_item_id in lowercase, + // unless originator client item ID is not a valid GUID. In such cases (which + // is the case for bookmarks created before 2015), this GUID must match the + // value inferred from the combination of originator cache GUID and + // originator client item ID, see InferGuidForLegacyBookmark(). + // + // If not present, the value can be safely inferred using the very same + // methods listed above. + optional string guid = 10; + // Contains full title as is. `legacy_canonicalized_title` is a prefix of + // `full_title` with escaped symbols. + optional string full_title = 11; + reserved 12; + reserved 13; + // Introduced in M94, represents the GUID (field `guid`) of the parent. + optional string parent_guid = 14; + + // Introduced in M94, determines whether this entity represents a bookmark + // folder. This field is redundant to the similar field in SyncEntity. If this + // field in specifics is set, it takes precedence over the one in SyncEntity. + enum Type { + // `UNSPECIFIED` is relevant only for the case where the field is not set. + // M94 and above should not use this value. + UNSPECIFIED = 0; + URL = 1; + FOLDER = 2; + } + optional Type type = 15; + + // Introduced in M94, determines ordering among siblings. This field is + // redundant to the similar field in SyncEntity. If this field in specifics is + // set, it takes precedence over the one in SyncEntity. + optional UniquePosition unique_position = 16; + + // Introduced in M106, corresponds to BookmarkNode::date_last_used() + // represented as microseconds since the Windows epoch. + optional int64 last_used_time_us = 17; +} diff --git a/crates/sync-server/proto/client_commands.proto b/crates/sync-server/proto/client_commands.proto new file mode 100644 index 0000000..f685619 --- /dev/null +++ b/crates/sync-server/proto/client_commands.proto @@ -0,0 +1,55 @@ +// Copyright 2012 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Sync protocol for communication between sync client and server. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +message CustomNudgeDelay { + optional int32 datatype_id = 1; // Datatype id. + optional int32 delay_ms = 2; // Delay in milliseconds. +} + +message ClientCommand { + // Time to wait before sending any requests to the server. + optional int32 set_sync_poll_interval = 1; // in seconds + // This has been deprecated since M75. + optional int32 set_sync_long_poll_interval = 2 [deprecated = true]; + + optional int32 max_commit_batch_size = 3; + + // Number of seconds to delay before the throttled client should retry. + optional int32 throttle_delay_seconds = 5; + + // This has been deprecated since M109. + optional int32 client_invalidation_hint_buffer_size = 6 [deprecated = true]; + + // A dictionary of custom nudge delays. + repeated CustomNudgeDelay custom_nudge_delays = 8; + + // Configuration for commit quota of extension-related data types. + // The maximum count of tokens (=initial at browser startup) and the + // interval for refilling one more token if not at maximum. + optional int32 extension_types_max_tokens = 9; + optional int32 extension_types_refill_interval_seconds = 10; + + // Extended nudge delay for data types with depleted quota. + optional int32 extension_types_depleted_quota_nudge_delay_seconds = 11; + + reserved 4; + reserved "sessions_commit_delay_seconds"; + + reserved 7; + reserved "gu_retry_delay_seconds"; +} diff --git a/crates/sync-server/proto/client_debug_info.proto b/crates/sync-server/proto/client_debug_info.proto new file mode 100644 index 0000000..8cbad21 --- /dev/null +++ b/crates/sync-server/proto/client_debug_info.proto @@ -0,0 +1,92 @@ +// Copyright 2012 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Sync protocol for debug info clients can send to the sync server. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +import "get_updates_caller_info.proto"; +import "sync_enums.proto"; + +// Per-type hint information. +message TypeHint { + // The data type this hint applied to. + optional int32 data_type_id = 1; + + // Whether or not a valid hint is provided. + optional bool has_valid_hint = 2; +} + +// The additional info here is from the StatusController. They get sent when +// the event SYNC_CYCLE_COMPLETED is sent. +message SyncCycleCompletedEventInfo { + reserved 1; + reserved "syncer_stuck"; + reserved 2; + reserved "num_blocking_conflicts"; + reserved 3; + reserved "num_non_blocking_conflicts"; + + // These new conflict counters replace the ones above. + // TODO(crbug.com/40833583): Deprecated in M103. + optional int32 num_encryption_conflicts = 4 [deprecated = true]; + optional int32 num_hierarchy_conflicts = 5 [deprecated = true]; + optional int32 num_simple_conflicts = 6; // No longer sent since M24. + optional int32 num_server_conflicts = 7; + + // Counts to track the effective usefulness of our GetUpdate requests. + optional int32 num_updates_downloaded = 8; + // TODO(crbug.com/40833583): Deprecated in M103. + optional int32 num_reflected_updates_downloaded = 9 [deprecated = true]; + + // `caller_info` was mostly replaced by `get_updates_origin`; now it only + // contains the `notifications_enabled` flag. + optional GetUpdatesCallerInfo caller_info = 10; + + // Deprecated in M67. + reserved 11; + reserved "source_info"; + + optional SyncEnums.GetUpdatesOrigin get_updates_origin = 12; +} + +message DebugEventInfo { + // Each of the following fields correspond to different kinds of events. as + // a result, only one is set during any single DebugEventInfo. + // A singleton event. See enum definition. + optional SyncEnums.SingletonDebugEventType singleton_event = 1; + // A sync cycle completed. + optional SyncCycleCompletedEventInfo sync_cycle_completed_event_info = 2; + // A datatype triggered a nudge. + optional int32 nudging_datatype = 3; + // A notification triggered a nudge. + repeated int32 datatypes_notified_from_server = 4; + + reserved "datatype_association_stats"; + reserved 5; +} + +message DebugInfo { + repeated DebugEventInfo events = 1; + + // Whether cryptographer is ready to encrypt and decrypt data. + optional bool cryptographer_ready = 2; + + // Cryptographer has pending keys which indicates the correct passphrase + // has not been provided yet. + optional bool cryptographer_has_pending_keys = 3; + + // Indicates client has dropped some events to save bandwidth. + optional bool events_dropped = 4; +} diff --git a/crates/sync-server/proto/collaboration_group_metadata.proto b/crates/sync-server/proto/collaboration_group_metadata.proto new file mode 100644 index 0000000..3734095 --- /dev/null +++ b/crates/sync-server/proto/collaboration_group_metadata.proto @@ -0,0 +1,23 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// This proto contains metadata about the specific collaboration. Each +// CollaborationGroupMetadata should be mapped to a specific CollaborationGroup, +// though the mapping happens outside of Chrome Sync. +message CollaborationGroupMetadata { + // The current version of a collaboration group. This is used for ensuring + // that old and new clients can enable or disable functionality based on: + // (1) The value of this field. + // (2) What that specific version of Chrome supports. + optional int64 version = 1; +} diff --git a/crates/sync-server/proto/collaboration_group_specifics.proto b/crates/sync-server/proto/collaboration_group_specifics.proto new file mode 100644 index 0000000..d3e9f9c --- /dev/null +++ b/crates/sync-server/proto/collaboration_group_specifics.proto @@ -0,0 +1,37 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Special sync datatype to notify client about People Group changes. +message CollaborationGroupSpecifics { + // Unique identifier for a collaboration group, also known as `group_id` or + // `group_name`. + optional string collaboration_id = 1; + + // Indicates staleness of the collaboration group, used to determine whether + // client should refresh cached group. Server-side derived from group event + // `changed_at`. + optional int64 changed_at_timestamp_millis_since_unix_epoch = 2; + + // An opaque token, that is used to optimize ReadGroup(s) RPCs. + optional string consistency_token = 3; + + // A stable identifier that remains constant across sharing and unsharing + // events. + // Note: Older group will not have this field filled and should use + // `collaboration_id` instead while newer groups created with context id will + // use this as the `collaboration_id`. + optional string context_id = 4; +} diff --git a/crates/sync-server/proto/contact_info_specifics.proto b/crates/sync-server/proto/contact_info_specifics.proto new file mode 100644 index 0000000..53666be --- /dev/null +++ b/crates/sync-server/proto/contact_info_specifics.proto @@ -0,0 +1,257 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// LINT.IfChange(ContactInfoSpecifics) +message ContactInfoSpecifics { + // Used to distinguish whether the address is the dedicated Home or Work + // address of the user's account. + // This translates into `AutofillProfile::RecordType::kAccount*`. + enum AddressType { + REGULAR = 0; + HOME = 1; + WORK = 2; + } + + // Represents the validation status of a stored value. + enum VerificationStatus { + // No verification status assigned. + VERIFICATION_STATUS_UNSPECIFIED = 0; + // The value token was parsed from a parent token. + // For example, the first name was derived by splitting a full name into + // its components. + PARSED = 1; + // Value was built from its subcomponents. + // For example, the full name was built from the first, middle and last + // name. + FORMATTED = 2; + // The value was observed in a form transmission. + // For example, the user filled a form that contained at NAME_FULL field. + // The value of NAME_FULL will be stored as OBSERVED. + OBSERVED = 3; + // The user used the settings UI to verify and store this token. + // This is currently only applicable to the full name, since users cannot + // edit individual components of their name. + USER_VERIFIED = 4; + // The token was parsed remotely. + SERVER_PARSED = 5; + } + + message Observation { + // An `autofill::ProfileTokenQuality::ObservationType`. Represented as a + // uint32 to retain future enum values (since this is proto2). + // The `ObservationType`'s underlying type is uint8_t, but this is not + // supported by protos. Since the uint32 Proto type uses variable-length + // encoding, uint32 has a similar size as a single element byte[]. + optional uint32 type = 1; + // The `autofill::ProfileTokenQuality::FormSignatureHash` has type uint8_t. + // Like for `type`, this should have the (non-existing) data type uint8. + optional uint32 form_hash = 2; + } + + // Metadata that is attached to every token type. + message TokenMetadata { + optional VerificationStatus status = 1; + repeated Observation observations = 2; + // Stores a hash of the token value that this metadata is associated with. + // This is used by Autofill to detect changes of the token value by external + // integrators. + optional uint32 value_hash = 3; + } + + // A token with a string interpretation of the value. + message StringToken { + optional string value = 1; + optional TokenMetadata metadata = 2; + } + + // A globally unique, immutable UUID represented in lowercase. + optional string guid = 1; + reserved 2; + reserved "source"; + optional AddressType address_type = 56 [default = REGULAR]; + + // The number of time this profile has been used. + optional int64 use_count = 3; + + // The last time this profile was used. Since profile creation counts as a + // use, this should always have a value. + optional int64 use_date_unix_epoch_seconds = 4; + reserved 54, 55; + reserved "use_date2_unix_epoch_seconds", "use_date3_unix_epoch_seconds"; + + // The last time the profile was modified. + optional int64 date_modified_unix_epoch_seconds = 37; + + // The BCP 47 language code used to format the address for display. + optional string language_code = 38; + + // A label intended to be chosen by the user. This was however never + // implemented and is currently unused. + optional string profile_label = 5; + + // Tracks the application that initially created the profile. The integer + // represents a value in the server-side enum `BillableService`. A value of + // 70073 represents Chrome (enum value BILLABLE_SERVICE_CHROME_PAYMENTS). + optional int32 initial_creator_id = 39; + // This field is no longer used. Leaving it as deprecated instead of reserved + // as it should still be treated as supported for the purpose of trimming to + // ensure it is properly handled for older clients. + optional int32 last_modifier_id = 40 [deprecated = true]; + + // Used to hide account addresses in Chrome. + // Chrome will set this value to true if the address should be filtered out + // on the server side and not passed to Chrome again. + // If Chrome set this value to false or if the value is not set, the address + // will be passed to Chrome. + optional bool invisible_in_autofill = 62; + + // Contact info name fields. + optional StringToken name_first = 7; + optional StringToken name_middle = 8; + optional StringToken name_last = 9; + + reserved 60; + reserved "name_last_prefix"; + reserved 61; + reserved "name_last_core"; + + // Sometimes the last name is composed of two names as it is common for + // Hispanic/Latinx names. In the unstructured representation of the last name, + // there may be even a conjunction between the first and the second last + // name. For example, the more-complete version of Pablo Picasso's surname is + // "Ruiz y Picasso" containing a first last name, a conjunction (the y) and a + // second last name. + optional StringToken name_last_first = 10; + optional StringToken name_last_conjunction = 11; + optional StringToken name_last_second = 12; + optional StringToken name_full = 13; + + reserved 14; + reserved "name_full_with_honorific"; + + // Contact info alternative name fields (e.g. phonetic names in Japan). + optional StringToken alternative_full_name = 57; + optional StringToken alternative_given_name = 58; + optional StringToken alternative_family_name = 59; + + // Contact info additional fields. + optional StringToken email_address = 15; + optional StringToken company_name = 16; + + // Address fields: These are user-provided values with no particular + // guarantees about their format. + optional StringToken address_city = 17; + optional StringToken address_state = 18; + optional StringToken address_zip = 19; + optional StringToken address_country = 20; + optional StringToken address_admin_level_2 = 43; + + // Additional address fields for i18n. + // Includes all of the lines of a street address, including newlines, e.g. + // 123 Main Street, + // Apt. #42 + optional StringToken address_street_address = 21; + // A sorting code is similar to a postal code. However, whereas a postal code + // normally refers to a single geographical location, a sorting code often + // does not. Instead, a sorting code is assigned to an organization, which + // might be geographically distributed. The most prominent example of a + // sorting code system is CEDEX in France. + optional StringToken address_sorting_code = 22; + // A dependent locality is a subunit of a locality, where a "locality" is + // roughly equivalent to a city. Examples of dependent localities include + // inner-city districts and suburbs. + optional StringToken address_dependent_locality = 23; + reserved 24; + reserved "address_language_code"; + // The street name of the address, without a house number. + optional StringToken address_thoroughfare_name = 25; + // The house number, which may be alphanumeric. + optional StringToken address_thoroughfare_number = 26; + // Deprecated in M118. + reserved 27; + reserved "address_dependent_thoroughfare_name"; + reserved 28; + reserved "address_thoroughfare_and_dependent_thoroughfare_name"; + reserved 29; + reserved "address_premise_name"; + // Contains the floor, staircase or apartment number within a building. + optional StringToken address_subpremise_name = 30; + // All the information related to the apartment. Normally a combination of the + // apartment type (address_apt_type) and number (address_apt_num). + // E.g. "Apt 5". + optional StringToken address_apt = 50; + // The apartment number within a building. + optional StringToken address_apt_num = 31; + // Information describing the type of apartment (e.g. Apt, Apartamento, Sala, + // Departamento). + optional StringToken address_apt_type = 51; + // The floor number within a building. + optional StringToken address_floor = 32; + // Contains both the street and house number. + optional StringToken address_street_location = 44; + + optional StringToken address_landmark = 41; + optional StringToken address_overflow = 45; + // Indicates that the address is at the intersection between two streets. + // It is normally a combination of between_streets_1 and _2. This is a common + // way of writing addresses in Mexico. + optional StringToken address_between_streets = 42; + // The meaning of the field is similar to address_between_streets. The + // type should be used for "Entre calle 1" in MX addresses which also + // contain the "Entre calle 2" field. + optional StringToken address_between_streets_1 = 46; + // The meaning of the field is similar to address_between_streets. The + // type should be used for "Entre calle 2" in MX addresses which also + // contain the "Entre calle 1" field. + optional StringToken address_between_streets_2 = 47; + // Combination of types address_between_streets or address_landmark. Note that + // some address forms require the combination of both in a single field as + // opposed to each one separately. + optional StringToken address_between_streets_or_landmark = 48; + // Combination of types address_overflow and address_landmark. Note that some + // address forms require the combination of both in a single field as opposed + // to each one separately. + optional StringToken address_overflow_and_landmark = 49; + // Combination of types address_street_location and + // address_dependent_locality. Note that some address forms require the + // combination of both in a single field as opposed to each one separately. + optional StringToken address_street_location_and_locality = 52; + // Combination of types address_thoroughfare_number and address_apt. Note that + // some address forms require the combination of both in a single field as + // opposed to each one separately. + optional StringToken address_thoroughfare_number_and_apt = 53; + // Prefix of the zip code, e.g., "12345" in "12345-6789". + optional StringToken address_zip_prefix = 63; + // Part of the zip code, excluding prefix and separator. + // For example, "6789" in "12345-6789". + optional StringToken address_zip_suffix = 64; + + // Phone. + optional StringToken phone_home_whole_number = 33; + + // Removed in M123. + reserved 34; + reserved "birthdate_day"; + reserved 35; + reserved "birthdate_month"; + reserved 36; + reserved "birthdate_year"; + + // Removed in M122. + reserved 6; + reserved "name_honorific"; +} +// LINT.ThenChange(//components/autofill/core/browser/webdata/addresses/contact_info_sync_util.cc:TrimContactInfoSpecificsData) diff --git a/crates/sync-server/proto/contextual_task_specifics.proto b/crates/sync-server/proto/contextual_task_specifics.proto new file mode 100644 index 0000000..a06ce4d --- /dev/null +++ b/crates/sync-server/proto/contextual_task_specifics.proto @@ -0,0 +1,58 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +import "ai_thread_specifics.proto"; + +// LINT.IfChange(ContextualTaskSpecifics) + +// Sync datatype representing a contextual task. +message ContextualTaskSpecifics { + // ID to uniquely identify the specifics proto. + optional string guid = 1; + + oneof entity { + ContextualTask contextual_task = 2; + UrlResource url_resource = 3; + } + + // A mechanism to identify the client version that wrote this specifics. + // Designed to aid business logic when reading newly added fields that + // didn't exist in older clients. + // The client version must be incremented whenever a new field is added to the + // specifics. + optional int32 version = 4; +} + +message ContextualTask { + // Title of the task. + optional string title = 1; + + // ID of the AI thread that is associated with the task. + optional string thread_id = 2; + + // Type of the AI thread. + optional AiThreadSpecifics.ThreadType thread_type = 3; +} + +message UrlResource { + // The GUID of its task. + optional string task_guid = 1; + + // URL attached to the task. + optional string url = 2; +} + +// LINT.ThenChange(//components/contextual_tasks/internal/contextual_task_sync_bridge.cc:TrimAllSupportedFieldsFromRemoteSpecifics) diff --git a/crates/sync-server/proto/cookie_specifics.proto b/crates/sync-server/proto/cookie_specifics.proto new file mode 100644 index 0000000..502a60f --- /dev/null +++ b/crates/sync-server/proto/cookie_specifics.proto @@ -0,0 +1,92 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// This proto represents a single cookie. Except for `unique_key` all +// fields should be the same as in `net::CanonicalCookie`. +message CookieSpecifics { + // To be used as a Sync client tag, corresponds to `StrictlyUniqueCookieKey`. + // `StrictlyUniqueCookieKey` contains selected members of + // `net::CanonicalCoookie` which we already save in specifics, but we save the + // key separately to be resilient against future changes to + // `StrictlyUniqueCookieKey`. By reading it from this field (instead of + // computing it from other data in specifics) we make sure that the client tag + // will be stable across different Chrome versions. It also leaves the option + // to check if the key saved in a given entity is aligned with the current + // definition of `StrictlyUniqueCookieKey`. If it is not, client can choose to + // ignore that entity, or implement any other special handling. The string + // saved here is expected to be computed by concatenating serialized values + // from the `StrictlyUniqueCookieKey` for the corresponding cookie. + optional string unique_key = 1; + + optional string name = 2; + optional string value = 3; + optional string domain = 4; + optional string path = 5; + + optional int64 creation_time_windows_epoch_micros = 6; + optional int64 expiry_time_windows_epoch_micros = 7; + optional int64 last_access_time_windows_epoch_micros = 8; + optional int64 last_update_time_windows_epoch_micros = 9; + + optional bool secure = 10; + optional bool httponly = 11; + + // The numbering is different compared to the `net::CookieSameSite` enum since + // the style guide asks to use UNSPECIFIED for the zero value enum + // (https://protobuf.dev/programming-guides/style/#enums). + enum CookieSameSite { + UNSPECIFIED = 0; + NO_RESTRICTION = 1; + LAX_MODE = 2; + STRICT_MODE = 3; + } + + optional CookieSameSite site_restrictions = 12; + + // The numbering is different compared to the `net::CookiePriority` enum since + // the style guide asks to use UNSPECIFIED for the zero value enum + // (https://protobuf.dev/programming-guides/style/#enums). + enum CookiePriority { + UNSPECIFIED_PRIORITY = 0; + LOW = 1; + MEDIUM = 2; + HIGH = 3; + } + + optional CookiePriority priority = 13; + + enum CookieSourceScheme { + UNSET = 0; + NON_SECURE = 1; + SECURE = 2; + }; + + optional CookieSourceScheme source_scheme = 14; + + message SerializedCookiePartitionKey { + optional string top_level_site = 1; + optional bool has_cross_site_ancestor = 2; + } + + optional SerializedCookiePartitionKey partition_key = 15; + optional int32 source_port = 16; + + enum CookieSourceType { + UNKNOWN = 0; + HTTP = 1; + SCRIPT = 2; + OTHER = 3; + }; + + optional CookieSourceType source_type = 17; +} diff --git a/crates/sync-server/proto/data_type_progress_marker.proto b/crates/sync-server/proto/data_type_progress_marker.proto new file mode 100644 index 0000000..5155af9 --- /dev/null +++ b/crates/sync-server/proto/data_type_progress_marker.proto @@ -0,0 +1,173 @@ +// Copyright 2021 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +message DataTypeProgressMarker { + // An integer identifying the data type whose progress is tracked by this + // marker. The legitimate values of this field correspond to the protobuf + // field numbers of all EntitySpecifics fields supported by the server. + // These values are externally declared in per-datatype .proto files. + optional int32 data_type_id = 1; + + // An opaque-to-the-client sequence of bytes that the server may interpret + // as an indicator of the client's knowledge state. If this is empty or + // omitted by the client, it indicates that the client is initiating a + // a first-time sync of this datatype. Otherwise, clients must supply a + // value previously returned by the server in an earlier GetUpdatesResponse. + // These values are not comparable or generable on the client. + // + // The opaque semantics of this field are to afford server implementations + // some flexibility in implementing progress tracking. For instance, + // a server implementation built on top of a distributed storage service -- + // or multiple heterogenous such services -- might need to supply a vector + // of totally ordered monotonic update timestamps, rather than a single + // monotonically increasing value. Other optimizations may also be + // possible if the server is allowed to embed arbitrary information in + // the progress token. + // + // Server implementations should keep the size of these tokens relatively + // small, on the order of tens of bytes, and they should remain small + // regardless of the number of items synchronized. (A possible bad server + // implementation would be for progress_token to contain a list of all the + // items ever sent to the client. Servers shouldn't do this.) + optional bytes token = 2; + + reserved 3; + reserved "timestamp_token_for_migration"; + + reserved 4; + reserved "notification_hint"; + + // This field will be included only in GetUpdates with origin GU_TRIGGER. + optional GetUpdateTriggers get_update_triggers = 5; + + // The garbage collection directive for this data type. The client should + // purge items locally based on this directive. Since this directive is + // designed to be sent from server only, the client should persist it locally + // as needed and avoid sending it to the server. + optional GarbageCollectionDirective gc_directive = 6; +} + +// A single datatype's sync context. Allows the datatype to pass along +// datatype specific information with its own server backend. +message DataTypeContext { + // The type this context is associated with. + optional int32 data_type_id = 1; + // The context for the datatype. + optional bytes context = 2; + // The version of the context. + optional int64 version = 3; +} + +message GarbageCollectionDirective { + enum Type { + UNKNOWN = 0; + VERSION_WATERMARK = 1; + DEPRECATED_AGE_WATERMARK = 2 [deprecated = true]; + DEPRECATED_MAX_ITEM_COUNT = 3 [deprecated = true]; + } + + // Deprecated in M124. This field is unused because it would be hard to use + // `active_collaboration_ids`. The client should rely on the presence of the + // corresponding fields instead. + optional Type type = 1 [default = UNKNOWN, deprecated = true]; + + // This field specifies the watermark for the versions which should get + // garbage collected. The client should purge all sync entities when + // receiving any value of this. This is a change from previous behavior, + // where the client would only be required to purge items older than the + // specified watermark. + // TODO(crbug.com/41410173): Rename this to make clear that whenever it's set, + // the client will delete ALL data, regardless of its value. + optional int64 version_watermark = 2; + + reserved 3; + reserved "age_watermark_in_days"; + + reserved 4; + reserved "max_number_of_items"; + + // This field contains a list of active collaboration IDs which are available + // to the user. The client should stop tracking any shared sync entities with + // collaborations which are not in the list. Note that if the list is empty, + // an empty `collaboration_gc` is expected to be provided by the server. + // Introduced in M124. + message CollaborationGarbageCollection { + repeated string active_collaboration_ids = 1; + } + optional CollaborationGarbageCollection collaboration_gc = 5; +} + +// This message communicates additional per-type information related to +// requests with origin GU_TRIGGER. This message is not relevant when any +// other origin value is used. +message GetUpdateTriggers { + // An opaque-to-the-client string of bytes, received through a notification, + // that the server may interpret as a hint about the location of the latest + // version of the data for this type. + repeated string notification_hint = 1; + + // This flag is set if the client was forced to drop hints because the number + // of queued hints exceeded its limit. The oldest hints will be discarded + // first. + optional bool client_dropped_hints = 2; + + // This flag is set when the client suspects that its list of invalidation + // hints may be incomplete. This may be the case if: + // - The client is syncing for the first time. + // - The client has just restarted and it was unable to keep track of + // invalidations that were received prior to the restart. + // - The client's connection to the invalidation server is currently or + // was recently broken. + // + // It's difficult to provide more details here. This is implemented by + // setting the flag to false whenever anything that might adversely affect + // notifications happens (eg. a crash, restart on a platform that doesn't + // support invalidation ack-tracking, transient invalidation error) and is + // unset only after we've experienced one successful sync cycle while + // notifications were enabled. + optional bool invalidations_out_of_sync = 3; + + // This counts the number of times the syncer has been asked to commit + // changes for this type since the last successful sync cycle. The number of + // nudges may not be related to the actual number of items modified. It + // often correlates with the number of user actions, but that's not always + // the case. + optional int64 local_modification_nudges = 4; + + // This counts the number of times the syncer has been explicitly asked to + // fetch updates for this type since the last successful sync cycle. These + // explicit refresh requests should be relatively rare on most platforms, and + // associated with user actions. For example, at the time of this writing + // the most common (only?) source of refresh requests is when a user opens + // the new tab page on a platform that does not support sessions + // invalidations. + optional int64 datatype_refresh_nudges = 5; + + // This flag is set if the invalidation server reports that it may have + // dropped some invalidations at some point. + optional bool server_dropped_hints = 6; + + // This flag is set if this GetUpdate request is at least in part due to the + // fact that this type has not finished initial sync yet, and the client would + // like to initialize itself with the server data. + // + // Only some types support performing an initial sync as part of a normal + // GetUpdate request. Many types must be in configure mode when fetching + // initial sync data. + optional bool initial_sync_in_progress = 7; + + // This flag is set if this GetUpdate request is due to the client receiving + // a conflict response from the server, so the client needs to sync and then + // resolve the conflict locally, and then commit again. + optional bool sync_for_resolve_conflict_in_progress = 8; +} diff --git a/crates/sync-server/proto/data_type_state.proto b/crates/sync-server/proto/data_type_state.proto new file mode 100644 index 0000000..8db1ef6 --- /dev/null +++ b/crates/sync-server/proto/data_type_state.proto @@ -0,0 +1,94 @@ +// Copyright 2016 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +import "data_type_progress_marker.proto"; + +// Sync proto to store data type global metadata in data type storage. +message DataTypeState { + enum InitialSyncState { + // Default value, typically used when there is no metadata (e.g. because + // Sync is disabled). + INITIAL_SYNC_STATE_UNSPECIFIED = 0; + + // Note: Value "1" is reserved, in case we ever want to introduce an + // INITIAL_SYNC_STARTED state. + + // Indicates that syncing has started and some, but not all updates from the + // initial download/sync have been delivered. This is only used for data + // types in ApplyUpdatesImmediatelyTypes(). + INITIAL_SYNC_PARTIALLY_DONE = 2; + + // Indicates that the initial sync (download + merge) has been completed. + INITIAL_SYNC_DONE = 3; + + // Indicates that no initial sync is necessary, used for CommitOnlyTypes(). + INITIAL_SYNC_UNNECESSARY = 4; + } + + // The latest progress markers received from the server. + optional DataTypeProgressMarker progress_marker = 1; + + // A data type context. Sent to the server in every commit or update + // request. May be updated by either responses from the server or requests + // made on the model thread. The interpretation of this value may be + // data-type specific. Many data types ignore it. + optional DataTypeContext type_context = 2; + + // This value is set if this type's data should be encrypted on the server. + // If this key changes, the client will need to re-commit all of its local + // data to the server using the new encryption key. + optional string encryption_key_name = 3; + + // Indicates the status of "initial sync", i.e. whether the first download + // cycle and initial merge are complete. + optional InitialSyncState initial_sync_state = 9; + + // A GUID that identifies the committing sync client. It's persisted within + // the sync metadata and should be used to check the integrity of the + // metadata. Mismatches with the guid of the running client indicates invalid + // persisted sync metadata, because cache_guid is reset when sync is disabled, + // and disabling sync is supposed to clear sync metadata. + optional string cache_guid = 5; + + // Syncing account obfuscated Gaia ID, representing the user. + optional string authenticated_obfuscated_gaia_id = 6; + + message Invalidation { + // Opaque field, which has to be provided as part of resulting GetUpdates + // back to the server. + optional bytes hint = 1; + + // Version of invalidation, used to order incoming invalidations. + optional int64 version = 2; + } + + // The latest unprocessed invalidations received from the server. + // All incoming invalidations are stored in this message and persist until + // they are used in GetUpdate() message. + repeated Invalidation invalidations = 7; + + // This is relevant for the passwords datatype. This indicates that the + // initial sync flow (downling all passwords from the server) has been run at + // least once after the password notes features is enabled. It is used to + // enforce redownload of passwords upon upgrading the browser to a version + // that supports password notes if necessary. It is false by default and set + // to true upon downloading passwords to make sure this download is executed + // only once. + optional bool notes_enabled_before_initial_sync_for_passwords = 8; + + reserved 4; + reserved "initial_sync_done"; +} diff --git a/crates/sync-server/proto/data_type_store_schema_descriptor.proto b/crates/sync-server/proto/data_type_store_schema_descriptor.proto new file mode 100644 index 0000000..f1d203b --- /dev/null +++ b/crates/sync-server/proto/data_type_store_schema_descriptor.proto @@ -0,0 +1,22 @@ +// Copyright 2016 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Protocol messages used to record the state of the data type store for USS. +// At the time of writing, the data type store uses leveldb, a schemaless +// key-value store. This means that the database's schema is mostly implicit. +// This descriptor isn't intended to fully describe the schema, just keep track +// of which major changes have been applied. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +message DataTypeStoreSchemaDescriptor { + optional int64 version_number = 1; +} diff --git a/crates/sync-server/proto/deletion_origin.proto b/crates/sync-server/proto/deletion_origin.proto new file mode 100644 index 0000000..7582abe --- /dev/null +++ b/crates/sync-server/proto/deletion_origin.proto @@ -0,0 +1,75 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Protobuf representation of the DeletionOrigin class. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +import "sync_enums.proto"; + +// Represents a fingerprint-like token that identifies, or may help identity, +// which piece of functionality is responsible for issuing a deletion that +// propagates via Sync. It is sent to the Sync server as part of deletion +// requests, as a safeguard to investigate and mitigate user reports or even +// large-scale incidents. +message DeletionOrigin { + // Populated by chromium-based browsers with the version that originally + // created the deletion. This will often be the same as the version that + // uploaded (committed) the deletion, but in rare cases the latter could be + // greater (i.e. the browser was updated in between). + optional string chromium_version = 1; + + // Populated by Android Google Play Services with the version of the APK + // identifying the version that originally created the deletion. This should + // not be populated for DeletionOrigin instances that go through Google Play + // Services but were actually first triggered in chromium. + optional string google_play_services_apk_version_name = 2; + + // Hash of the filename in the source code where the deletion originated. The + // precise hashing function is unspecified and may change over time. It may + // only be assumed that the hashing function is the same for a given version + // of the client (see fields above). Hashing is used instead of including the + // actual name to reduce the size of this message. + optional fixed32 file_name_hash = 3; + + // Line of code where the deletion originated. + optional int32 file_line_number = 4; + + // Human-readable and extra optional version of `file_name_hash`. Since the + // file name can be long and includes the full path, this string is very + // likely truncated (and hence not guaranteed to be unique). Truncation will + // remove the beginning of the string rather than the end of it. + optional string file_name_possibly_truncated = 5; + + // Arbitrary but unique tag defined in the source code, when other means + // like the file name and line number aren't possible or desirable. This + // string isn't meant to be too long (recommended limit of 30 characters) and + // is subject to truncation any time. If truncation is used, it will remove + // the beginning of the string rather than the end of it. This field must not + // contain personally-identifiable information. + optional string unique_source_tag_no_pii_possibly_truncated = 6; + + // Google Play Services enum. Used only for deletions triggered internally. + // This field is not populated or used in Chromium. + optional int32 google_play_services_deletion_origin_type = 7; + + // Android SDK version. + // This field is not populated or used in Chromium. + optional string google_play_services_sdk_version = 8; + + // Form factor of the device. + // This field is not populated or used in Chromium. + optional SyncEnums.DeviceFormFactor google_play_services_device_form_factor = + 9; +} diff --git a/crates/sync-server/proto/device_info_specifics.proto b/crates/sync-server/proto/device_info_specifics.proto new file mode 100644 index 0000000..da5564e --- /dev/null +++ b/crates/sync-server/proto/device_info_specifics.proto @@ -0,0 +1,240 @@ +// Copyright 2012 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Sync protocol datatype extension for nigori keys. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +import "sync_enums.proto"; + +// Information about a device that is running a sync-enabled Chrome browser. We +// are mapping the per-client cache guid to more specific information about the +// device. +message DeviceInfoSpecifics { + // The cache_guid created to identify a sync client on this device. + optional string cache_guid = 1; + + // A non-unique but human readable name to describe this client. + optional string client_name = 2; + + // The platform of the device. + // Deprecated in M110, but still populated for backwards compatibility. + // Replaced by os_type + device_form_factor. + optional SyncEnums.DeviceType device_type = 3 [deprecated = true]; + + // The UserAgent used when contacting the Chrome Sync server. + // Only present when talking to the HTTP server. + optional string sync_user_agent = 4; + + // The Chrome instance's version. Updated (if necessary) on every startup. + // DEPRECATED in M92. Still populated for backward compatibility. + optional string chrome_version = 5 [deprecated = true]; + + // Last time when pre-sync data on the device was saved. The device can be + // restored to state back to this time. In millisecond since UNIX epoch. + // DEPRECATED in M50. + optional int64 deprecated_backup_timestamp = 6 [deprecated = true]; + + // Device_id that is stable until user signs out. This device_id is used for + // annotating login scoped refresh token. Present only for Chrome Clients. + optional string signin_scoped_device_id = 7; + + // This field is updated to be the current time periodically, and is also set + // to the current time whenever another field changes. By examining the + // difference between this field and the current time, it should be possible + // to reason about the inactivity of any device that was syncing at one time. + optional int64 last_updated_timestamp = 8; + + // Device info fields that are specific to a feature. This is information that + // can not be derived from the other fields in the proto and are not general + // enough to be used by another feature. + optional FeatureSpecificFields feature_fields = 9; + + // Device specific information for Sharing feature. + optional SharingSpecificFields sharing_fields = 10; + + // Model of device. + optional string model = 11; + + // Name of device manufacturer. + optional string manufacturer = 12; + + // The interval in minutes with which `last_updated_timestamp` is updated to + // the sync servers if online and while sync is actively running (e.g. + // excludes backgrounded apps on Android). Introduced in M81. The legacy + // default was 1 day. + optional int32 pulse_interval_in_minutes = 13; + + // Device specific information for Sync invalidations. + optional InvalidationSpecificFields invalidation_fields = 14; + + // Information for contacting this device in order to perform security key + // operations. + optional PhoneAsASecurityKeySpecificFields paask_fields = 15; + + // Unique hardware identifier string which details the HW combination of + // a ChromeOS device. This field will be empty on other OS devices. + optional string full_hardware_class = 16; + + // Version information to pin-point which client implementation this is. + oneof client_version_info { + ChromeVersionInfo chrome_version_info = 17; + GooglePlayServicesVersionInfo google_play_services_version_info = 18; + } + + // The OS type the device. + optional SyncEnums.OsType os_type = 19; + + // The form factor of the device. + optional SyncEnums.DeviceFormFactor device_form_factor = 20; +} + +// Feature specific information about the device that is running a sync-enabled +// Chrome browser. Adding to this proto is discouraged and should only be added +// when the information can not be derived more generally. +message FeatureSpecificFields { + // Tracks whether the SendTabToSelf feature is enabled on the device. For this + // to be true, two things must be true: (1) The receiving side of the feature + // must be enabled on the device (2) The user has enabled sync for this + // feature. + optional bool send_tab_to_self_receiving_enabled = 1; + + // Tracks which type of Send Tab To Self message(s) can be sent to the + // receiving device. + // If not set, the in-app message type will be assumed. + optional SyncEnums.SendTabReceivingType send_tab_to_self_receiving_type = 2; + + // Tracks the last time this device signed-in with the Auto Sign-Out + // feature enabled. As of 09/2025, this feature is only supported on ChromeOS. + optional int64 auto_sign_out_last_signin_timestamp_windows_epoch_micros = 3; + + // Tracks whether the Desktop to iOS Promo feature is enabled on the device. + // This is populated only for iOS devices. + optional bool desktop_to_ios_promo_receiving_enabled = 4; + + // List of Desktop to iOS Promo types enabled on the device. + // This is populated only for iOS devices. + // The values correspond to the MobilePromoOnDesktopPromoType enum. + repeated SyncEnums.MobilePromoOnDesktopPromoType + desktop_to_ios_promo_receiving_types = 5; +} + +// Device specific information for Sharing feature. Used to send end-to-end +// encrypted message through FCM or unencrypted message through Chime to other +// devices. +message SharingSpecificFields { + reserved 1, 2, 3; + reserved "vapid_fcm_token", "vapid_p256dh", "vapid_auth_secret"; + + // Enum defining available Sharing features. + // LINT.IfChange(EnabledFeatures) + enum EnabledFeatures { + reserved 5; + reserved "PEER_CONNECTION"; + reserved 1; + reserved "CLICK_TO_CALL_VAPID"; + reserved 2; + reserved "SHARED_CLIPBOARD_VAPID"; + + UNKNOWN = 0; + SMS_FETCHER = 3; + REMOTE_COPY = 4; + DISCOVERY = 6; + // Supports Click to Call via sender ID. + CLICK_TO_CALL_V2 = 7; + // Supports Shared Clipboard via sender ID. + SHARED_CLIPBOARD_V2 = 8; + // Supports optimization guide push notification. + OPTIMIZATION_GUIDE_PUSH_NOTIFICATION = 9; + // Supports receiving notifications about new OneTimeTokens in the backend. + ONE_TIME_TOKEN_BACKEND_NOTIFICATION = 10; + } + // LINT.ThenChange(/components/sync_device_info/device_info.h:SharingFeature) + + // A list of enabled Sharing features. + repeated EnabledFeatures enabled_features = 4; + + // Deprecated. Use sender_id_fcm_token_v2 for new clients. + optional string sender_id_fcm_token_deprecated = 5 [deprecated = true]; + + // Deprecated. Use sender_id_p256dh_v2 for new clients. + optional bytes sender_id_p256dh_deprecated = 6 [deprecated = true]; + + // Deprecated. Use sender_id_auth_secret_v2 for new clients. + optional bytes sender_id_auth_secret_deprecated = 7 [deprecated = true]; + + // FCM registration token of device subscribed using Sharing sender ID. + optional string sender_id_fcm_token_v2 = 8; + + // Public key for message encryption [RFC8291] using Sharing sender ID. + optional bytes sender_id_p256dh_v2 = 9; + + // Auth secret for message encryption [RFC8291] using Sharing sender ID. + optional bytes sender_id_auth_secret_v2 = 10; + + // Identifier used to send notifications to a specific device in Chime. Added + // in M128. + optional string chime_representative_target_id = 11; +} + +// Device specific information telling how to send invalidations to this device. +message InvalidationSpecificFields { + // FCM registration token of device (using Sync sender ID). + optional string instance_id_token = 1; + + // This device wants to receive only invalidations which are related to these + // types. The legitimate values of this field correspond to the protobuf field + // numbers of all EntitySpecifics fields supported by the server (see + // components/sync/protocol/sync.proto). + repeated int32 interested_data_type_ids = 2; +} + +message PhoneAsASecurityKeySpecificFields { + // The encoded tunnel server in the same format as in the BLE advert. See + // device::cablev2::tunnelserver::DecodeDomain. (Actually a uint16 but + // proto doesn't have that as a type.) + optional uint32 tunnel_server_domain = 1; + + // An FCM token that can be presented to the tunnel server to contact this + // device. + optional bytes contact_id = 2; + + // A shared secret key, used to enable communication across devices via + // unauthenticated channels. Knowledge of this secret acts as proof that the + // remote end is authorized to talk to the device publishing this secret. + optional bytes secret = 3; + + // An id that identifies `secret`. This, and `secret`, will be rotated and + // the ID allows this device to know which `secret` the counterparty is + // using. + optional fixed32 id = 4; + + // A P-256, X9.62-encoded public key for this device. Specific to the Chrome + // instance. + optional bytes peer_public_key_x962 = 5; + + // The credential ID for use when signing into accounts.google.com. This + // credential ID isn't published as a WebauthnCredentialSpecifics, unlike + // other passkeys, because it's auto-generated. + optional bytes google_credential_id = 6; +} + +message ChromeVersionInfo { + // Version number as per https://www.chromium.org/developers/version-numbers. + optional string version_number = 1; +} + +message GooglePlayServicesVersionInfo { + optional string apk_version_name = 1; +} diff --git a/crates/sync-server/proto/dictionary_specifics.proto b/crates/sync-server/proto/dictionary_specifics.proto new file mode 100644 index 0000000..f670576 --- /dev/null +++ b/crates/sync-server/proto/dictionary_specifics.proto @@ -0,0 +1,23 @@ +// Copyright 2012 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Sync protocol datatype extension for the dictionary. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Properties of Dictionary objects. +message DictionarySpecifics { + // A spelling which when typed is treated as a correctly spelled word. + optional string word = 1; +} diff --git a/crates/sync-server/proto/encryption.proto b/crates/sync-server/proto/encryption.proto new file mode 100644 index 0000000..2c7457b --- /dev/null +++ b/crates/sync-server/proto/encryption.proto @@ -0,0 +1,34 @@ +// Copyright 2012 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Common sync protocol for encrypted data. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Encrypted sync data consists of two parts: a key name and a blob. Key name is +// the name of the key that was used to encrypt blob and blob is encrypted data +// itself. +// +// The reason we need to keep track of the key name is that a sync user can +// change their passphrase (and thus their encryption key) at any time. When +// that happens, we make a best effort to reencrypt all nodes with the new +// passphrase, but since we don't have transactions on the server-side, we +// cannot guarantee that every node will be reencrypted. As a workaround, we +// keep track of all keys, assign each key a name (by using that key to encrypt +// a well known string) and keep track of which key was used to encrypt each +// node. +message EncryptedData { + optional string key_name = 1; + optional string blob = 2; // base64-encoded. +} diff --git a/crates/sync-server/proto/entity_metadata.proto b/crates/sync-server/proto/entity_metadata.proto new file mode 100644 index 0000000..aabb33c --- /dev/null +++ b/crates/sync-server/proto/entity_metadata.proto @@ -0,0 +1,117 @@ +// Copyright 2015 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +package sync_pb; + +import "deletion_origin.proto"; +import "entity_specifics.proto"; +import "unique_position.proto"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; +option optimize_for = LITE_RUNTIME; + +// Sync proto to store entity metadata in data type storage. +message EntityMetadata { + // A hash based on the client tag and data type. + // Used for various map lookups. Should always be available. + // Sent to the server as SyncEntity::client_tag_hash. + optional string client_tag_hash = 1; + + // The entity's server-assigned ID. + // + // Prior to the item's first commit, we leave this value as an empty string. + // The initial ID for a newly created item has to meet certain uniqueness + // requirements, and we handle those on the sync thread. + optional string server_id = 2; + + // Whether or not the entity is deleted. + optional bool is_deleted = 3; + + // A version number used to track in-progress commits. Each local change + // increments this number. + optional int64 sequence_number = 4; + + // The sequence number of the last item known to be successfully committed. + optional int64 acked_sequence_number = 5; + + // The server version on which this item is based. + // + // If there are no local changes, this is the version of the entity as we see + // it here. + // + // If there are local changes, this is the version of the entity on which + // those changes are based. + optional int64 server_version = 6 [default = -1]; + + // Entity creation and modification timestamps. Assigned by the client and + // synced by the server, though the server usually doesn't bother to inspect + // their values. They are encoded as milliseconds since the Unix epoch. + optional int64 creation_time = 7; + optional int64 modification_time = 8; + + // A hash of the current entity specifics value. Used to detect whether + // entity's specifics value has changed without having to keep specifics in + // memory. + optional string specifics_hash = 9; + + // A hash of the last specifics known by both the client and server. Used to + // detect when local commits and remote updates are just for encryption. This + // value will be the empty string only in the following cases: the entity is + // in sync with the server, has never been synced, or is deleted. + optional string base_specifics_hash = 10; + + // Used for positioning entities among their siblings. Relevant only for data + // types that support positions (e.g bookmarks). Refer to its definition in + // unique_position.proto for more information about its internal + // representation. + optional UniquePosition unique_position = 11; + + // Used only for bookmarks. It's analogous to `specifics_hash` but it + // exclusively hashes the content of the favicon image, as represented in + // proto field BookmarkSpecifics.favicon, using base::PersistentHash(). + optional fixed32 bookmark_favicon_hash = 12; + + // Last specifics known by both the client and server. Used during commits to + // the server in order to prevent data loss caused by older clients dealing + // with unknown proto fields (fields that were introduced later). Datatypes + // (DataTypeSyncBridge) may implement logic to trim down (or fully clear) + // this proto prior to caching, to avoid the memory and I/O overhead of + // dealing with an extra copy of the data. Introduced in M101. + optional EntitySpecifics possibly_trimmed_base_specifics = 13; + + // If the entity is deleted, this field will record the chromium version + // (e.g. 117.0.5875.1) that originated the deletion. Introduced in M117. + optional string deleted_by_version = 14; + + // Metadata used for shared data types. Must not be present for regular data + // types. + // Introduced in M124. + message CollaborationMetadata { + message Attribution { + // Obfuscated Gaia ID of the user. + optional string obfuscated_gaia_id = 1; + } + + // Collaboration ID which the current entity belongs to. + optional string collaboration_id = 1; + + // Information about when the specifics was created. + optional Attribution creation_attribution = 2; + + // Information about when the specifics was last updated. + optional Attribution last_update_attribution = 3; + } + optional CollaborationMetadata collaboration = 15; + + // Optionally present for committed deletions (but may remain unset if the + // origin is unspecified), it represents which piece of code triggered a + // deletion. Introduced in M126. + optional DeletionOrigin deletion_origin = 16; +} diff --git a/crates/sync-server/proto/entity_specifics.proto b/crates/sync-server/proto/entity_specifics.proto new file mode 100644 index 0000000..dcf02d9 --- /dev/null +++ b/crates/sync-server/proto/entity_specifics.proto @@ -0,0 +1,213 @@ +// Copyright 2021 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +import "ai_thread_specifics.proto"; +import "contextual_task_specifics.proto"; +import "encryption.proto"; +import "app_list_specifics.proto"; +import "app_setting_specifics.proto"; +import "app_specifics.proto"; +import "arc_package_specifics.proto"; +import "autofill_specifics.proto"; +import "autofill_offer_specifics.proto"; +import "autofill_valuable_specifics.proto"; +import "autofill_valuable_metadata_specifics.proto"; +import "account_setting_specifics.proto"; +import "autofill_wallet_credential_specifics.proto"; +import "autofill_wallet_usage_specifics.proto"; +import "bookmark_specifics.proto"; +import "collaboration_group_specifics.proto"; +import "product_comparison_specifics.proto"; +import "contact_info_specifics.proto"; +import "cookie_specifics.proto"; +import "device_info_specifics.proto"; +import "dictionary_specifics.proto"; +import "extension_setting_specifics.proto"; +import "extension_specifics.proto"; +import "history_delete_directive_specifics.proto"; +import "history_specifics.proto"; +import "managed_user_setting_specifics.proto"; +import "nigori_specifics.proto"; +import "os_preference_specifics.proto"; +import "os_priority_preference_specifics.proto"; +import "password_sharing_invitation_specifics.proto"; +import "password_specifics.proto"; +import "plus_address_setting_specifics.proto"; +import "plus_address_specifics.proto"; +import "preference_specifics.proto"; +import "printer_specifics.proto"; +import "printers_authorization_server_specifics.proto"; +import "priority_preference_specifics.proto"; +import "reading_list_specifics.proto"; +import "saved_tab_group_specifics.proto"; +import "search_engine_specifics.proto"; +import "security_event_specifics.proto"; +import "send_tab_to_self_specifics.proto"; +import "session_specifics.proto"; +import "shared_comment_specifics.proto"; +import "shared_tab_group_data_specifics.proto"; +import "sharing_message_specifics.proto"; +import "theme_specifics.proto"; +import "typed_url_specifics.proto"; +import "user_consent_specifics.proto"; +import "user_event_specifics.proto"; +import "web_apk_specifics.proto"; +import "web_app_specifics.proto"; +import "webauthn_credential_specifics.proto"; +import "wifi_configuration_specifics.proto"; +import "workspace_desk_specifics.proto"; +import "shared_tab_group_account_data_specifics.proto"; +import "skill_specifics.proto"; +import "gemini_thread_specifics.proto"; +import "theme_android_specifics.proto"; +import "theme_ios_specifics.proto"; +import "accessibility_annotation_specifics.proto"; + +message EntitySpecifics { + // If a datatype is encrypted, this field will contain the encrypted + // original EntitySpecifics. The extension for the datatype will continue + // to exist, but contain only the default values. + // Note that currently passwords employ their own legacy encryption scheme and + // do not use this field. + optional EncryptedData encrypted = 1; + + // To add new datatype-specific fields to the protocol, extend + // EntitySpecifics. First, pick a non-colliding tag number by + // picking a Cr-Commit-Position of one of your past commits + // to src.chromium.org. Then, in a different protocol buffer + // definition, define your message type, and add an optional field + // to the list below using the unique tag value you selected. + // + // optional MyDatatypeSpecifics my_datatype = 32222; + // + // where: + // - 32222 is the non-colliding tag number you picked earlier. + // - MyDatatypeSpecifics is the type (probably a message type defined + // in your new .proto file) that you want to associate with each + // object of the new datatype. + // - my_datatype is the field identifier you'll use to access the + // datatype specifics from the code. + // + // Server implementations are obligated to preserve the contents of + // EntitySpecifics when it contains unrecognized fields. In this + // way, it is possible to add new datatype fields without having + // to update the server. + // + // Note: The tag selection process is based on legacy versions of the + // protocol which used protobuf extensions. We have kept the process + // consistent as the old values cannot change. The 5+ digit nature of the + // tags also makes them recognizable (individually and collectively) from + // noise in logs and debugging contexts, and creating a divergent subset of + // tags would only make things a bit more confusing. + + oneof specifics_variant { + AutofillSpecifics autofill = 31729; + BookmarkSpecifics bookmark = 32904; + PreferenceSpecifics preference = 37702; + ThemeAndroidSpecifics theme_android = 1587331; + ThemeIosSpecifics theme_ios = 1577986; + ThemeSpecifics theme = 41210; + PasswordSpecifics password = 45873; + NigoriSpecifics nigori = 47745; + ExtensionSpecifics extension = 48119; + AppSpecifics app = 48364; + SessionSpecifics session = 50119; + AutofillProfileSpecifics autofill_profile = 63951; + SearchEngineSpecifics search_engine = 88610; + ExtensionSettingSpecifics extension_setting = 96159; + AppSettingSpecifics app_setting = 103656; + HistoryDeleteDirectiveSpecifics history_delete_directive = 150251; + DeviceInfoSpecifics device_info = 154522; + PriorityPreferenceSpecifics priority_preference = 163425; + DictionarySpecifics dictionary = 170540; + ManagedUserSettingSpecifics managed_user_setting = 186662; + AppListSpecifics app_list = 229170; + AutofillWalletSpecifics autofill_wallet = 306270; + WalletMetadataSpecifics wallet_metadata = 330441; + ArcPackageSpecifics arc_package = 340906; + PrinterSpecifics printer = 410745; + ReadingListSpecifics reading_list = 411028; + UserEventSpecifics user_event = 455206; + UserConsentSpecifics user_consent = 556014; + SendTabToSelfSpecifics send_tab_to_self = 601980; + SecurityEventSpecifics security_event = 600372; + WebApkSpecifics web_apk = 1117170; + WebAppSpecifics web_app = 673225; + WifiConfigurationSpecifics wifi_configuration = 662827; + OsPreferenceSpecifics os_preference = 702141; + OsPriorityPreferenceSpecifics os_priority_preference = 703915; + SharingMessageSpecifics sharing_message = 728866; + AutofillOfferSpecifics autofill_offer = 774329; + WorkspaceDeskSpecifics workspace_desk = 874841; + WebauthnCredentialSpecifics webauthn_credential = 895275; + HistorySpecifics history = 963985; + PrintersAuthorizationServerSpecifics printers_authorization_server = 974304; + SavedTabGroupSpecifics saved_tab_group = 1004874; + AutofillWalletUsageSpecifics autofill_wallet_usage = 1033580; + ContactInfoSpecifics contact_info = 1034378; + IncomingPasswordSharingInvitationSpecifics + incoming_password_sharing_invitation = 1141935; + OutgoingPasswordSharingInvitationSpecifics + outgoing_password_sharing_invitation = 1142081; + AutofillWalletCredentialSpecifics autofill_wallet_credential = 1164238; + SharedTabGroupDataSpecifics shared_tab_group_data = 1239418; + CollaborationGroupSpecifics collaboration_group = 1259076; + ProductComparisonSpecifics product_comparison = 1329438; + PlusAddressSpecifics plus_address = 1267844; + CookieSpecifics cookie = 1281100; + PlusAddressSettingSpecifics plus_address_setting = 1303742; + AutofillValuableSpecifics autofill_valuable = 1419865; + SharedTabGroupAccountDataSpecifics shared_tab_group_account_data = 1429255; + SharedCommentSpecifics shared_comment = 1484017; + AccountSettingSpecifics account_setting = 1438954; + AiThreadSpecifics ai_thread = 1517585; + ContextualTaskSpecifics contextual_task = 1518931; + AutofillValuableMetadataSpecifics autofill_valuable_metadata = 1520954; + SkillSpecifics skill = 1564245; + GeminiThreadSpecifics gemini_thread = 1569348; + AccessibilityAnnotationSpecifics accessibility_annotation = 1588764; + // When adding a new type, follow the docs below and keep this comment as + // the last entry. + // https://www.chromium.org/developers/design-documents/sync/integration-checklist/ + + // No-longer-supported data types, in various stages of removal. + // TODO(crbug.com/40881888): Eventually, these should all become "reserved" + // fields, or at least use "EmptySpecifics". But some of them are still + // needed by the server, e.g. to support older clients. + EmptySpecifics app_notification = 45184 [deprecated = true]; + EmptySpecifics synced_notification = 153108 [deprecated = true]; + EmptySpecifics synced_notification_app_info = 235816 [deprecated = true]; + EmptySpecifics managed_user = 194582 [deprecated = true]; + EmptySpecifics managed_user_shared_setting = 202026 [deprecated = true]; + EmptySpecifics managed_user_allowlist = 306060 [deprecated = true]; + TypedUrlSpecifics typed_url = 40781 [deprecated = true]; + } + reserved 161496; + reserved "experiments"; + reserved 181534; + reserved "favicon_tracking"; + reserved 182019; + reserved "favicon_image"; + reserved 218175; + reserved "wifi_credential"; + reserved 223759; + reserved "article"; + reserved 545005; + reserved "mountain_share"; + reserved 1026052; + reserved "segmentation"; + reserved 1073150; + reserved "power_bookmark"; +} + +message EmptySpecifics {} diff --git a/crates/sync-server/proto/extension_setting_specifics.proto b/crates/sync-server/proto/extension_setting_specifics.proto new file mode 100644 index 0000000..d6c4958 --- /dev/null +++ b/crates/sync-server/proto/extension_setting_specifics.proto @@ -0,0 +1,29 @@ +// Copyright 2012 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Sync protocol datatype extension for an extension setting. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Properties of extension setting sync objects. +message ExtensionSettingSpecifics { + // Id of the extension the setting is for. + optional string extension_id = 1; + + // Setting key. + optional string key = 2; + + // Setting value serialized as JSON. + optional string value = 3; +} diff --git a/crates/sync-server/proto/extension_specifics.proto b/crates/sync-server/proto/extension_specifics.proto new file mode 100644 index 0000000..e72c9d7 --- /dev/null +++ b/crates/sync-server/proto/extension_specifics.proto @@ -0,0 +1,64 @@ +// Copyright 2012 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Sync protocol datatype extension for extensions. + +// If you change or add any fields in this file, update proto_visitors.h and +// potentially proto_enum_conversions.{h, cc}. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "org.chromium.components.sync.protocol"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +// Properties of extension sync objects. +// +// Merge policy: the settings for the higher version number win; in +// the case of a tie, server wins. +message ExtensionSpecifics { + // Globally unique id for this extension. + optional string id = 1; + // The known installed version. + optional string version = 2; + + // Auto-update URL to use for this extension. May be blank, in + // which case the default one (i.e., the one for the Chrome + // Extensions Gallery) is used. + optional string update_url = 3; + // Whether or not this extension is enabled. + // TODO(crbug.com/40554334): Deprecate this field. Enabled state can be + // determined from the disable reasons set. + optional bool enabled = 4; + // Whether or not this extension is enabled in incognito mode. + optional bool incognito_enabled = 5; + + // DEPRECATED. See https://crbug.com/1233303. + optional string name = 6 [deprecated = true]; + + // Whether this extension was installed remotely, and hasn't been approved by + // a user in chrome yet. + optional bool remote_install = 7; + + // DEPRECATED. See https://crbug.com/1014183. + optional bool installed_by_custodian = 8 [deprecated = true]; + + // DEPRECATED. See https://crbug.com/839681. + optional bool all_urls_enabled = 9 [deprecated = true]; + + // Bitmask of the set of reasons why the extension is disabled (see + // extensions::disable_reason::DisableReason). Only relevant when enabled == + // false. Note that old clients (