google-nomulus/java/google/registry/tools/soy/DomainCreate.soy
guyben 2e62ad2658 Allow setting DS records in create_domain and update_domain
The DS records consist of 4 values:
- keyTag: unsigned short (2 bytes)
- alg: unsigned byte
- digestType: unsigned byte
- digest: binary hex

NOTE: the current CL doesn't support keyData, neither as the optional field in dsData nor as a replacement for dsData

The command tool accepts DS records as a string, where the 4 values are given
as one string separated by white-spaces as follows:
<keyTag> <alg>  <digestType>  <digest>

e.g. something like:
60485 5  2  D4B7D520E7BB5F0F67674A0CCEB1E3E0614B93C4F9E99B8383F6A1E4469DA50A

which is how it's written in Zone files, allowing easy copy-paste from existing values.
ommas is confusing when using spaces.

The various "numbers" (keyTag, alg, digestType) are only checked that they are
positive integers - the rest is left for the server.

digest it checked to be an even-lengthed hex string.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184583068
2018-02-05 23:56:16 -05:00

74 lines
2.6 KiB
Text

// Copyright 2017 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{namespace domain.registry.tools}
/**
* Create domain
*/
{template .domaincreate stricthtml="false"}
{@param domain: string}
{@param? period: string}
{@param nameservers: list<string>}
{@param registrant: string}
{@param admins: list<string>}
{@param techs: list<string>}
{@param password: string}
{@param dsRecords: list<[keyTag:int, alg:int, digestType:int, digest:string]>}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<create>
<domain:create xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>{$domain}</domain:name>
{if $period}
<domain:period unit="y">{$period}</domain:period>
{/if}
{if length($nameservers) > 0}
<domain:ns>
{for $s in $nameservers}
<domain:hostObj>{$s}</domain:hostObj>
{/for}
</domain:ns>
{/if}
<domain:registrant>{$registrant}</domain:registrant>
{for $admin in $admins}
<domain:contact type="admin">{$admin}</domain:contact>
{/for}
{for $tech in $techs}
<domain:contact type="tech">{$tech}</domain:contact>
{/for}
<domain:authInfo>
<domain:pw>{$password}</domain:pw>
</domain:authInfo>
</domain:create>
</create>
{if length($dsRecords) > 0}
<extension>
<secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
{for $dsRecord in $dsRecords}
<secDNS:dsData>
<secDNS:keyTag>{$dsRecord.keyTag}</secDNS:keyTag>
<secDNS:alg>{$dsRecord.alg}</secDNS:alg>
<secDNS:digestType>{$dsRecord.digestType}</secDNS:digestType>
<secDNS:digest>{$dsRecord.digest}</secDNS:digest>
</secDNS:dsData>
{/for}
</secDNS:create>
</extension>
{/if}
<clTRID>RegistryTool</clTRID>
</command>
</epp>
{/template}