MCPcopy Index your code
hub / github.com/git-bug/git-bug / List

Function List

bridge/core/auth/credential.go:147–177  ·  view source on GitHub ↗

List load all existing credentials

(repo repository.RepoKeyring, opts ...ListOption)

Source from the content-addressed store, hash-verified

145
146// List load all existing credentials
147func List(repo repository.RepoKeyring, opts ...ListOption) ([]Credential, error) {
148 keys, err := repo.Keyring().Keys()
149 if err != nil {
150 return nil, err
151 }
152
153 matcher := matcher(opts)
154
155 var credentials []Credential
156 for _, key := range keys {
157 if !strings.HasPrefix(key, keyringKeyPrefix) {
158 continue
159 }
160
161 item, err := repo.Keyring().Get(key)
162 if err != nil {
163 // skip unreadable items, nothing much we can do for them anyway
164 continue
165 }
166
167 cred, err := decode(item)
168 if err != nil {
169 return nil, err
170 }
171 if matcher.Match(cred) {
172 credentials = append(credentials, cred)
173 }
174 }
175
176 return credentials, nil
177}
178
179// IdExist return whether a credential id exist or not
180func IdExist(repo repository.RepoKeyring, id entity.Id) bool {

Callers 12

cacheAllClientMethod · 0.92
InitMethod · 0.92
promptTokenOptionsFunction · 0.92
cacheAllClientMethod · 0.92
InitMethod · 0.92
promptTokenOptionsFunction · 0.92
cacheAllClientMethod · 0.92
InitMethod · 0.92
promptCredOptionsFunction · 0.92
BridgeAuthFunction · 0.92
runBridgeAuthFunction · 0.92
TestCredentialFunction · 0.70

Calls 7

matcherFunction · 0.85
decodeFunction · 0.85
GetMethod · 0.80
KeysMethod · 0.65
KeyringMethod · 0.65
HasPrefixMethod · 0.45
MatchMethod · 0.45

Tested by 1

TestCredentialFunction · 0.56