forked from Silverfish/proton-bridge
fix: address review comments
This commit is contained in:
@ -31,7 +31,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() { // nolint[noinit]
|
func init() { // nolint[noinit]
|
||||||
Helpers = make(map[string]helper)
|
Helpers = make(map[string]helperConstructor)
|
||||||
|
|
||||||
// MacOS always provides a keychain.
|
// MacOS always provides a keychain.
|
||||||
Helpers[MacOSKeychain] = newMacOSHelper
|
Helpers[MacOSKeychain] = newMacOSHelper
|
||||||
|
|||||||
@ -31,7 +31,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() { // nolint[noinit]
|
func init() { // nolint[noinit]
|
||||||
Helpers = make(map[string]helper)
|
Helpers = make(map[string]helperConstructor)
|
||||||
|
|
||||||
if _, err := exec.LookPath("pass"); err == nil {
|
if _, err := exec.LookPath("pass"); err == nil {
|
||||||
Helpers[Pass] = newPassHelper
|
Helpers[Pass] = newPassHelper
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import (
|
|||||||
const WindowsCredentials = "windows-credentials"
|
const WindowsCredentials = "windows-credentials"
|
||||||
|
|
||||||
func init() { // nolint[noinit]
|
func init() { // nolint[noinit]
|
||||||
Helpers = make(map[string]helper)
|
Helpers = make(map[string]helperConstructor)
|
||||||
|
|
||||||
// Windows always provides a keychain.
|
// Windows always provides a keychain.
|
||||||
Helpers[WindowsCredentials] = newWinCredHelper
|
Helpers[WindowsCredentials] = newWinCredHelper
|
||||||
|
|||||||
@ -28,8 +28,8 @@ import (
|
|||||||
"github.com/docker/docker-credential-helpers/credentials"
|
"github.com/docker/docker-credential-helpers/credentials"
|
||||||
)
|
)
|
||||||
|
|
||||||
// helper constructs a keychain helper.
|
// helperConstructor constructs a keychain helperConstructor.
|
||||||
type helper func(string) (credentials.Helper, error)
|
type helperConstructor func(string) (credentials.Helper, error)
|
||||||
|
|
||||||
// Version is the keychain data version.
|
// Version is the keychain data version.
|
||||||
const Version = "k11"
|
const Version = "k11"
|
||||||
@ -39,7 +39,7 @@ var (
|
|||||||
ErrNoKeychain = errors.New("no keychain") // nolint[noglobals]
|
ErrNoKeychain = errors.New("no keychain") // nolint[noglobals]
|
||||||
|
|
||||||
// Helpers holds all discovered keychain helpers. It is populated in init().
|
// Helpers holds all discovered keychain helpers. It is populated in init().
|
||||||
Helpers map[string]helper // nolint[noglobals]
|
Helpers map[string]helperConstructor // nolint[noglobals]
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewKeychain creates a new native keychain.
|
// NewKeychain creates a new native keychain.
|
||||||
@ -109,6 +109,7 @@ func (kc *Keychain) Delete(userID string) (err error) {
|
|||||||
return kc.helper.Delete(kc.secretURL(userID))
|
return kc.helper.Delete(kc.secretURL(userID))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get returns the username and secret for the given userID.
|
||||||
func (kc *Keychain) Get(userID string) (string, string, error) {
|
func (kc *Keychain) Get(userID string) (string, string, error) {
|
||||||
kc.locker.Lock()
|
kc.locker.Lock()
|
||||||
defer kc.locker.Unlock()
|
defer kc.locker.Unlock()
|
||||||
|
|||||||
Reference in New Issue
Block a user