import { SubjectAltName } from "./extensions.js"; import { ParsedName, ParsedRelativeDistinguishedName } from "./parse.js"; //#region src/x509/name-text.d.ts /** Options for {@linkcode subjectAltNameToString}. */ interface SubjectAltNameTextOptions { /** Prepend `{@linkcode subjectAltNameLabel}:` to the value, as `openssl x509 -text` does. Defaults to `false`. */ readonly prefix?: boolean; } /** * Renders one {@linkcode SubjectAltName} as text. * * | variant | rendering | * | --- | --- | * | `dns`, `ip`, `email`, `uri`, `srv` | the value itself | * | `directoryName` | {@linkcode distinguishedNameToString} of the embedded name, or the DER hex if it does not decode | * | `unknown` | lowercase hex of the raw content bytes | * * @example Render every SAN of a parsed certificate * ```ts * const names = (parsed.subjectAltNames ?? []).map((name) => subjectAltNameToString(name)); * // ['example.com', '192.0.2.1', 'CN=Example CA,C=US'] * * subjectAltNameToString({ type: 'dns', value: 'example.com' }, { prefix: true }); // 'DNS:example.com' * ``` */ declare function subjectAltNameToString(name: SubjectAltName, options?: SubjectAltNameTextOptions): string; /** * The `openssl x509 -text` label for a {@linkcode SubjectAltName} variant — * `DNS`, `IP Address`, `email`, `URI`, `SRV`, `DirName`, or `[tag ]` for an unrecognized tag. */ declare function subjectAltNameLabel(name: SubjectAltName): string; /** * Renders a {@linkcode ParsedName} as an RFC 4514 distinguished name string, e.g. `CN=Example CA,O=Acme,C=US`. * * RDNs are emitted in reverse encoding order and multi-valued RDNs are joined with `+`, * both per RFC 4514 [§2](https://datatracker.ietf.org/doc/html/rfc4514#section-2). * Attribute types outside the RFC 4514 [§3](https://datatracker.ietf.org/doc/html/rfc4514#section-3) * keyword table use the short names `openssl` prints, falling back to the dotted OID. * * @example * ```ts * distinguishedNameToString(parsed.subject); // 'CN=example.com,O=Acme\\, Inc.,C=US' * ``` */ declare function distinguishedNameToString(name: ParsedName): string; /** Renders one {@linkcode ParsedRelativeDistinguishedName}, joining a multi-valued RDN's attributes with `+`. */ declare function relativeDistinguishedNameToString(rdn: ParsedRelativeDistinguishedName): string; //#endregion export { SubjectAltNameTextOptions, distinguishedNameToString, relativeDistinguishedNameToString, subjectAltNameLabel, subjectAltNameToString }; //# sourceMappingURL=name-text.d.ts.map