MCPcopy Create free account
hub / github.com/cli/cli / UserKeys

Function UserKeys

pkg/cmd/ssh-key/shared/user_keys.go:27–51  ·  view source on GitHub ↗
(httpClient *http.Client, host, userHandle string)

Source from the content-addressed store, hash-verified

25}
26
27func UserKeys(httpClient *http.Client, host, userHandle string) ([]sshKey, error) {
28 u, err := safeurl.JoinPathWithHostPrefix(ghinstance.RESTPrefix(host), "user", "keys")
29 if err != nil {
30 return nil, err
31 }
32 if userHandle != "" {
33 u, err = safeurl.JoinPathWithHostPrefix(ghinstance.RESTPrefix(host), "users", userHandle, "keys")
34 if err != nil {
35 return nil, err
36 }
37 }
38 u.SetQuery("per_page", "100")
39
40 keys, err := getUserKeys(httpClient, u)
41
42 if err != nil {
43 return nil, err
44 }
45
46 for i := 0; i < len(keys); i++ {
47 keys[i].Type = AuthenticationKey
48 }
49
50 return keys, nil
51}
52
53func UserSigningKeys(httpClient *http.Client, host, userHandle string) ([]sshKey, error) {
54 u, err := safeurl.JoinPathWithHostPrefix(ghinstance.RESTPrefix(host), "user", "ssh_signing_keys")

Callers 2

listRunFunction · 0.92
SSHKeyUploadFunction · 0.92

Calls 4

JoinPathWithHostPrefixFunction · 0.92
RESTPrefixFunction · 0.92
getUserKeysFunction · 0.85
SetQueryMethod · 0.80

Tested by

no test coverage detected