Comparing version 0.0.3 to 1.0.0
11
index.js
@@ -16,3 +16,3 @@ var nconf = require('nconf'); | ||
*/ | ||
var printKeyCred = function(keycred) { | ||
var printKeyCred = function (keycred) { | ||
@@ -63,3 +63,3 @@ // Convert the keycred to JSON. | ||
} | ||
}, function(err, params) { | ||
}, function (err, params) { | ||
if (parseInt(params.newcert, 10) === 1) { | ||
@@ -86,4 +86,7 @@ prompt.get({ | ||
}, | ||
expireInYears: { | ||
description: 'Number of years until expiration (default is 1, max is 30)' | ||
} | ||
} | ||
}, function(err, certparams) { | ||
}, function (err, certparams) { | ||
printKeyCred(new KeyCred(certparams)); | ||
@@ -104,3 +107,3 @@ }); | ||
} | ||
}, function(err, fileparams) { | ||
}, function (err, fileparams) { | ||
@@ -107,0 +110,0 @@ // Print the keycred from the provided PEM files. |
@@ -9,3 +9,3 @@ var forge = require('node-forge'); | ||
*/ | ||
var KeyCred = function(certparams) { | ||
var KeyCred = function (certparams) { | ||
var keys = forge.pki.rsa.generateKeyPair(2048); | ||
@@ -24,3 +24,3 @@ this.publicKey = keys.publicKey; | ||
*/ | ||
KeyCred.fromPem = function(privateKey, cert) { | ||
KeyCred.fromPem = function (privateKey, cert) { | ||
this.privateKey = forge.pki.privateKeyFromPem(privateKey); | ||
@@ -35,3 +35,3 @@ this.cert = forge.pki.certificateFromPem(cert, true); | ||
*/ | ||
KeyCred.prototype.createCertificate = function(certparams) { | ||
KeyCred.prototype.createCertificate = function (certparams) { | ||
var cert = forge.pki.createCertificate(); | ||
@@ -42,3 +42,8 @@ cert.publicKey = this.publicKey; | ||
cert.validity.notAfter = new Date(); | ||
cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + 1); | ||
var expireInYears = 1; | ||
if (certparams.expireInYears) { | ||
expireInYears = parseInt(certparams.expireInYears); | ||
} | ||
if (expireInYears > 30) expireInYears = 30; | ||
cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + expireInYears); | ||
var attrs = [{ | ||
@@ -103,3 +108,3 @@ name: 'commonName', | ||
*/ | ||
KeyCred.prototype.generate = function() { | ||
KeyCred.prototype.generate = function () { | ||
@@ -129,3 +134,3 @@ // Convert the Certificate to DER format. | ||
*/ | ||
KeyCred.prototype.toJSON = function() { | ||
KeyCred.prototype.toJSON = function () { | ||
if (!this.keycred) { | ||
@@ -132,0 +137,0 @@ this.generate(); |
{ | ||
"name": "keycred", | ||
"version": "0.0.3", | ||
"version": "1.0.0", | ||
"description": "A Key Credential generator for Office 365 Applications.", | ||
@@ -5,0 +5,0 @@ "main": "keycred.js", |
@@ -42,2 +42,3 @@ A key credential generator for Office 365 API App-Only Permissions (Client Credentials Grant Flow) in Azure AD. | ||
prompt: Common Name (e.g. server FQDN or YOUR name): Travis Tidwell | ||
prompt: Number of years until expiration (default is 1, max is 30): 3 | ||
Generating key pairs | ||
@@ -44,0 +45,0 @@ Creating a certificate. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
16790
237
1
134
0