1/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto3";
18
19package com.android.car.companiondevicesupport.protos;
20
21option java_package = "com.android.car.companiondevicesupport.protos";
22option java_outer_classname = "TrustedDeviceMessageProto";
23
24// A message specific to the trusted device feature.
25message TrustedDeviceMessage {
26  // The current version of this proto. Must be positive but declared as an
27  // int32 for interoperability reasons.
28  int32 version = 1;
29
30  // The different message types that indicate the content of the payload.
31  enum MessageType {
32    // The contents of the payload are unknown.
33    MESSAGE_TYPE_UNKNOWN = 0;
34
35    // This message is a request for the other device to start the enrollment
36    // process. The payload is empty for this type.
37    START_ENROLLMENT = 1;
38
39    // This message payload contains the escrow token.
40    ESCROW_TOKEN = 2;
41
42    // This message payload contains the unlock handle.
43    HANDLE = 3;
44
45    // The payload of this message contains all the necessary information to
46    // unlock the other device.
47    UNLOCK_CREDENTIALS = 4;
48
49    // An acknowledgment for a previous message. The payload will be empty
50    // for this type.
51    ACK = 5;
52
53    // An error has occurred on the sender of this message. The payload will be
54    // a message of TrustedDeviceError. Both sender and receiver should reset
55    // their states after this message.
56    ERROR = 6;
57  }
58
59  // The type of this message.
60  MessageType type = 2;
61
62  // The bytes that represent the content for this message.
63  bytes payload = 3;
64}
65
66// An error message. Should only be sent as `TrustedDeviceMessage.payload` when
67// `type` is `MessageType.ERROR`.
68message TrustedDeviceError {
69  enum ErrorType {
70    // The contents of the payload are unknown.
71    MESSAGE_TYPE_UNKNOWN = 0;
72
73    // This device does not meet the requirement of device security to start
74    // enrollment. Instead of escrow token, send this error.
75    DEVICE_NOT_SECURED = 1;
76  }
77
78  // The type of this error.
79  ErrorType type = 1;
80}
81