source: trip-planner-front/node_modules/webpack-dev-server/lib/utils/createCertificate.js@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1'use strict';
2
3const selfsigned = require('selfsigned');
4
5function createCertificate(attributes) {
6 return selfsigned.generate(attributes, {
7 algorithm: 'sha256',
8 days: 30,
9 keySize: 2048,
10 extensions: [
11 // {
12 // name: 'basicConstraints',
13 // cA: true,
14 // },
15 {
16 name: 'keyUsage',
17 keyCertSign: true,
18 digitalSignature: true,
19 nonRepudiation: true,
20 keyEncipherment: true,
21 dataEncipherment: true,
22 },
23 {
24 name: 'extKeyUsage',
25 serverAuth: true,
26 clientAuth: true,
27 codeSigning: true,
28 timeStamping: true,
29 },
30 {
31 name: 'subjectAltName',
32 altNames: [
33 {
34 // type 2 is DNS
35 type: 2,
36 value: 'localhost',
37 },
38 {
39 type: 2,
40 value: 'localhost.localdomain',
41 },
42 {
43 type: 2,
44 value: 'lvh.me',
45 },
46 {
47 type: 2,
48 value: '*.lvh.me',
49 },
50 {
51 type: 2,
52 value: '[::1]',
53 },
54 {
55 // type 7 is IP
56 type: 7,
57 ip: '127.0.0.1',
58 },
59 {
60 type: 7,
61 ip: 'fe80::1',
62 },
63 ],
64 },
65 ],
66 });
67}
68
69module.exports = createCertificate;
Note: See TracBrowser for help on using the repository browser.