Documentation
¶
Overview ¶
The identifier package defines types for RFC 8555 ACME identifiers.
It exists as a separate package to prevent an import loop between the core and probs packages.
Function naming conventions: - "New" creates a new instance from one or more simple base type inputs. - "From" and "To" extract information from, or compose, a more complex object.
Index ¶
- Constants
- type ACMEIdentifier
- type ACMEIdentifiers
- func FromCSR(csr *x509.CertificateRequest) ACMEIdentifiers
- func FromCert(cert *x509.Certificate) ACMEIdentifiers
- func FromProtoSlice(pbIdents []*corepb.Identifier) ACMEIdentifiers
- func FromStringSlice(identStrs []string) ACMEIdentifiers
- func NewDNSSlice(input []string) ACMEIdentifiers
- func Normalize(idents ACMEIdentifiers) ACMEIdentifiers
- type IdentifierType
Constants ¶
const ( // TypeDNS is specified in RFC 8555 for TypeDNS type identifiers. TypeDNS = IdentifierType("dns") // TypeIP is specified in RFC 8738 TypeIP = IdentifierType("ip") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ACMEIdentifier ¶
type ACMEIdentifier struct { // Type is the registered IdentifierType of the identifier. Type IdentifierType `json:"type"` // Value is the value of the identifier. For a DNS type identifier it is // a domain name. Value string `json:"value"` }
ACMEIdentifier is a struct encoding an identifier that can be validated. The protocol allows for different types of identifier to be supported (DNS names, IP addresses, etc.), but currently we only support RFC 8555 DNS type identifiers for domain names.
func FromProto ¶
func FromProto(ident *corepb.Identifier) ACMEIdentifier
func FromString ¶ added in v0.20250707.0
func FromString(identStr string) ACMEIdentifier
FromString converts a string to an ACMEIdentifier.
func NewDNS ¶
func NewDNS(domain string) ACMEIdentifier
NewDNS is a convenience function for creating an ACMEIdentifier with Type "dns" for a given domain name.
func NewIP ¶
func NewIP(ip netip.Addr) ACMEIdentifier
NewIP is a convenience function for creating an ACMEIdentifier with Type "ip" for a given IP address.
func (ACMEIdentifier) ToProto ¶
func (i ACMEIdentifier) ToProto() *corepb.Identifier
type ACMEIdentifiers ¶
type ACMEIdentifiers []ACMEIdentifier
ACMEIdentifiers is a named type for a slice of ACME identifiers, so that methods can be applied to these slices.
func FromCSR ¶
func FromCSR(csr *x509.CertificateRequest) ACMEIdentifiers
FromCSR extracts the Subject Common Name and Subject Alternative Names from a CSR, and returns a slice of ACMEIdentifiers.
func FromCert ¶
func FromCert(cert *x509.Certificate) ACMEIdentifiers
FromCert extracts the Subject Common Name and Subject Alternative Names from a certificate, and returns a slice of ACMEIdentifiers.
func FromProtoSlice ¶
func FromProtoSlice(pbIdents []*corepb.Identifier) ACMEIdentifiers
FromProtoSlice is a convenience function for converting a slice of *corepb.Identifier from RPCs into a slice of ACMEIdentifier.
func FromStringSlice ¶ added in v0.20250707.0
func FromStringSlice(identStrs []string) ACMEIdentifiers
FromStringSlice converts a slice of strings to a slice of ACMEIdentifier.
func NewDNSSlice ¶
func NewDNSSlice(input []string) ACMEIdentifiers
NewDNSSlice is a convenience function for creating a slice of ACMEIdentifier with Type "dns" for a given slice of domain names.
func Normalize ¶
func Normalize(idents ACMEIdentifiers) ACMEIdentifiers
Normalize returns the set of all unique ACME identifiers in the input after all of them are lowercased. The returned identifier values will be in their lowercased form and sorted alphabetically by value. DNS identifiers will precede IP address identifiers.
func (ACMEIdentifiers) ToProtoSlice ¶
func (idents ACMEIdentifiers) ToProtoSlice() []*corepb.Identifier
ToProtoSlice is a convenience function for converting a slice of ACMEIdentifier into a slice of *corepb.Identifier, to use for RPCs.
type IdentifierType ¶
type IdentifierType string
IdentifierType is a named string type for registered ACME identifier types. See https://tools.ietf.org/html/rfc8555#section-9.7.7
func (IdentifierType) IsValid ¶
func (i IdentifierType) IsValid() bool
IsValid tests whether the identifier type is known