gitea源码

user_gpgkey.go 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright 2017 Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package structs
  4. import (
  5. "time"
  6. )
  7. // GPGKey a user GPG key to sign commit and tag in repository
  8. type GPGKey struct {
  9. // The unique identifier of the GPG key
  10. ID int64 `json:"id"`
  11. // The primary key ID of the GPG key
  12. PrimaryKeyID string `json:"primary_key_id"`
  13. // The key ID of the GPG key
  14. KeyID string `json:"key_id"`
  15. // The public key content in armored format
  16. PublicKey string `json:"public_key"`
  17. // List of email addresses associated with this GPG key
  18. Emails []*GPGKeyEmail `json:"emails"`
  19. // List of subkeys of this GPG key
  20. SubsKey []*GPGKey `json:"subkeys"`
  21. // Whether the key can be used for signing
  22. CanSign bool `json:"can_sign"`
  23. // Whether the key can be used for encrypting communications
  24. CanEncryptComms bool `json:"can_encrypt_comms"`
  25. // Whether the key can be used for encrypting storage
  26. CanEncryptStorage bool `json:"can_encrypt_storage"`
  27. // Whether the key can be used for certification
  28. CanCertify bool `json:"can_certify"`
  29. // Whether the GPG key has been verified
  30. Verified bool `json:"verified"`
  31. // swagger:strfmt date-time
  32. // The date and time when the GPG key was created
  33. Created time.Time `json:"created_at"`
  34. // swagger:strfmt date-time
  35. // The date and time when the GPG key expires
  36. Expires time.Time `json:"expires_at"`
  37. }
  38. // GPGKeyEmail an email attached to a GPGKey
  39. // swagger:model GPGKeyEmail
  40. type GPGKeyEmail struct {
  41. // The email address associated with the GPG key
  42. Email string `json:"email"`
  43. // Whether the email address has been verified
  44. Verified bool `json:"verified"`
  45. }
  46. // CreateGPGKeyOption options create user GPG key
  47. type CreateGPGKeyOption struct {
  48. // An armored GPG key to add
  49. //
  50. // required: true
  51. // unique: true
  52. ArmoredKey string `json:"armored_public_key" binding:"Required"`
  53. // An optional armored signature for the GPG key
  54. Signature string `json:"armored_signature,omitempty"`
  55. }
  56. // VerifyGPGKeyOption options verifies user GPG key
  57. type VerifyGPGKeyOption struct {
  58. // An Signature for a GPG key token
  59. //
  60. // required: true
  61. // The key ID of the GPG key to verify
  62. KeyID string `json:"key_id" binding:"Required"`
  63. // The armored signature to verify the GPG key
  64. Signature string `json:"armored_signature" binding:"Required"`
  65. }