/** * Reading the attributes out of a subject or issuer line. * * Its own module with its own tests, because the two things that call it cannot * both be exercised by a fixture. Apple's certificates render as one attribute * per line; the development certificates this package generates render as a * single multi-valued name joined by ` + `, because `pkijs` flattens a parsed * name back into one relative name on the way out and cannot be made to do * otherwise. So the shape used in production is the shape no test could build, * and the only way to cover it honestly is to test the parser on the strings * themselves. * * The strings are Node's rendering of a distinguished name, which follows * RFC 4514: `\` escapes the characters that would otherwise separate things. */ export function parseDistinguishedName(rendered: string): Map { const attributes = new Map(); for (const line of rendered.split('\n')) { for (const part of line.split(/(? value.replace(/\\(.)/g, '$1');