MCPcopy Create free account
hub / github.com/gogs/gogs / GetPublicKey

Function GetPublicKey

internal/route/api/v1/user/key.go:62–71  ·  view source on GitHub ↗
(c *context.APIContext)

Source from the content-addressed store, hash-verified

60}
61
62func GetPublicKey(c *context.APIContext) {
63 key, err := database.GetPublicKeyByID(c.ParamsInt64(":id"))
64 if err != nil {
65 c.NotFoundOrError(err, "get public key by ID")
66 return
67 }
68
69 apiLink := composePublicKeysAPILink()
70 c.JSONSuccess(convert.ToPublicKey(apiLink, key))
71}
72
73// CreateUserPublicKey creates new public key to given user by ID.
74func CreateUserPublicKey(c *context.APIContext, form api.CreateKeyOption, uid int64) {

Callers

nothing calls this directly

Calls 5

GetPublicKeyByIDFunction · 0.92
ToPublicKeyFunction · 0.92
composePublicKeysAPILinkFunction · 0.85
JSONSuccessMethod · 0.80
NotFoundOrErrorMethod · 0.45

Tested by

no test coverage detected