Skip to content

Commit

Permalink
apply options on newly added keyring types (cosmos#5404)
Browse files Browse the repository at this point in the history
  • Loading branch information
austinabell authored and xiangjianmeng committed Dec 18, 2019
1 parent aa9b163 commit 9caa298
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions client/keys/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ func NewKeyringFromDir(rootDir string, input io.Reader, opts ...keys.KeybaseOpti
keyringBackend := viper.GetString(flags.FlagKeyringBackend)
switch keyringBackend {
case flags.KeyringBackendTest:
return keys.NewTestKeyring(sdk.GetConfig().GetKeyringServiceName(), rootDir)
return keys.NewTestKeyring(sdk.GetConfig().GetKeyringServiceName(), rootDir, opts...)
case flags.KeyringBackendFile:
return keys.NewKeyringFile(sdk.GetConfig().GetKeyringServiceName(), rootDir, input)
return keys.NewKeyringFile(sdk.GetConfig().GetKeyringServiceName(), rootDir, input, opts...)
case flags.KeyringBackendOS:
return keys.NewKeyring(sdk.GetConfig().GetKeyringServiceName(), rootDir, input)
return keys.NewKeyring(sdk.GetConfig().GetKeyringServiceName(), rootDir, input, opts...)
}
return nil, fmt.Errorf("unknown keyring backend %q", keyringBackend)
}
Expand Down
4 changes: 2 additions & 2 deletions crypto/keys/keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ func NewKeyring(
}

// NewKeyringFile creates a new instance of an encrypted file-backed keyring.
func NewKeyringFile(name string, dir string, userInput io.Reader) (Keybase, error) {
func NewKeyringFile(name string, dir string, userInput io.Reader, opts ...KeybaseOption) (Keybase, error) {
db, err := keyring.Open(newFileBackendKeyringConfig(name, dir, userInput))
if err != nil {
return nil, err
}

return newKeyringKeybase(db), nil
return newKeyringKeybase(db, opts...), nil
}

// NewTestKeyring creates a new instance of an on-disk keyring for
Expand Down

0 comments on commit 9caa298

Please sign in to comment.