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

Function GetPublicKeyByID

internal/database/ssh_key.go:435–444  ·  view source on GitHub ↗

GetPublicKeyByID returns public key by given ID.

(keyID int64)

Source from the content-addressed store, hash-verified

433
434// GetPublicKeyByID returns public key by given ID.
435func GetPublicKeyByID(keyID int64) (*PublicKey, error) {
436 key := new(PublicKey)
437 has, err := x.Id(keyID).Get(key)
438 if err != nil {
439 return nil, err
440 } else if !has {
441 return nil, ErrKeyNotExist{keyID}
442 }
443 return key, nil
444}
445
446// SearchPublicKeyByContent searches a public key using the content as prefix
447// (i.e. ignore the email part). It returns ErrKeyNotExist if no such key

Callers 4

runServFunction · 0.92
GetPublicKeyFunction · 0.92
DeletePublicKeyFunction · 0.85
GetContentMethod · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected