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Q,OAC9C,CAAE,KAAM,eAAgB,MAAO,EAAQ,UACvC,CAAE,KAAM,mBAAoB,MAAO,EAAQ,eAO/C,aAAa,aAAa,CACtB,QAAS,EACT,OAAQ,EACR,WAPe,CACf,CAAE,KAAM,mBAAoB,IAAI,EAAM,UAAU,GAChD,CAAE,KAAM,WAAY,aAAa,EAAM,UAAU,IAMjD,SAAU,EAAQ,UAE1B,CAEA,eAAe,WAAW,GAEtB,MAAM,EAAa,CACf,CAAE,KAAM,aAAc,MAAO,EAAQ,QAAQ,KAE7C,EAAQ,cACR,EAAW,KAAK,CAAE,KAAM,mBAAoB,MAAO,EAAQ,eAE3D,EAAQ,OACR,EAAW,KAAK,CAAE,KAAM,eAAgB,MAAO,EAAQ,QAG3D,MAAM,EAAa,CACf,CAAE,KAAM,mBAAoB,IAAI,EAAO,UAAU,GACjD,CACI,KAAM,WACN,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,GAEd,CAAE,KAAM,cAAe,YAAY,EAAM,YAAY,GACrD,CACI,KAAM,iBACN,SAAU,EAAQ,QAAQ,KAAK,GAIvB,WAAW,QAAQ,KAAK,GACjB,CAAE,KAFG,EAEY,GAAI,GAEzB,CAAE,KALW,EAKQ,MAAO,OAIzC,EAAK,aAAa,IAAI,mBAAmB,EAAQ,GAAG,MAC1D,aAAa,aAAa,CACtB,QAAS,EACT,OAAQ,EAAG,QAAQ,WACnB,WAAY,EACZ,SAAU,EAAQ,SAClB,SAAU,EAAQ,GAAG,KAE7B,CA3CA,QAAQ,SAAW,SA4CnB,QAAQ,WAAa","file":"/npm/mkcert@3.2.0/dist/mkcert.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/mkcert@3.2.0/dist/mkcert.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createCert = exports.createCA = void 0;\nconst node_forge_1 = require(\"node-forge\");\nconst node_net_1 = __importDefault(require(\"node:net\"));\nconst node_util_1 = require(\"node:util\");\nasync function generateCert(options) {\n    const { subject, issuer, extensions, validity } = options;\n    const generateKeyPair = (0, node_util_1.promisify)(node_forge_1.pki.rsa.generateKeyPair.bind(node_forge_1.pki.rsa));\n    // create random serial number between between 50000 and 99999\n    const serial = Math.floor(Math.random() * 95000 + 50000).toString();\n    const keyPair = await generateKeyPair({ bits: 2048, workers: 4 });\n    const cert = node_forge_1.pki.createCertificate();\n    // serial number must be hex encoded\n    cert.serialNumber = Buffer.from(serial).toString(\"hex\");\n    cert.publicKey = keyPair.publicKey;\n    cert.setSubject(subject);\n    cert.setIssuer(issuer);\n    cert.setExtensions(extensions);\n    cert.validity.notBefore = new Date();\n    cert.validity.notAfter = new Date();\n    cert.validity.notAfter.setDate(cert.validity.notAfter.getDate() + validity);\n    // sign the certificate with it's own\n    // private key if no separate signing key is provided\n    const signWith = options.signWith ? node_forge_1.pki.privateKeyFromPem(options.signWith) : keyPair.privateKey;\n    cert.sign(signWith, node_forge_1.md.sha256.create());\n    return {\n        key: node_forge_1.pki.privateKeyToPem(keyPair.privateKey),\n        cert: node_forge_1.pki.certificateToPem(cert)\n    };\n}\nasync function createCA(options) {\n    // certificate Attributes: https://git.io/fptna\n    const attributes = [\n        { name: \"commonName\", value: options.organization },\n        { name: \"countryName\", value: options.countryCode },\n        { name: \"stateOrProvinceName\", value: options.state },\n        { name: \"localityName\", value: options.locality },\n        { name: \"organizationName\", value: options.organization }\n    ];\n    // required certificate extensions for a certificate authority\n    const extensions = [\n        { name: \"basicConstraints\", cA: true, critical: true },\n        { name: \"keyUsage\", keyCertSign: true, critical: true }\n    ];\n    return await generateCert({\n        subject: attributes,\n        issuer: attributes,\n        extensions: extensions,\n        validity: options.validity\n    });\n}\nexports.createCA = createCA;\nasync function createCert(options) {\n    // certificate Attributes: https://git.io/fptna\n    const attributes = [\n        { name: \"commonName\", value: options.domains[0] } // use the first address as common name\n    ];\n    if (options.organization) {\n        attributes.push({ name: \"organizationName\", value: options.organization });\n    }\n    if (options.email) {\n        attributes.push({ name: \"emailAddress\", value: options.email });\n    }\n    // required certificate extensions for a tls certificate\n    const extensions = [\n        { name: \"basicConstraints\", cA: false, critical: true },\n        {\n            name: \"keyUsage\",\n            digitalSignature: true,\n            keyEncipherment: true,\n            critical: true\n        },\n        { name: \"extKeyUsage\", serverAuth: true, clientAuth: true },\n        {\n            name: \"subjectAltName\",\n            altNames: options.domains.map((domain) => {\n                // types https://git.io/fptng\n                const TYPE_DOMAIN = 2;\n                const TYPE_IP = 7;\n                if (node_net_1.default.isIP(domain)) {\n                    return { type: TYPE_IP, ip: domain };\n                }\n                return { type: TYPE_DOMAIN, value: domain };\n            })\n        }\n    ];\n    const ca = node_forge_1.pki.certificateFromPem(options.ca.cert);\n    return await generateCert({\n        subject: attributes,\n        issuer: ca.subject.attributes,\n        extensions: extensions,\n        validity: options.validity,\n        signWith: options.ca.key\n    });\n}\nexports.createCert = createCert;\n"]}