-
Notifications
You must be signed in to change notification settings - Fork 5
/
flow_types.go
125 lines (113 loc) · 2.85 KB
/
flow_types.go
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
package statuskeycardgo
type FlowType int
type FlowParams map[string]interface{}
type FlowStatus map[string]interface{}
type runState int
type restartError struct{}
type giveupError struct{}
func restartErr() (e *restartError) {
return &restartError{}
}
func (e *restartError) Error() string {
return "restart"
}
func giveupErr() (e *giveupError) {
return &giveupError{}
}
func (e *giveupError) Error() string {
return "giveup"
}
const (
GetAppInfo FlowType = iota
RecoverAccount
LoadAccount
Login
ExportPublic
Sign
ChangePIN
ChangePUK
ChangePairing
UnpairThis
UnpairOthers
DeleteAccountAndUnpair
StoreMetadata
GetMetadata
)
const (
Idle runState = iota
Running
Paused
Resuming
Cancelling
)
const (
FlowResult = "keycard.flow-result"
InsertCard = "keycard.action.insert-card"
CardInserted = "keycard.action.card-inserted"
SwapCard = "keycard.action.swap-card"
EnterPairing = "keycard.action.enter-pairing"
EnterPIN = "keycard.action.enter-pin"
EnterPUK = "keycard.action.enter-puk"
EnterNewPair = "keycard.action.enter-new-pairing"
EnterNewPIN = "keycard.action.enter-new-pin"
EnterNewPUK = "keycard.action.enter-new-puk"
EnterTXHash = "keycard.action.enter-tx-hash"
EnterPath = "keycard.action.enter-bip44-path"
EnterMnemonic = "keycard.action.enter-mnemonic"
EnterName = "keycard.action.enter-cardname"
EnterWallets = "keycard.action.enter-wallets"
)
const (
AppInfo = "application-info"
InstanceUID = "instance-uid"
FactoryReset = "factory reset"
KeyUID = "key-uid"
FreeSlots = "free-pairing-slots"
PINRetries = "pin-retries"
PUKRetries = "puk-retries"
PairingPass = "pairing-pass"
Paired = "paired"
NewPairing = "new-pairing-pass"
DefPairing = "KeycardDefaultPairing"
PIN = "pin"
NewPIN = "new-pin"
PUK = "puk"
NewPUK = "new-puk"
MasterKey = "master-key"
MasterAddr = "master-key-address"
WalleRootKey = "wallet-root-key"
WalletKey = "wallet-key"
EIP1581Key = "eip1581-key"
WhisperKey = "whisper-key"
EncKey = "encryption-key"
ExportedKey = "exported-key"
Mnemonic = "mnemonic"
MnemonicLen = "mnemonic-length"
MnemonicIdxs = "mnemonic-indexes"
TXHash = "tx-hash"
BIP44Path = "bip44-path"
TXSignature = "tx-signature"
Overwrite = "overwrite"
ResolveAddr = "resolve-addresses"
ExportMaster = "export-master-address"
ExportPriv = "export-private"
CardMeta = "card-metadata"
CardName = "card-name"
WalletPaths = "wallet-paths"
)
const (
maxPINRetries = 3
maxPUKRetries = 5
maxFreeSlots = 5
defMnemoLen = 12
defPINLen = 6
defPUKLen = 12
)
const (
masterPath = "m"
walletRoothPath = "m/44'/60'/0'/0"
walletPath = walletRoothPath + "/0"
eip1581Path = "m/43'/60'/1581'"
whisperPath = eip1581Path + "/0'/0"
encryptionPath = eip1581Path + "/1'/0"
)