@namespace("keybase.1") protocol Common { // Time in milliseconds @typedef("long") record Time {} // Time in seconds @typedef("long") record UnixTime {} // Duration in seconds @typedef("double") record DurationSec {} // Duration in milliseconds @typedef("double") record DurationMsec {} record StringKVPair { string key; string value; } record Status { int code; string name; string desc; array fields; } @typedef("string") record UID {} @typedef("string") @lint("ignore") record VID {} @typedef("string") record DeviceID {} @typedef("string") record SigID {} @typedef("string") record LeaseID {} // Most appearances of KIDs in protocol are in hex.... @typedef("string") record KID {} // Phone number in E.164 format. @typedef("string") record PhoneNumber {} // Phone number, coming from the user, in no particular format. // Possibly invalid. Should be validated and converted to PhoneNumber // for internal use. @typedef("string") record RawPhoneNumber {} // Chain link IDs @typedef("string") record LinkID {} @typedef("bytes") record BinaryLinkID {} // But sometimes we need binary kids... @typedef("bytes") record BinaryKID {} @typedef("string") record TLFID {} @typedef("string") record TeamID {} @typedef("string") record UserOrTeamID {} @typedef("string") record GitRepoName {} @typedef("bytes") record HashMeta {} record UserVersion { UID uid; Seqno eldestSeqno; } enum TeamType { NONE_0, LEGACY_1, MODERN_2 } // CompatibilityTeamID can refer to either a legacy TLF ID or a new-style team ID. // Might eventually be useful but haven't found a need yet. variant CompatibilityTeamID switch (TeamType typ) { case LEGACY: TLFID; case MODERN: TeamID; } enum TLFVisibility { ANY_0, PUBLIC_1, PRIVATE_2 } record TeamIDWithVisibility { TeamID teamID; TLFVisibility visibility; } record TeamIDAndName { TeamID id; TeamName name; } @typedef("int64") @lint("ignore") record Seqno {} enum SeqType { NONE_0, PUBLIC_1, PRIVATE_2, SEMIPRIVATE_3, USER_PRIVATE_HIDDEN_16, TEAM_PRIVATE_HIDDEN_17 } fixed Bytes32(32); record Text { string data; boolean markup; } record PGPIdentity { string username; string comment; string email; } record PublicKey { @lint("ignore") KID KID; @lint("ignore") string PGPFingerprint; // empty for non-PGP keys @lint("ignore") array PGPIdentities; // same boolean isSibkey; boolean isEldest; string parentID; DeviceID deviceID; string deviceDescription; DeviceTypeV2 deviceType; Time cTime; Time eTime; boolean isRevoked; } record KeybaseTime { Time unix; Seqno chain; } record RevokedKey { PublicKey key; KeybaseTime time; KID by; } record User { UID uid; string username; } record Device { DeviceTypeV2 type; string name; DeviceID deviceID; // For the GUI to display the correct icon for the device int deviceNumberOfType; Time cTime; Time mTime; Time lastUsedTime; KID encryptKey; KID verifyKey; int status; } enum DeviceType { DESKTOP_0, MOBILE_1 } @typedef("string") record DeviceTypeV2{} record Stream { int fd; } enum LogLevel { NONE_0, DEBUG_1, INFO_2, NOTICE_3, WARN_4, ERROR_5, CRITICAL_6, FATAL_7 } @go("nostring") enum ClientType { NONE_0, CLI_1, GUI_MAIN_2, KBFS_3, GUI_HELPER_4 } record KBFSPathInfo { string standardPath; string deeplinkPath; string platformAfterMountPath; } record UserVersionVector { long id; int sigHints; long sigChain; Time cachedAt; } // PerUserKeyGeneration describes which generation of secret we're talking about. // The sequence starts at 1, and should increment every time the per-user-secret // rotates, which is every time a device is revoked. @typedef("int") @lint("ignore") record PerUserKeyGeneration {} @lint("ignore") record PerUserKey { int gen; Seqno seqno; KID sigKID; KID encKID; KID signedByKID; // The sibkey that delegated this PUK. } record UserPlusKeys { UID uid; string username; Seqno eldestSeqno; // =0 for an active user, and =216 for a deleted user StatusCode status; // deviceKeys is a list of active device keys. It does // not include PGP keys. array deviceKeys; // revokedDeviceKeys is a list of revoked device keys. array revokedDeviceKeys; // number of pgp keys associated with this user int pgpKeyCount; UserVersionVector uvv; // deletedDeviceKeys is a list of deleted device keys. // (i.e. keys that were used before an account reset) array deletedDeviceKeys; // perUserKeys is the vector of kid-pairs derived from // per-user secrets one for every generation. @lint("ignore") array perUserKeys; // All resets that follow user incarnations with device keys. array resets; } record UserOrTeamLite { UserOrTeamID id; string name; } enum UserOrTeamResult { USER_1, TEAM_2 } record RemoteTrack { string username; UID uid; LinkID linkID; } record UserPlusAllKeys { UserPlusKeys base; array pgpKeys; array remoteTracks; } @go("nostring") enum MerkleTreeID { MASTER_0, KBFS_PUBLIC_1, KBFS_PRIVATE_2, KBFS_PRIVATETEAM_3 } /** SocialAssertionService is a service that can be used to assert proofs for a user. */ @typedef("string") record SocialAssertionService {} /** SocialAssertion contains a service and username for that service, that together form an assertion about a user. It can either be a social assertion (like "facebook" or "twitter") or a server trust assertion (like "phone" or "email"). If the assertion is for social network, resolving an assertion requires that the user posts a Keybase proof on the asserted service as the asserted user. For server trust assertion, we have to trust the server. */ record SocialAssertion { string user; SocialAssertionService service; } @typedef("string") record FullName {} enum FullNamePackageVersion { V0_0, V1_1, V2_2 } record FullNamePackage { FullNamePackageVersion version; FullName fullName; Seqno eldestSeqno; StatusCode status; Time cachedAt; } record ImageCropRect { int x0; int y0; int x1; int y1; } record PhoneLookupResult { UID uid; string username; UnixTime ctime; } // Used for searching by phone number or email enum IdentityVisibility { PRIVATE_0, PUBLIC_1 } record SizedImage { string path; int width; } enum OfflineAvailability { NONE_0, BEST_EFFORT_1 } // Primarily used in chat but defined here to avoid a circular import @typedef("int") record ReacjiSkinTone {} record UserReacjis { // sorted array of frequently used reacjis array topReacjis; // user preference for default reacji skin tone ReacjiSkinTone skinTone; } }