MCPcopy
hub / github.com/cli/cli / Get

Function Get

internal/keyring/keyring.go:37–59  ·  view source on GitHub ↗

Get secret from keyring given service and user name.

(service, user string)

Source from the content-addressed store, hash-verified

35
36// Get secret from keyring given service and user name.
37func Get(service, user string) (string, error) {
38 ch := make(chan struct {
39 val string
40 err error
41 }, 1)
42 go func() {
43 defer close(ch)
44 val, err := keyring.Get(service, user)
45 ch <- struct {
46 val string
47 err error
48 }{val, err}
49 }()
50 select {
51 case res := <-ch:
52 if errors.Is(res.err, keyring.ErrNotFound) {
53 return "", ErrNotFound
54 }
55 return res.val, res.err
56 case <-time.After(3 * time.Second):
57 return "", &TimeoutError{"timeout while trying to get secret from keyring"}
58 }
59}
60
61// Delete secret from keyring.
62func Delete(service, user string) error {

Calls 1

GetMethod · 0.65