Skip to content

Commit 98d4f8b

Browse files
authored
Document vault_profile partially (#733)
1 parent 93a064c commit 98d4f8b

File tree

2 files changed

+110
-2
lines changed

2 files changed

+110
-2
lines changed

docs/api-basics/users.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ Get the current user's information.
2323
## GET `/api/1/users/vault_profile`
2424

2525
{% hint style='info' %}
26-
This endpoint is a mystery, it returns what appears to be base64 encoded strings. When decoded it has a bunch of jibberish and then two certificates and some readable strings, and what appears to be a hash of something.
26+
This endpoint is a mystery and it's current purpose is unknown, but we know how to decode it. First of all take the `base64_data` and decode it. Finally, deserialize the message using the `Vault` message from protobuf located at https://github.com/timdorr/tesla-api/blob/master/vault.proto
2727
{% endhint %}
2828

2929
### Response
3030

3131
```json
3232
{
33-
"vault": "base64_jibberish"
33+
"vault": "base64_data"
3434
}
3535
```
3636

vault.proto

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
syntax = "proto3";
2+
3+
/* unused */
4+
enum ActiveVaultReason {
5+
ACTIVE_VAULT_REASON_UNKNOWN = 0;
6+
ACTIVE_VAULT_REASON_OWNER = 1;
7+
ACTIVE_VAULT_REASON_NETWORK = 2;
8+
ACTIVE_VAULT_REASON_WALKUP = 3;
9+
ACTIVE_VAULT_REASON_OPEN = 4;
10+
}
11+
12+
message EncryptedData {
13+
bytes data = 1;
14+
bytes iv = 2;
15+
bytes tag = 3;
16+
}
17+
18+
message Item {
19+
int64 modifiedAt = 1;
20+
bytes label = 2;
21+
EncryptedData data = 3;
22+
RemoteData remoteData = 4;
23+
bytes referenceId = 5;
24+
bool labelIsPlaintext = 6;
25+
}
26+
message OpenVault {
27+
string uuid = 1;
28+
}
29+
30+
message OptIn {
31+
VaultInfo vaultInfo = 1;
32+
string pin = 4;
33+
bytes pubkey = 5;
34+
}
35+
36+
/* unused */
37+
message OptIns {
38+
repeated OptIn optIns = 1;
39+
}
40+
41+
message RemoteClientKey {
42+
repeated VaultKey pubkeys = 1;
43+
}
44+
45+
/* used in carserver... perhaps that's how we manipulate things? */
46+
message RemoteCommand {
47+
oneof sub_message {
48+
OptIn optIn = 1;
49+
OpenVault openVault = 2;
50+
}
51+
}
52+
53+
message RemoteData {
54+
string url = 1;
55+
bytes etag = 2;
56+
bytes sha = 3;
57+
}
58+
59+
message UnencryptedItem {
60+
int64 modifiedAt = 1;
61+
bytes data = 2;
62+
}
63+
64+
/* probably what we receive on /vault_profile */
65+
message Vault {
66+
string uuid = 1;
67+
repeated VaultClass classes = 2;
68+
VaultInfo vaultInfo = 3;
69+
RemoteClientKey remoteClientKey = 4;
70+
bytes pubkeysReferenceId = 5;
71+
}
72+
73+
message VaultClass {
74+
string name = 1;
75+
EncryptedData labelKey = 2;
76+
EncryptedData dataKey = 3;
77+
repeated Item items = 4;
78+
repeated WrappedClassKey wrappedClassKeys = 5;
79+
}
80+
81+
message VaultInfo {
82+
string uuid = 1;
83+
string publicUsername = 2;
84+
UnencryptedItem publicProfilePicture = 3;
85+
string publicGamername = 4;
86+
}
87+
88+
/* unused */
89+
message VaultInfos {
90+
repeated VaultInfo vaultInfos = 1;
91+
}
92+
93+
message VaultKey {
94+
vaultKeyType vaultKeyType = 1;
95+
string pubkey = 2;
96+
}
97+
98+
message WrappedClassKey {
99+
string name = 1;
100+
bytes key = 2;
101+
string pubkeyId = 3;
102+
}
103+
104+
enum vaultKeyType {
105+
VEHICLE_CERT = 0;
106+
MOBILE_ID = 1;
107+
MOBILE_BACKUP_PUBKEY = 2;
108+
}

0 commit comments

Comments
 (0)