Class: GpgKey
Constant Summary
collapse
- KEY_PREFIX =
'-----BEGIN PGP PUBLIC KEY BLOCK-----'
- KEY_SUFFIX =
'-----END PGP PUBLIC KEY BLOCK-----'
Cells::Claimable::CLAIMS_BUCKET_TYPE, Cells::Claimable::CLAIMS_SOURCE_TYPE, Cells::Claimable::CLAIMS_SUBJECT_TYPE, Cells::Claimable::MissingPrimaryKeyError
ApplicationRecord::MAX_PLUCK
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
ResetOnColumnErrors::MAX_RESET_PERIOD
Instance Method Summary
collapse
#handle_grpc_error
===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#sharding_organization
#reset_on_union_error, #reset_on_unknown_attribute_error
#serializable_hash
Instance Method Details
#emails_with_verified_status ⇒ Object
76
77
78
79
80
81
82
83
|
# File 'app/models/gpg_key.rb', line 76
def emails_with_verified_status
user_infos.to_h do |user_info|
[
user_info[:email],
user.verified_email?(user_info[:email])
]
end
end
|
#fingerprint ⇒ Object
58
59
60
|
# File 'app/models/gpg_key.rb', line 58
def fingerprint
super&.upcase
end
|
#key=(value) ⇒ Object
62
63
64
|
# File 'app/models/gpg_key.rb', line 62
def key=(value)
super(value&.strip)
end
|
#primary_keyid ⇒ Object
Also known as:
keyid
53
54
55
|
# File 'app/models/gpg_key.rb', line 53
def primary_keyid
super&.upcase
end
|
#revoke ⇒ Object
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# File 'app/models/gpg_key.rb', line 97
def revoke
CommitSignatures::GpgSignature
.with_key_and_subkeys(self)
.where.not(verification_status: CommitSignatures::GpgSignature.verification_statuses[:unknown_key])
.update_all(
gpg_key_id: nil,
gpg_key_subkey_id: nil,
verification_status: CommitSignatures::GpgSignature.verification_statuses[:unknown_key],
updated_at: Time.zone.now
)
destroy
end
|
#update_invalid_gpg_signatures ⇒ Object
#verified? ⇒ Boolean
85
86
87
|
# File 'app/models/gpg_key.rb', line 85
def verified?
emails_with_verified_status.values.any?
end
|
#verified_and_belongs_to_email?(email) ⇒ Boolean
89
90
91
|
# File 'app/models/gpg_key.rb', line 89
def verified_and_belongs_to_email?(email)
emails_with_verified_status.fetch(email.downcase, false)
end
|
#verified_user_infos ⇒ Object
70
71
72
73
74
|
# File 'app/models/gpg_key.rb', line 70
def verified_user_infos
user_infos.select do |user_info|
user.verified_email?(user_info[:email])
end
end
|