Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

verification.go 902B

123456789101112131415161718192021222324252627
  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package repofiles
  5. import (
  6. "code.gitea.io/gitea/models"
  7. "code.gitea.io/gitea/modules/git"
  8. "code.gitea.io/gitea/modules/structs"
  9. )
  10. // GetPayloadCommitVerification returns the verification information of a commit
  11. func GetPayloadCommitVerification(commit *git.Commit) *structs.PayloadCommitVerification {
  12. verification := &structs.PayloadCommitVerification{}
  13. commitVerification := models.ParseCommitWithSignature(commit)
  14. if commit.Signature != nil {
  15. verification.Signature = commit.Signature.Signature
  16. verification.Payload = commit.Signature.Payload
  17. }
  18. if verification.Reason != "" {
  19. verification.Reason = commitVerification.Reason
  20. } else if verification.Verified {
  21. verification.Reason = "unsigned"
  22. }
  23. return verification
  24. }