1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
// Namespace: "keybase.1"
// Protocol: "Common"
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Serialize, Deserialize};
use serde_repr::{Deserialize_repr, Serialize_repr};use super::*;

pub type Time = i64;

pub type UnixTime = i64;

pub type DurationSec = f64;

#[derive(Serialize, Deserialize, Debug)]
pub struct StringKVPair {
  #[serde(default)]
  pub key: Option<String>,
  #[serde(default)]
  pub value: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Status {
  pub code: Option<i32>,
  #[serde(default)]
  pub name: Option<String>,
  #[serde(default)]
  pub desc: Option<String>,
  #[serde(default)]
  pub fields: Option<Vec<StringKVPair>>,
}

pub type UID = String;

pub type DeviceID = String;

pub type SigID = String;

pub type LeaseID = String;

pub type KID = String;

pub type PhoneNumber = String;

pub type RawPhoneNumber = String;

pub type RegionCode = String;

pub type LinkID = String;

pub type BinaryLinkID = String;

pub type BinaryKID = String;

pub type TLFID = String;

pub type TeamID = String;

pub type UserOrTeamID = String;

pub type GitRepoName = String;

pub type HashMeta = String;

#[derive(Serialize, Deserialize, Debug, Hash, PartialEq, Eq)]
pub struct UserVersion {
  pub uid: Option<UID>,
  pub eldestSeqno: Option<Seqno>,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum TeamType {
  None_0,
  Legacy_1,
  Modern_2,
}

#[derive(Serialize, Deserialize, Debug)]
#[serde(untagged)]
pub enum CompatibilityTeamID {
  Legacy {legacy: TLFID},
  Modern {modern: TeamID},
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum TLFVisibility {
  Any_0,
  Public_1,
  Private_2,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TeamIDWithVisibility {
  pub teamID: Option<TeamID>,
  pub visibility: Option<TLFVisibility>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct TeamIDAndName {
  pub id: Option<TeamID>,
  pub name: Option<TeamName>,
}

// LINT: @lint("ignore")
pub type Seqno = i64;

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum SeqType {
  None_0,
  Public_1,
  Private_2,
  Semiprivate_3,
  User_private_hidden_16,
  Team_private_hidden_17,
}

pub type Bytes32 = Vec<u8>;

#[derive(Serialize, Deserialize, Debug)]
pub struct Text {
  #[serde(default)]
  pub data: Option<String>,
  #[serde(default)]
  pub markup: Option<bool>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct PGPIdentity {
  #[serde(default)]
  pub username: Option<String>,
  #[serde(default)]
  pub comment: Option<String>,
  #[serde(default)]
  pub email: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct PublicKey {
  // @lint("ignore")
  pub KID: Option<KID>,
  // @lint("ignore")
  #[serde(default)]
  pub PGPFingerprint: Option<String>,
  // @lint("ignore")
  #[serde(default)]
  pub PGPIdentities: Option<Vec<PGPIdentity>>,
  #[serde(default)]
  pub isSibkey: Option<bool>,
  #[serde(default)]
  pub isEldest: Option<bool>,
  #[serde(default)]
  pub parentID: Option<String>,
  pub deviceID: Option<DeviceID>,
  #[serde(default)]
  pub deviceDescription: Option<String>,
  #[serde(default)]
  pub deviceType: Option<String>,
  pub cTime: Option<Time>,
  pub eTime: Option<Time>,
  #[serde(default)]
  pub isRevoked: Option<bool>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct KeybaseTime {
  pub unix: Option<Time>,
  pub chain: Option<Seqno>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct RevokedKey {
  pub key: Option<PublicKey>,
  pub time: Option<KeybaseTime>,
  pub by: Option<KID>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct User {
  pub uid: Option<UID>,
  #[serde(default)]
  pub username: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Device {
  #[serde(rename = "type")]
  #[serde(default)]
  pub ty: Option<String>,
  #[serde(default)]
  pub name: Option<String>,
  pub deviceID: Option<DeviceID>,
  pub cTime: Option<Time>,
  pub mTime: Option<Time>,
  pub lastUsedTime: Option<Time>,
  pub encryptKey: Option<KID>,
  pub verifyKey: Option<KID>,
  pub status: Option<i32>,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum DeviceType {
  Desktop_0,
  Mobile_1,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Stream {
  pub fd: Option<i32>,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum LogLevel {
  None_0,
  Debug_1,
  Info_2,
  Notice_3,
  Warn_4,
  Error_5,
  Critical_6,
  Fatal_7,
}

// @go("nostring")
#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum ClientType {
  None_0,
  Cli_1,
  Gui_main_2,
  Kbfs_3,
  Gui_helper_4,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UserVersionVector {
  pub id: Option<i64>,
  pub sigHints: Option<i32>,
  pub sigChain: Option<i64>,
  pub cachedAt: Option<Time>,
}

// LINT: @lint("ignore")
pub type PerUserKeyGeneration = i32;

// @lint("ignore")
#[derive(Serialize, Deserialize, Debug)]
pub struct PerUserKey {
  pub gen: Option<i32>,
  pub seqno: Option<Seqno>,
  pub sigKID: Option<KID>,
  pub encKID: Option<KID>,
  pub signedByKID: Option<KID>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UserPlusKeys {
  pub uid: Option<UID>,
  #[serde(default)]
  pub username: Option<String>,
  pub eldestSeqno: Option<Seqno>,
  pub status: Option<StatusCode>,
  #[serde(default)]
  pub deviceKeys: Option<Vec<PublicKey>>,
  #[serde(default)]
  pub revokedDeviceKeys: Option<Vec<RevokedKey>>,
  pub pgpKeyCount: Option<i32>,
  #[serde(default)]
  pub uvv: Option<UserVersionVector>,
  #[serde(default)]
  pub deletedDeviceKeys: Option<Vec<PublicKey>>,
  // @lint("ignore")
  #[serde(default)]
  pub perUserKeys: Option<Vec<PerUserKey>>,
  #[serde(default)]
  pub resets: Option<Vec<ResetSummary>>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UserOrTeamLite {
  pub id: Option<UserOrTeamID>,
  #[serde(default)]
  pub name: Option<String>,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum UserOrTeamResult {
  User_1,
  Team_2,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct RemoteTrack {
  #[serde(default)]
  pub username: Option<String>,
  pub uid: Option<UID>,
  pub linkID: Option<LinkID>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UserPlusAllKeys {
  pub base: Option<UserPlusKeys>,
  #[serde(default)]
  pub pgpKeys: Option<Vec<PublicKey>>,
  #[serde(default)]
  pub remoteTracks: Option<Vec<RemoteTrack>>,
}

// @go("nostring")
#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum MerkleTreeID {
  Master_0,
  Kbfs_public_1,
  Kbfs_private_2,
  Kbfs_privateteam_3,
}

pub type SocialAssertionService = String;

#[derive(Serialize, Deserialize, Debug)]
pub struct SocialAssertion {
  #[serde(default)]
  pub user: Option<String>,
  pub service: Option<SocialAssertionService>,
}

pub type FullName = String;

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum FullNamePackageVersion {
  V0_0,
  V1_1,
  V2_2,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct FullNamePackage {
  pub version: Option<FullNamePackageVersion>,
  pub fullName: Option<FullName>,
  pub eldestSeqno: Option<Seqno>,
  pub status: Option<StatusCode>,
  pub cachedAt: Option<Time>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct ImageCropRect {
  pub x0: Option<i32>,
  pub y0: Option<i32>,
  pub x1: Option<i32>,
  pub y1: Option<i32>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct PhoneLookupResult {
  pub uid: Option<UID>,
  #[serde(default)]
  pub username: Option<String>,
  pub ctime: Option<UnixTime>,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum IdentityVisibility {
  Private_0,
  Public_1,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct SizedImage {
  #[serde(default)]
  pub path: Option<String>,
  pub width: Option<i32>,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum OfflineAvailability {
  None_0,
  Best_effort_1,
}

pub type ReacjiSkinTone = i32;

#[derive(Serialize, Deserialize, Debug)]
pub struct UserReacjis {
  #[serde(default)]
  pub topReacjis: Option<Vec<String>>,
  pub skinTone: Option<ReacjiSkinTone>,
}