@@ -471,58 +471,6 @@ async function generateCertificate({
471471 return await x509 . X509CertificateGenerator . create ( certConfig ) ;
472472}
473473
474- // Async function createTLSConfigWithChain(
475- // keyPairs: Array<{
476- // publicKey: JsonWebKey;
477- // privateKey: JsonWebKey;
478- // }>,
479- // generateCertId?: () => string,
480- // ): Promise<{
481- // certChainPem: string;
482- // privKeyPem: string;
483- // caPem: string;
484- // }> {
485- // if (keyPairs.length === 0) throw Error('Must have at least 1 keypair');
486- // let num = -1;
487- // const defaultNumGen = () => {
488- // num += 1;
489- // return `${num}`;
490- // };
491- // generateCertId = generateCertId ?? defaultNumGen;
492- // let previousCert: X509Certificate | null = null;
493- // let previousKeyPair: {
494- // publicKey: JsonWebKey;
495- // privateKey: JsonWebKey;
496- // } | null = null;
497- // const certChain: Array<X509Certificate> = [];
498- // for (const keyPair of keyPairs) {
499- // const certId = generateCertId();
500- // const newCert = await generateCertificate({
501- // certId,
502- // duration: 31536000,
503- // issuerPrivateKey: previousKeyPair?.privateKey ?? keyPair.privateKey,
504- // subjectKeyPair: keyPair,
505- // issuerAttrsExtra: previousCert?.subjectName.toJSON(),
506- // });
507- // certChain.unshift(newCert);
508- // previousCert = newCert;
509- // previousKeyPair = keyPair;
510- // }
511- // let certChainPEM = '';
512- // let caPem: string | null = null;
513- // for (const certificate of certChain) {
514- // const pem = certToPEM(certificate);
515- // caPem = pem;
516- // certChainPEM += pem;
517- // }
518- //
519- // return {
520- // privKeyPem: privateKeyToPEM(previousKeyPair!.privateKey),
521- // certChainPem: certChainPEM,
522- // caPem: caPem!,
523- // };
524- // }
525-
526474function certToPEM ( cert : X509Certificate ) : string {
527475 return cert . toString ( 'pem' ) + '\n' ;
528476}
0 commit comments