This commit is contained in:
Grishka
2025-08-04 21:34:22 +03:00
parent 819fb63eaa
commit c9ffb12bed
8 changed files with 7986 additions and 237 deletions

View File

@@ -1,26 +1,41 @@
// 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.
// Brought from: //depot/google3/location/nearby/sharing/proto/wire_format.proto
// At CL 317565061
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto2";
//package nearby.sharing.service.proto;
package sharing.nearby;
// Required in Chrome.
// import "storage/datapol/annotations/proto/semantic_annotations.proto";
import "sharing_enums.proto";
option java_package = "com.google.android.gms.nearby.sharing";
option java_outer_classname = "Protocol";
option objc_class_prefix = "GNSHP";
option optimize_for = LITE_RUNTIME;
// File metadata. Does not include the actual bytes of the file.
// NEXT_ID=6
// NEXT_ID=10
message FileMetadata {
enum Type {
UNKNOWN = 0;
IMAGE = 1;
VIDEO = 2;
APP = 3;
ANDROID_APP = 3;
AUDIO = 4;
DOCUMENT = 5;
CONTACT_CARD = 6;
}
// The human readable name of this file (eg. 'Cookbook.pdf').
@@ -43,9 +58,19 @@ message FileMetadata {
// A uuid for the attachment. Should be unique across all attachments.
optional int64 id = 6;
// The parent folder.
optional string parent_folder = 7;
// A stable identifier for the attachment. Used for receiver to identify same
// attachment from different transfers.
optional int64 attachment_hash = 8;
// True, if image in file attachment is sensitive
optional bool is_sensitive_content = 9;
}
// NEXT_ID=5
// NEXT_ID=8
message TextMetadata {
enum Type {
UNKNOWN = 0;
@@ -73,15 +98,19 @@ message TextMetadata {
// A uuid for the attachment. Should be unique across all attachments.
optional int64 id = 6;
// True if text is sensitive, e.g. password
optional bool is_sensitive_text = 7;
}
// NEXT_ID=5
// NEXT_ID=6
message WifiCredentialsMetadata {
enum SecurityType {
UNKNOWN_SECURITY_TYPE = 0;
OPEN = 1;
WPA_PSK = 2;
WEP = 3;
SAE = 4;
}
// The Wifi network name. This will be sent in introduction.
@@ -98,6 +127,49 @@ message WifiCredentialsMetadata {
optional int64 id = 5;
}
// NEXT_ID=8
message AppMetadata {
// The app name. This will be sent in introduction.
optional string app_name = 1;
// The size of the all split of apks.
optional int64 size = 2;
// The File payload id that will be sent as a follow up containing the
// apk paths.
repeated int64 payload_id = 3 [packed = true];
// A uuid for the attachment. Should be unique across all attachments.
optional int64 id = 4;
// The name of apk file. This will be sent in introduction.
repeated string file_name = 5;
// The size of apk file. This will be sent in introduction.
repeated int64 file_size = 6 [packed = true];
// The package name. This will be sent in introduction.
optional string package_name = 7;
}
// NEXT_ID=5
message StreamMetadata {
// A human readable description for the stream.
optional string description = 1;
// The package name of the sending application.
optional string package_name = 2;
// The <TYPE> payload id that will be send as a followup containing the
// ParcelFileDescriptor.
optional int64 payload_id = 3;
// The human-readable name of the package that should be displayed as
// attribution if no other information is available (i.e. the package is not
// installed locally yet).
optional string attributed_app_name = 4;
}
// A frame used when sending messages over the wire.
// NEXT_ID=3
message Frame {
@@ -112,7 +184,7 @@ message Frame {
optional V1Frame v1 = 2;
}
// NEXT_ID=7
// NEXT_ID=8
message V1Frame {
enum FrameType {
UNKNOWN_FRAME_TYPE = 0;
@@ -120,34 +192,59 @@ message V1Frame {
RESPONSE = 2;
PAIRED_KEY_ENCRYPTION = 3;
PAIRED_KEY_RESULT = 4;
// No longer used.
CERTIFICATE_INFO = 5;
CANCEL = 6;
// No longer used.
PROGRESS_UPDATE = 7;
}
optional FrameType type = 1;
// Exactly one of the following fields will be set.
// At most one of the following fields will be set.
optional IntroductionFrame introduction = 2;
optional ConnectionResponseFrame connection_response = 3;
optional PairedKeyEncryptionFrame paired_key_encryption = 4;
optional PairedKeyResultFrame paired_key_result = 5;
optional CertificateInfoFrame certificate_info = 6;
optional CertificateInfoFrame certificate_info = 6 [deprecated = true];
optional ProgressUpdateFrame progress_update = 7 [deprecated = true];
}
// An introduction packet sent by the sending side. Contains a list of files
// they'd like to share.
// NEXT_ID=4
// NEXT_ID=10
message IntroductionFrame {
enum SharingUseCase {
UNKNOWN = 0;
NEARBY_SHARE = 1;
REMOTE_COPY = 2;
}
repeated FileMetadata file_metadata = 1;
repeated TextMetadata text_metadata = 2;
// The required app package to open the content. May be null.
optional string required_package = 3;
repeated WifiCredentialsMetadata wifi_credentials_metadata = 4;
repeated AppMetadata app_metadata = 5;
optional bool start_transfer = 6;
repeated StreamMetadata stream_metadata = 7;
optional SharingUseCase use_case = 8;
repeated int64 preview_payload_ids = 9;
}
// A progress update packet sent by the sending side. Contains transfer progress
// value. NEXT_ID=3
message ProgressUpdateFrame {
optional float progress = 1;
// True, if the receiver should start bandwidth upgrade and receiving the
// payloads.
optional bool start_transfer = 2;
}
// A response packet sent by the receiving side. Accepts or rejects the list of
// files.
// NEXT_ID=2
// NEXT_ID=4
message ConnectionResponseFrame {
enum Status {
UNKNOWN = 0;
@@ -160,10 +257,68 @@ message ConnectionResponseFrame {
// The receiving side's response.
optional Status status = 1;
// Key is attachment hash, value is the details of attachment.
map<int64, AttachmentDetails> attachment_details = 2;
// In the case of a stream attachments, the other side of the pipe.
// Both sender and receiver should validate matching counts.
repeated StreamMetadata stream_metadata = 3;
}
// Attachment details that sent in ConnectionResponseFrame.
// NEXT_ID=3
message AttachmentDetails {
// LINT.IfChange
enum Type {
UNKNOWN = 0;
// Represents FileAttachment.
FILE = 1;
// Represents TextAttachment.
TEXT = 2;
// Represents WifiCredentialsAttachment.
WIFI_CREDENTIALS = 3;
// Represents AppAttachment.
APP = 4;
// Represents StreamAttachment.
STREAM = 5;
}
// LINT.ThenChange(//depot/google3/java/com/google/android/gmscore/integ/client/nearby/src/com/google/android/gms/nearby/sharing/Attachment.java)
// The attachment family type.
optional Type type = 1;
// This field is only for FILE type.
optional FileAttachmentDetails file_attachment_details = 2;
}
// File attachment details included in ConnectionResponseFrame.
// NEXT_ID=3
message FileAttachmentDetails {
// Existing local file size on receiver side.
optional int64 receiver_existing_file_size = 1;
// The key is attachment hash, a stable identifier for the attachment.
// Value is list of payload details transferred for the attachment.
map<int64, PayloadsDetails> attachment_hash_payloads = 2;
}
// NEXT_ID=2
message PayloadsDetails {
// The list should be sorted by creation timestamp.
repeated PayloadDetails payload_details = 1;
}
// Metadata of a payload file created by Nearby Connections.
// NEXT_ID=4
message PayloadDetails {
optional int64 id = 1;
optional int64 creation_timestamp_millis = 2;
optional int64 size = 3;
}
// A paired key encryption packet sent between devices, contains signed data.
// NEXT_ID=3
// NEXT_ID=5
message PairedKeyEncryptionFrame {
// The encrypted data in byte array format.
optional bytes signed_data = 1;
@@ -173,10 +328,17 @@ message PairedKeyEncryptionFrame {
// An optional encrypted data in byte array format.
optional bytes optional_signed_data = 3;
// An optional QR code handshake data in a byte array format.
// For incoming connection contains a signature of the UKEY2
// token, created with the sender's private key.
// For outgoing connection contains an HKDF of the connection token and of the
// UKEY2 token
optional bytes qr_code_handshake_data = 4;
}
// A paired key verification result packet sent between devices.
// NEXT_ID=2
// NEXT_ID=3
message PairedKeyResultFrame {
enum Status {
UNKNOWN = 0;
@@ -187,6 +349,9 @@ message PairedKeyResultFrame {
// The verification result.
optional Status status = 1;
// OS type.
optional location.nearby.proto.sharing.OSType os_type = 2;
}
// A package containing certificate info to be shared to remote device offline.
@@ -229,8 +394,15 @@ message PublicCertificate {
// NEXT_ID=3
message WifiCredentials {
// Wi-Fi password.
optional string password = 1;
optional string password = 1
/* type = ST_ACCOUNT_CREDENTIAL */;
// True if the network is a hidden network that is not broadcasting its SSID.
// Default is false.
optional bool hidden_ssid = 2 [default = false];
}
}
// NEXT_ID=2
message StreamDetails {
// Serialized ParcelFileDescriptor for input stream (for the receiver).
optional bytes input_stream_parcel_file_descriptor_bytes = 1;
}