mirror of
https://github.com/status-im/keycard-go.git
synced 2025-01-21 01:09:16 +00:00
add more error messages for init command
This commit is contained in:
parent
b813e1743f
commit
8be3d6ebcb
@ -162,6 +162,7 @@ func commandInstall(i *actionsets.Installer) error {
|
|||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
|
fmt.Printf("installation can take a while...\n")
|
||||||
err = i.Install(f, *flagOverwrite)
|
err = i.Install(f, *flagOverwrite)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fail("installation error", "error", err)
|
fail("installation error", "error", err)
|
||||||
|
@ -70,12 +70,20 @@ func (i *Installer) Init() (*lightwallet.Secrets, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
cardPubKey, err := actions.SelectNotInitialized(i.c, walletAID)
|
info, err := actions.Select(i.c, walletAID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = actions.Init(i.c, cardPubKey, secrets, walletAID)
|
if !info.Installed {
|
||||||
|
return nil, fmt.Errorf("applet not installed")
|
||||||
|
}
|
||||||
|
|
||||||
|
if info.Initialized {
|
||||||
|
return nil, fmt.Errorf("card already initialized")
|
||||||
|
}
|
||||||
|
|
||||||
|
err = actions.Init(i.c, info.PublicKey, secrets, walletAID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user