func checkStore(ks *store.KeyStore, cfg *config) error { if ks.Locked() { return errors.New("keystore is locked") } if !ks.Valid(false) { return errors.New("keystore is invalid") } if !ks.KeyAudit() { return errors.New("audit failed") } fmt.Println("Keystore is valid.") return nil }
func unlockStore(ks *store.KeyStore) bool { if !ks.Locked() { return true } passphrase, err := util.PassPrompt("keystore passphrase> ") if err != nil { util.Errorf("%v", err) return false } defer util.Zero(passphrase) if !ks.Locked() && ks.PrivateKey == nil { if !ks.LockWith(passphrase) { util.Errorf("Failed to set initial passphrase.") return false } } if !ks.Unlock(passphrase) { util.Errorf("Unlock failed (bad passphrase?)") return false } return true }