2018-07-25 05:30:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-28 09:17:42 -04:00
|
|
|
class GpgKeySubkey < ApplicationRecord
|
2017-09-27 20:45:19 -04:00
|
|
|
include ShaAttribute
|
|
|
|
|
|
|
|
sha_attribute :keyid
|
|
|
|
sha_attribute :fingerprint
|
|
|
|
|
2017-09-27 13:27:39 -04:00
|
|
|
belongs_to :gpg_key
|
2017-09-27 20:45:19 -04:00
|
|
|
|
2017-09-28 14:26:16 -04:00
|
|
|
validates :gpg_key_id, presence: true
|
|
|
|
validates :fingerprint, :keyid, presence: true, uniqueness: true
|
|
|
|
|
2017-09-29 18:55:36 -04:00
|
|
|
delegate :key, :user, :user_infos, :verified?, :verified_user_infos,
|
|
|
|
:verified_and_belongs_to_email?, to: :gpg_key
|
|
|
|
|
2017-09-28 14:26:16 -04:00
|
|
|
def keyid
|
|
|
|
super&.upcase
|
|
|
|
end
|
|
|
|
|
|
|
|
def fingerprint
|
|
|
|
super&.upcase
|
|
|
|
end
|
2017-09-27 13:27:39 -04:00
|
|
|
end
|