diff options
author | Antoine GIRARD <sapk@users.noreply.github.com> | 2017-03-22 11:43:54 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-03-22 18:43:54 +0800 |
commit | 14fe9010ae8aecc0bcd38059b4c71256524b5341 (patch) | |
tree | 6a4740387d288ea8cd433412d36624e30912d5ee /vendor/code.gitea.io/sdk | |
parent | 9224405155322e096e7f2d0f9eed35633b937951 (diff) | |
download | gitea-14fe9010ae8aecc0bcd38059b4c71256524b5341.tar.gz gitea-14fe9010ae8aecc0bcd38059b4c71256524b5341.zip |
GPG commit validation (#1150)
* GPG commit validation
* Add translation
+ some little fix
* Move hash calc after retrieving of potential key + missing translation
* Add some little test
Diffstat (limited to 'vendor/code.gitea.io/sdk')
-rw-r--r-- | vendor/code.gitea.io/sdk/gitea/hook.go | 21 | ||||
-rw-r--r-- | vendor/code.gitea.io/sdk/gitea/user_gpgkey.go | 6 |
2 files changed, 21 insertions, 6 deletions
diff --git a/vendor/code.gitea.io/sdk/gitea/hook.go b/vendor/code.gitea.io/sdk/gitea/hook.go index c2f88f4a31..4b45068127 100644 --- a/vendor/code.gitea.io/sdk/gitea/hook.go +++ b/vendor/code.gitea.io/sdk/gitea/hook.go @@ -137,12 +137,21 @@ type PayloadUser struct { // PayloadCommit FIXME: consider use same format as API when commits API are added. type PayloadCommit struct { - ID string `json:"id"` - Message string `json:"message"` - URL string `json:"url"` - Author *PayloadUser `json:"author"` - Committer *PayloadUser `json:"committer"` - Timestamp time.Time `json:"timestamp"` + ID string `json:"id"` + Message string `json:"message"` + URL string `json:"url"` + Author *PayloadUser `json:"author"` + Committer *PayloadUser `json:"committer"` + Verification *PayloadCommitVerification `json:"verification"` + Timestamp time.Time `json:"timestamp"` +} + +// PayloadCommitVerification represent the GPG verification part of a commit. FIXME: like PayloadCommit consider use same format as API when commits API are added. +type PayloadCommitVerification struct { + Verified bool `json:"verified"` + Reason string `json:"reason"` + Signature string `json:"signature"` + Payload string `json:"payload"` } var ( diff --git a/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go b/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go index 911e63f1a3..c8afe92c92 100644 --- a/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go +++ b/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go @@ -38,6 +38,12 @@ type CreateGPGKeyOption struct { ArmoredKey string `json:"armored_public_key" binding:"Required"` } +// ListGPGKeys list all the GPG keys of the user +func (c *Client) ListGPGKeys(user string) ([]*GPGKey, error) { + keys := make([]*GPGKey, 0, 10) + return keys, c.getParsedResponse("GET", fmt.Sprintf("/users/%s/gpg_keys", user), nil, nil, &keys) +} + // ListMyGPGKeys list all the GPG keys of current user func (c *Client) ListMyGPGKeys() ([]*GPGKey, error) { keys := make([]*GPGKey, 0, 10) |