@@ -1241,79 +1241,53 @@ class Server {
12411241 const selfsigned = require ( "selfsigned" ) ;
12421242
12431243 const attributes = [ { name : "commonName" , value : "localhost" } ] ;
1244- const pems = selfsigned . generate ( attributes , {
1245- algorithm : "sha256" ,
1246- days : 30 ,
1247- keySize : 2048 ,
1248- extensions : [
1249- {
1250- name : "basicConstraints" ,
1251- cA : true ,
1252- } ,
1253- {
1254- name : "keyUsage" ,
1255- keyCertSign : true ,
1256- digitalSignature : true ,
1257- nonRepudiation : true ,
1258- keyEncipherment : true ,
1259- dataEncipherment : true ,
1260- } ,
1261- {
1262- name : "extKeyUsage" ,
1263- serverAuth : true ,
1264- clientAuth : true ,
1265- codeSigning : true ,
1266- timeStamping : true ,
1267- } ,
1268- {
1269- name : "subjectAltName" ,
1270- altNames : [
1271- {
1272- // type 2 is DNS
1273- type : 2 ,
1274- value : "localhost" ,
1275- } ,
1276- {
1277- type : 2 ,
1278- value : "localhost.localdomain" ,
1279- } ,
1280- {
1281- type : 2 ,
1282- value : "lvh.me" ,
1283- } ,
1284- {
1285- type : 2 ,
1286- value : "*.lvh.me" ,
1287- } ,
1288- {
1289- type : 2 ,
1290- value : "[::1]" ,
1291- } ,
1292- {
1293- // type 7 is IP
1294- type : 7 ,
1295- ip : "127.0.0.1" ,
1296- } ,
1297- {
1298- type : 7 ,
1299- ip : "fe80::1" ,
1300- } ,
1301- ] ,
1302- } ,
1244+
1245+ const pems = await selfsigned . generate ( attributes , {
1246+ algorithm : "sha256" ,
1247+ keySize : 2048 ,
1248+ extensions : [
1249+ {
1250+ name : "basicConstraints" ,
1251+ cA : true ,
1252+ } ,
1253+ {
1254+ name : "keyUsage" ,
1255+ keyCertSign : true ,
1256+ digitalSignature : true ,
1257+ nonRepudiation : true ,
1258+ keyEncipherment : true ,
1259+ dataEncipherment : true ,
1260+ } ,
1261+ {
1262+ name : "extKeyUsage" ,
1263+ serverAuth : true ,
1264+ clientAuth : true ,
1265+ codeSigning : true ,
1266+ timeStamping : true ,
1267+ } ,
1268+ {
1269+ name : "subjectAltName" ,
1270+ altNames : [
1271+ { type : 2 , value : "localhost" } ,
1272+ { type : 2 , value : "localhost.localdomain" } ,
1273+ { type : 2 , value : "lvh.me" } ,
1274+ { type : 2 , value : "*.lvh.me" } ,
1275+ { type : 2 , value : "[::1]" } ,
1276+ { type : 7 , ip : "127.0.0.1" } ,
1277+ { type : 7 , ip : "fe80::1" } ,
13031278 ] ,
1279+ } ,
1280+ ] ,
13041281 } ) ;
13051282
13061283 await fs . promises . mkdir ( certificateDir , { recursive : true } ) ;
13071284
13081285 await fs . promises . writeFile (
13091286 certificatePath ,
13101287 pems . private + pems . cert ,
1311- {
1312- encoding : "utf8" ,
1313- } ,
1288+ { encoding : "utf8" }
13141289 ) ;
13151290 }
1316-
13171291 fakeCert = await fs . promises . readFile ( certificatePath ) ;
13181292
13191293 this . logger . info ( `SSL certificate: ${ certificatePath } ` ) ;
0 commit comments