mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Refactor dnssec to extension
This commit is contained in:
parent
7883b3775f
commit
6f12af5e0b
5 changed files with 54 additions and 31 deletions
|
@ -52,7 +52,7 @@ module Epp
|
|||
|
||||
### REQUEST TEMPLATES ###
|
||||
|
||||
def domain_create_xml(xml_params = {})
|
||||
def domain_create_xml(xml_params = {}, dnssec_params = {})
|
||||
|
||||
defaults = {
|
||||
name: { value: 'example.ee' },
|
||||
|
@ -62,16 +62,6 @@ module Epp
|
|||
{ hostObj: { value: 'ns2.example.net' } }
|
||||
],
|
||||
registrant: { value: 'jd1234' },
|
||||
dnssec: [
|
||||
{
|
||||
dnskey: {
|
||||
flags: { value: '257' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '5' },
|
||||
pubKey: { value: 'AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8' }
|
||||
}
|
||||
}
|
||||
],
|
||||
_other: [
|
||||
{ contact: { value: 'sh8013', attrs: { type: 'admin' } } },
|
||||
{ contact: { value: 'sh8013', attrs: { type: 'tech' } } },
|
||||
|
@ -81,6 +71,17 @@ module Epp
|
|||
|
||||
xml_params = defaults.deep_merge(xml_params)
|
||||
|
||||
dsnsec_defaults = {
|
||||
keyData: [
|
||||
flags: { value: '257' },
|
||||
protocol: { value: '3' },
|
||||
alg: { value: '5' },
|
||||
pubKey: { value: 'AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8' }
|
||||
]
|
||||
}
|
||||
|
||||
dnssec_params = dsnsec_defaults.deep_merge(dnssec_params) if dnssec_params != false
|
||||
|
||||
xml = Builder::XmlMarkup.new
|
||||
|
||||
xml.instruct!(:xml, standalone: 'no')
|
||||
|
@ -91,6 +92,11 @@ module Epp
|
|||
generate_xml_from_hash(xml_params, xml, 'domain')
|
||||
end
|
||||
end
|
||||
xml.extension do
|
||||
xml.tag!('secDNS:create', 'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1') do
|
||||
generate_xml_from_hash(dnssec_params, xml, 'secDNS')
|
||||
end
|
||||
end if dnssec_params != false
|
||||
xml.clTRID 'ABC-12345'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue