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
// Namespace: "stellar.1"
// Protocol: "bundle"
#![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::*;

use super::common::*;
use crate::protocol::keybase1;
// LINT: @lint("ignore")
pub type BundleRevision = u64;

pub struct EncryptedBundle {
  pub v: i32,
  pub e: Option<String>,
  pub n: keybase1::BoxNonce,
  pub gen: keybase1::PerUserKeyGeneration,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum BundleVersion {
  V1_1,
  V2_2,
  V3_3,
  V4_4,
  V5_5,
  V6_6,
  V7_7,
  V8_8,
  V9_9,
  V10_10,
}

pub enum BundleSecretVersioned {
  V1 {v1: BundleSecretUnsupported},
  V2 {v2: BundleSecretV2},
  V3 {v3: BundleSecretUnsupported},
  V4 {v4: BundleSecretUnsupported},
  V5 {v5: BundleSecretUnsupported},
  V6 {v6: BundleSecretUnsupported},
  V7 {v7: BundleSecretUnsupported},
  V8 {v8: BundleSecretUnsupported},
  V9 {v9: BundleSecretUnsupported},
  V10 {v10: BundleSecretUnsupported},
}

pub struct BundleVisibleV2 {
  pub revision: BundleRevision,
  pub prev: Option<String>,
  pub accounts: Option<Vec<BundleVisibleEntryV2>>,
}

pub struct BundleSecretV2 {
  pub visibleHash: Option<String>,
  pub accounts: Option<Vec<BundleSecretEntryV2>>,
}

pub struct BundleVisibleEntryV2 {
  pub accountID: AccountID,
  pub mode: AccountMode,
  pub isPrimary: bool,
  pub acctBundleRevision: BundleRevision,
  pub encAcctBundleHash: Option<String>,
}

pub struct BundleSecretEntryV2 {
  pub accountID: AccountID,
  pub name: Option<String>,
}

pub struct BundleSecretUnsupported {
}

pub struct EncryptedAccountBundle {
  pub v: i32,
  pub e: Option<String>,
  pub n: keybase1::BoxNonce,
  pub gen: keybase1::PerUserKeyGeneration,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum AccountBundleVersion {
  V1_1,
  V2_2,
  V3_3,
  V4_4,
  V5_5,
  V6_6,
  V7_7,
  V8_8,
  V9_9,
  V10_10,
}

pub enum AccountBundleSecretVersioned {
  V1 {v1: AccountBundleSecretV1},
  V2 {v2: AccountBundleSecretUnsupported},
  V3 {v3: AccountBundleSecretUnsupported},
  V4 {v4: AccountBundleSecretUnsupported},
  V5 {v5: AccountBundleSecretUnsupported},
  V6 {v6: AccountBundleSecretUnsupported},
  V7 {v7: AccountBundleSecretUnsupported},
  V8 {v8: AccountBundleSecretUnsupported},
  V9 {v9: AccountBundleSecretUnsupported},
  V10 {v10: AccountBundleSecretUnsupported},
}

pub struct AccountBundleSecretV1 {
  pub accountID: AccountID,
  pub signers: Option<Vec<SecretKey>>,
}

pub struct AccountBundleSecretUnsupported {
}

pub struct Bundle {
  pub revision: BundleRevision,
  pub prev: Option<String>,
  pub ownHash: Option<String>,
  pub accounts: Option<Vec<BundleEntry>>,
  pub accountBundles: std::collections::HashMap<AccountID, AccountBundle>,
}

pub struct BundleEntry {
  pub accountID: AccountID,
  pub mode: AccountMode,
  pub isPrimary: bool,
  pub name: Option<String>,
  pub acctBundleRevision: BundleRevision,
  pub encAcctBundleHash: Option<String>,
}

pub struct AccountBundle {
  pub prev: Option<String>,
  pub ownHash: Option<String>,
  pub accountID: AccountID,
  pub signers: Option<Vec<SecretKey>>,
}