Skip to content

Commit

Permalink
Remove unnecessary random-int package
Browse files Browse the repository at this point in the history
  • Loading branch information
cbodin committed Jan 12, 2022
1 parent 923730a commit bac342c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
"dependencies": {
"commander": "^6.1.0",
"is-ip": "^3.1.0",
"node-forge": "^0.10.0",
"random-int": "^2.0.1"
"node-forge": "^0.10.0"
},
"devDependencies": {
"jest": "^26.4.2"
Expand Down
4 changes: 2 additions & 2 deletions src/mkcert.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const isIp = require('is-ip');
const forge = require('node-forge');
const { promisify } = require('util');
const randomInt = require('random-int');
const pki = forge.pki;
const generateKeyPair = promisify(pki.rsa.generateKeyPair.bind(pki.rsa));

async function generateCert({ subject, issuer, extensions, validityDays, signWith }) {
const serial = randomInt(50000, 99999).toString();
// create serial from and integer between 50000 and 99999
const serial = Math.floor((Math.random() * 95000) + 50000).toString();
const keyPair = await generateKeyPair({ bits: 2048, workers: 4 });
const cert = pki.createCertificate();

Expand Down

0 comments on commit bac342c

Please sign in to comment.