1 // The identifier package defines types for RFC 8555 ACME identifiers. 2 package identifier 3 4 // IdentifierType is a named string type for registered ACME identifier types. 5 // See https://tools.ietf.org/html/rfc8555#section-9.7.7 6 type IdentifierType string 7 8 const ( 9 // DNS is specified in RFC 8555 for DNS type identifiers. 10 DNS = IdentifierType("dns") 11 ) 12 13 // ACMEIdentifier is a struct encoding an identifier that can be validated. The 14 // protocol allows for different types of identifier to be supported (DNS 15 // names, IP addresses, etc.), but currently we only support RFC 8555 DNS type 16 // identifiers for domain names. 17 type ACMEIdentifier struct { 18 // Type is the registered IdentifierType of the identifier. 19 Type IdentifierType `json:"type"` 20 // Value is the value of the identifier. For a DNS type identifier it is 21 // a domain name. 22 Value string `json:"value"` 23 } 24 25 // DNSIdentifier is a convenience function for creating an ACMEIdentifier with 26 // Type DNS for a given domain name. 27 func DNSIdentifier(domain string) ACMEIdentifier { 28 return ACMEIdentifier{ 29 Type: DNS, 30 Value: domain, 31 } 32 } 33