Versions in this module Expand all Collapse all v0 v0.19.4 May 24, 2023 Changes in this version + const BadDefaultSignature + const BadSignature + const KeyTypeDeploy + const KeyTypePrincipal + const KeyTypeUser + const NoKeyFound + var ErrKeyIsPrivate = util.NewSilentWrapErrorf(util.ErrInvalidArgument, "the provided key is a private key") + func AddPublicKeysBySource(usr *user_model.User, s *auth.Source, sshPublicKeys []string) bool + func AuthorizedStringForKey(key *PublicKey) string + func CalcFingerprint(publicKeyContent string) (string, error) + func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_model.TrustModelType, ...) (err error) + func CheckPrincipalKeyString(user *user_model.User, content string) (_ string, err error) + func CheckPublicKeyString(content string) (_ string, err error) + func CountDeployKeys(opts *ListDeployKeysOptions) (int64, error) + func CountPublicKeys(userID int64) (int64, error) + func CountUserGPGKeys(userID int64) (int64, error) + func DeleteGPGKey(doer *user_model.User, id int64) (err error) + func DeletePublicKeys(ctx context.Context, keyIDs ...int64) error + func GPGKeyToEntity(k *GPGKey) (*openpgp.Entity, error) + func HasDeployKey(keyID, repoID int64) bool + func IsDeployKeyExistByKeyID(ctx context.Context, keyID int64) (bool, error) + func IsErrDeployKeyAlreadyExist(err error) bool + func IsErrDeployKeyNameAlreadyUsed(err error) bool + func IsErrDeployKeyNotExist(err error) bool + func IsErrGPGInvalidTokenSignature(err error) bool + func IsErrGPGKeyAccessDenied(err error) bool + func IsErrGPGKeyIDAlreadyUsed(err error) bool + func IsErrGPGKeyImportNotExist(err error) bool + func IsErrGPGKeyNotExist(err error) bool + func IsErrGPGKeyParsing(err error) bool + func IsErrGPGNoEmailFound(err error) bool + func IsErrKeyAccessDenied(err error) bool + func IsErrKeyAlreadyExist(err error) bool + func IsErrKeyNameAlreadyUsed(err error) bool + func IsErrKeyNotExist(err error) bool + func IsErrKeyUnableVerify(err error) bool + func IsErrSSHInvalidTokenSignature(err error) bool + func PaddedKeyID(keyID string) string + func PublicKeyIsExternallyManaged(id int64) (bool, error) + func PublicKeysAreExternallyManaged(keys []*PublicKey) ([]bool, error) + func RegeneratePublicKeys(ctx context.Context, t io.StringWriter) error + func RewriteAllPrincipalKeys(ctx context.Context) error + func RewriteAllPublicKeys() error + func SSHKeyGenParsePublicKey(key string) (string, int, error) + func SSHNativeParsePublicKey(keyLine string) (string, int, error) + func SynchronizePublicKeys(usr *user_model.User, s *auth.Source, sshPublicKeys []string) bool + func UpdateDeployKeyCols(key *DeployKey, cols ...string) error + func UpdatePublicKeyUpdated(id int64) error + func VerificationToken(user *user_model.User, minutes int) string + func VerifyGPGKey(ownerID int64, keyID, token, signature string) (string, error) + func VerifySSHKey(ownerID int64, fingerprint, token, signature string) (string, error) + type CommitVerification struct + CommittingUser *user_model.User + Reason string + SigningEmail string + SigningKey *GPGKey + SigningSSHKey *PublicKey + SigningUser *user_model.User + TrustStatus string + Verified bool + Warning bool + func ParseCommitWithSSHSignature(c *git.Commit, committer *user_model.User) *CommitVerification + func ParseCommitWithSignature(ctx context.Context, c *git.Commit) *CommitVerification + type DeployKey struct + Content string + CreatedUnix timeutil.TimeStamp + Fingerprint string + HasRecentActivity bool + HasUsed bool + ID int64 + KeyID int64 + Mode perm.AccessMode + Name string + RepoID int64 + UpdatedUnix timeutil.TimeStamp + func AddDeployKey(repoID int64, name, content string, readOnly bool) (*DeployKey, error) + func GetDeployKeyByID(ctx context.Context, id int64) (*DeployKey, error) + func GetDeployKeyByRepo(ctx context.Context, keyID, repoID int64) (*DeployKey, error) + func ListDeployKeys(ctx context.Context, opts *ListDeployKeysOptions) ([]*DeployKey, error) + func (key *DeployKey) AfterLoad() + func (key *DeployKey) GetContent() error + func (key *DeployKey) IsReadOnly() bool + type ErrDeployKeyAlreadyExist struct + KeyID int64 + RepoID int64 + func (err ErrDeployKeyAlreadyExist) Error() string + func (err ErrDeployKeyAlreadyExist) Unwrap() error + type ErrDeployKeyNameAlreadyUsed struct + Name string + RepoID int64 + func (err ErrDeployKeyNameAlreadyUsed) Error() string + func (err ErrDeployKeyNameAlreadyUsed) Unwrap() error + type ErrDeployKeyNotExist struct + ID int64 + KeyID int64 + RepoID int64 + func (err ErrDeployKeyNotExist) Error() string + func (err ErrDeployKeyNotExist) Unwrap() error + type ErrGPGInvalidTokenSignature struct + ID string + Wrapped error + func (err ErrGPGInvalidTokenSignature) Error() string + type ErrGPGKeyAccessDenied struct + KeyID int64 + UserID int64 + func (err ErrGPGKeyAccessDenied) Error() string + func (err ErrGPGKeyAccessDenied) Unwrap() error + type ErrGPGKeyIDAlreadyUsed struct + KeyID string + func (err ErrGPGKeyIDAlreadyUsed) Error() string + func (err ErrGPGKeyIDAlreadyUsed) Unwrap() error + type ErrGPGKeyImportNotExist struct + ID string + func (err ErrGPGKeyImportNotExist) Error() string + func (err ErrGPGKeyImportNotExist) Unwrap() error + type ErrGPGKeyNotExist struct + ID int64 + func (err ErrGPGKeyNotExist) Error() string + func (err ErrGPGKeyNotExist) Unwrap() error + type ErrGPGKeyParsing struct + ParseError error + func (err ErrGPGKeyParsing) Error() string + type ErrGPGNoEmailFound struct + FailedEmails []string + ID string + func (err ErrGPGNoEmailFound) Error() string + type ErrKeyAccessDenied struct + KeyID int64 + Note string + UserID int64 + func (err ErrKeyAccessDenied) Error() string + func (err ErrKeyAccessDenied) Unwrap() error + type ErrKeyAlreadyExist struct + Content string + Fingerprint string + OwnerID int64 + func (err ErrKeyAlreadyExist) Error() string + func (err ErrKeyAlreadyExist) Unwrap() error + type ErrKeyNameAlreadyUsed struct + Name string + OwnerID int64 + func (err ErrKeyNameAlreadyUsed) Error() string + func (err ErrKeyNameAlreadyUsed) Unwrap() error + type ErrKeyNotExist struct + ID int64 + func (err ErrKeyNotExist) Error() string + func (err ErrKeyNotExist) Unwrap() error + type ErrKeyUnableVerify struct + Result string + func (err ErrKeyUnableVerify) Error() string + type ErrSSHInvalidTokenSignature struct + Fingerprint string + Wrapped error + func (err ErrSSHInvalidTokenSignature) Error() string + func (err ErrSSHInvalidTokenSignature) Unwrap() error + type GPGKey struct + AddedUnix timeutil.TimeStamp + CanCertify bool + CanEncryptComms bool + CanEncryptStorage bool + CanSign bool + Content string + CreatedUnix timeutil.TimeStamp + Emails []*user_model.EmailAddress + ExpiredUnix timeutil.TimeStamp + ID int64 + KeyID string + OwnerID int64 + PrimaryKeyID string + SubsKey []*GPGKey + Verified bool + func AddGPGKey(ownerID int64, content, token, signature string) ([]*GPGKey, error) + func GetGPGKeyByID(keyID int64) (*GPGKey, error) + func GetGPGKeysByKeyID(keyID string) ([]*GPGKey, error) + func ListGPGKeys(ctx context.Context, uid int64, listOptions db.ListOptions) ([]*GPGKey, error) + func (key *GPGKey) AfterLoad(session *xorm.Session) + func (key *GPGKey) BeforeInsert() + func (key *GPGKey) PaddedKeyID() string + type GPGKeyImport struct + Content string + KeyID string + func GetGPGImportByKeyID(keyID string) (*GPGKeyImport, error) + type KeyType int + type ListDeployKeysOptions struct + Fingerprint string + KeyID int64 + RepoID int64 + type PublicKey struct + Content string + CreatedUnix timeutil.TimeStamp + Fingerprint string + HasRecentActivity bool + HasUsed bool + ID int64 + LoginSourceID int64 + Mode perm.AccessMode + Name string + OwnerID int64 + Type KeyType + UpdatedUnix timeutil.TimeStamp + Verified bool + func AddPrincipalKey(ownerID int64, content string, authSourceID int64) (*PublicKey, error) + func AddPublicKey(ownerID int64, name, content string, authSourceID int64) (*PublicKey, error) + func GetPublicKeyByID(keyID int64) (*PublicKey, error) + func ListPrincipalKeys(uid int64, listOptions db.ListOptions) ([]*PublicKey, error) + func ListPublicKeys(uid int64, listOptions db.ListOptions) ([]*PublicKey, error) + func ListPublicKeysBySource(uid, authSourceID int64) ([]*PublicKey, error) + func SearchPublicKey(uid int64, fingerprint string) ([]*PublicKey, error) + func SearchPublicKeyByContent(ctx context.Context, content string) (*PublicKey, error) + func SearchPublicKeyByContentExact(ctx context.Context, content string) (*PublicKey, error) + func (key *PublicKey) AfterLoad() + func (key *PublicKey) AuthorizedString() string + func (key *PublicKey) OmitEmail() string + type SignCommit struct + Verification *CommitVerification + func ParseCommitsWithSignature(ctx context.Context, oldCommits []*user_model.UserCommit, ...) []*SignCommit