mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Merge remote-tracking branch 'origin/master' into repp-domains
This commit is contained in:
commit
9305602c5f
34 changed files with 1133 additions and 54 deletions
|
@ -8,6 +8,7 @@ class Dnskey < ApplicationRecord
|
|||
validate :validate_algorithm
|
||||
validate :validate_protocol
|
||||
validate :validate_flags
|
||||
validate :validate_public_key
|
||||
|
||||
before_save lambda {
|
||||
generate_digest if will_save_change_to_public_key? && !will_save_change_to_ds_digest?
|
||||
|
@ -115,6 +116,12 @@ class Dnskey < ApplicationRecord
|
|||
self.ds_key_tag = ((c & 0xFFFF) + (c >> 16)) & 0xFFFF
|
||||
end
|
||||
|
||||
def validate_public_key
|
||||
return if Dnskey.pub_key_base64?(public_key)
|
||||
|
||||
errors.add(:public_key, :invalid)
|
||||
end
|
||||
|
||||
class << self
|
||||
def int_to_hex(s)
|
||||
s = s.to_s(16)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue