chromium/components/sync/protocol/device_info_specifics.proto

// 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 "components/sync/protocol/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 floating workspace
  // feature enabled. As of 07/2024, this feature is only supported on ChromeOS.
  optional int64 floating_workspace_last_signin_time_windows_epoch_micros = 3;
}

// 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 {
  // FCM registration token of device subscribed using VAPID key.
  // TODO(crbug.com/40102247): Deprecate when VAPID migration is over.
  optional string vapid_fcm_token = 1;

  // Public key for message encryption [RFC8291] using VAPID key.
  // TODO(crbug.com/40102247): Deprecate when VAPID migration is over.
  optional bytes vapid_p256dh = 2;

  // Auth secret for message encryption [RFC8291] using VAPID key.
  // TODO(crbug.com/40102247): Deprecate when VAPID migration is over.
  optional bytes vapid_auth_secret = 3;

  // Enum defining available Sharing features.
  enum EnabledFeatures {
    reserved 5;
    reserved "PEER_CONNECTION";

    UNKNOWN = 0;
    // Supports Click to Call only via VAPID.
    CLICK_TO_CALL_VAPID = 1;
    // Supports Shared Clipboard only via VAPID.
    SHARED_CLIPBOARD_VAPID = 2;
    SMS_FETCHER = 3;
    REMOTE_COPY = 4;
    DISCOVERY = 6;
    // Suppots Click to Call via both VAPID and sender ID.
    CLICK_TO_CALL_V2 = 7;
    // Suppots Shared Clipboard via both VAPID and sender ID.
    SHARED_CLIPBOARD_V2 = 8;
    // Supports optimization guide push notification.
    OPTIMIZATION_GUIDE_PUSH_NOTIFICATION = 9;
  }

  // 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;
}