Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keys migrate command #5097

Merged
merged 16 commits into from
Sep 30, 2019
Prev Previous commit
Next Next commit
remove test boolean flag from NewKeybaseKeyring
  • Loading branch information
Alessio Treglia committed Sep 24, 2019
commit dcf9754a4b377023e6d6bf3e8a846e9ea8f59d29
2 changes: 1 addition & 1 deletion client/keys/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func runMigrateCmd(cmd *cobra.Command, args []string) error {
if viper.GetBool(flags.FlagDryRun) {
keyring = keys.NewTestKeybaseKeyring(types.GetConfig().GetKeyringServiceName(), rootDir)
} else {
keyring = keys.NewKeybaseKeyring(types.GetConfig().GetKeyringServiceName(), rootDir, buf, false)
keyring = keys.NewKeybaseKeyring(types.GetConfig().GetKeyringServiceName(), rootDir, buf)
}

for _, key := range oldKeys {
Expand Down
7 changes: 4 additions & 3 deletions crypto/keys/lazy_keybase_keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@ type lazyKeybaseKeyring struct {

// NewKeybaseKeyring creates a new instance of a lazy keybase using a Keyring as
// the persistence layer.
func NewKeybaseKeyring(name string, dir string, userInput io.Reader, test bool) Keybase {
func NewKeybaseKeyring(name string, dir string, userInput io.Reader) Keybase {
_, err := keyring.Open(keyring.Config{
ServiceName: name,
})
if err != nil {
panic(err)
}

return lazyKeybaseKeyring{name: name, dir: dir, userInput: userInput, test: test}
return lazyKeybaseKeyring{name: name, dir: dir, userInput: userInput, test: false}
}

// New creates a new instance of a lazy keybase.
// NewTestKeybaseKeyring creates a new instance of a keyring keybase
// for testing purposes that does not prompt users for password.
func NewTestKeybaseKeyring(name string, dir string) Keybase {
if _, err := keyring.Open(keyring.Config{
AllowedBackends: []keyring.BackendType{"file"},
Expand Down