add flow types

This commit is contained in:
Michele Balistreri 2021-10-22 11:36:25 +03:00
parent ca3fbcdfeb
commit 95647e9ee8
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
2 changed files with 32 additions and 4 deletions

24
flow.go
View File

@ -217,12 +217,18 @@ func (f *KeycardFlow) connectedFlow() (FlowStatus, error) {
return f.exportKeysFlow(kc, true)
case Login:
return f.exportKeysFlow(kc, false)
case ExportPublic:
return f.exportPublic(kc)
case LoadAccount:
return f.loadKeysFlow(kc)
case Sign:
return f.signFlow(kc)
case ChangeCredentials:
return f.changeCredentialsFlow(kc)
case ChangePIN:
return f.changePINFlow(kc)
case ChangePUK:
return f.changePUKFlow(kc)
case ChangePairing:
return f.changePairingFlow(kc)
case UnpairThis:
return f.unpairThisFlow(kc)
case UnpairOthers:
@ -307,6 +313,10 @@ func (f *KeycardFlow) exportKeysFlow(kc *keycardContext, recover bool) (FlowStat
return result, nil
}
func (f *KeycardFlow) exportPublic(kc *keycardContext) (FlowStatus, error) {
return nil, errors.New("not implemented yet")
}
func (f *KeycardFlow) loadKeysFlow(kc *keycardContext) (FlowStatus, error) {
return nil, errors.New("not implemented yet")
}
@ -315,7 +325,15 @@ func (f *KeycardFlow) signFlow(kc *keycardContext) (FlowStatus, error) {
return nil, errors.New("not implemented yet")
}
func (f *KeycardFlow) changeCredentialsFlow(kc *keycardContext) (FlowStatus, error) {
func (f *KeycardFlow) changePINFlow(kc *keycardContext) (FlowStatus, error) {
return nil, errors.New("not implemented yet")
}
func (f *KeycardFlow) changePUKFlow(kc *keycardContext) (FlowStatus, error) {
return nil, errors.New("not implemented yet")
}
func (f *KeycardFlow) changePairingFlow(kc *keycardContext) (FlowStatus, error) {
return nil, errors.New("not implemented yet")
}

View File

@ -29,8 +29,11 @@ const (
RecoverAccount
LoadAccount
Login
ExportPublic
Sign
ChangeCredentials
ChangePIN
ChangePUK
ChangePairing
UnpairThis
UnpairOthers
DeleteAccountAndUnpair
@ -55,6 +58,8 @@ const (
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"
)
const (
@ -68,6 +73,8 @@ const (
ErrorRequireInit = "require-init"
ErrorPairing = "pairing"
ErrorUnblocking = "unblocking"
ErrorSigning = "signing"
ErrorExporting = "exporting"
)
const (
@ -92,6 +99,9 @@ const (
WhisperKey = "whisper-key"
EncKey = "encryption-key"
Mnemonic = "mnemonic"
TXHash = "tx-hash"
BIP44Path = "bip44-path"
TXSignature = "tx-signature"
)
const (