Socket
Socket
Sign inDemoInstall

keycred

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keycred - npm Package Compare versions

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.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc