DistinguishedNameBuilder

Provides a result-builder style DSL for constructing DistinguishedName values.

DNBuilder.swift:33
@resultBuilder struct DistinguishedNameBuilder

This DSL allows us to construct distinguished names straightforwardly, using their high-level representation instead of the awkward representation provided by sequences of RelativeDistinguishedName and Attribute. For example, a simple DistinguishedName can be provided like this:

let name = try DistinguishedName {
    CountryName("US")
    OrganizationName("Apple Inc.")
    CommonName("Apple Public EV Server ECC CA 1 - G1")
}

Users can extend this syntax for their own extensions by conforming their semantic type to RelativeDistinguishedNameConvertible. This is the only requirement for adding new extensions to this builder syntax.