selfsigned
Advanced tools
Comparing version 1.10.8 to 1.10.11
14
index.js
@@ -26,2 +26,16 @@ var forge = require('node-forge'); | ||
/** | ||
* | ||
* @param {forge.pki.CertificateField[]} attrs Attributes used for subject and issuer. | ||
* @param {object} options | ||
* @param {number} [options.days=365] the number of days before expiration | ||
* @param {number} [options.keySize=1024] the size for the private key in bits | ||
* @param {object} [options.extensions] additional extensions for the certificate | ||
* @param {string} [options.algorithm="sha1"] The signature algorithm sha256 or sha1 | ||
* @param {boolean} [options.pkcs7=false] include PKCS#7 as part of the output | ||
* @param {boolean} [options.clientCertificate=false] generate client cert signed by the original key | ||
* @param {string} [options.clientCertificateCN="John Doe jdoe123"] client certificate's common name | ||
* @param {function} [done] Optional callback, if not provided the generation is synchronous | ||
* @returns | ||
*/ | ||
exports.generate = function generate(attrs, options, done) { | ||
@@ -28,0 +42,0 @@ if (typeof attrs === 'function') { |
{ | ||
"name": "selfsigned", | ||
"version": "1.10.8", | ||
"version": "1.10.11", | ||
"description": "Generate self signed certificates private and public keys", | ||
@@ -37,4 +37,5 @@ "main": "index.js", | ||
"devDependencies": { | ||
"mocha": "^5.1.1" | ||
"chai": "^4.3.4", | ||
"mocha": "^8.3.2" | ||
} | ||
} |
@@ -40,3 +40,3 @@ Generate a self signed x509 certificate from node.js. | ||
for attributes, please refer to: https://github.com/digitalbazaar/forge/blob/0.7.5/lib/x509.js#L129 | ||
for attributes, please refer to: https://github.com/digitalbazaar/forge/blob/master/lib/x509.js | ||
@@ -43,0 +43,0 @@ ## Options |
@@ -1,5 +0,5 @@ | ||
var assert = require('assert'); | ||
var forge = require('node-forge'); | ||
var fs = require('fs'); | ||
var exec = require('child_process').exec; | ||
var { assert } = require('chai'); | ||
var forge = require('node-forge'); | ||
var fs = require('fs'); | ||
var exec = require('child_process').exec; | ||
@@ -55,8 +55,10 @@ describe('generate', function () { | ||
const expected = stdout.toString().replace(/\n/g, '\r\n'); //node-forge uses \r\n | ||
assert.equal( | ||
`subject=/CN=contoso.com\r\nissuer=/CN=contoso.com\r\n` + | ||
pems.cert + | ||
'\r\n', | ||
expected | ||
const expected = stdout.toString(); | ||
let [ subjectLine,issuerLine, ...cert ] = expected.split(/\r?\n/).filter(c => c); | ||
cert = cert.filter(c => c); | ||
assert.match(subjectLine, /subject=\/?CN\s?=\s?contoso.com/i); | ||
assert.match(issuerLine, /issuer=\/?CN\s?=\s?contoso.com/i); | ||
assert.strictEqual( | ||
pems.cert, | ||
cert.join('\r\n') + '\r\n' | ||
); | ||
@@ -125,8 +127,9 @@ | ||
const expected = stdout.toString().replace(/\n/g, '\r\n'); //node-forge uses \r\n | ||
assert.equal( | ||
`subject=/CN=contoso.com\r\nissuer=/CN=contoso.com\r\n` + | ||
pems.cert + | ||
'\r\n', | ||
expected | ||
const expected = stdout.toString(); | ||
let [ subjectLine,issuerLine, ...cert ] = expected.split(/\r?\n/).filter(c => c); | ||
assert.match(subjectLine, /subject=\/?CN\s?=\s?contoso.com/i); | ||
assert.match(issuerLine, /issuer=\/?CN\s?=\s?contoso.com/i); | ||
assert.strictEqual( | ||
pems.cert, | ||
cert.join('\r\n') + '\r\n' | ||
); | ||
@@ -133,0 +136,0 @@ |
Sorry, the diff of this file is not supported yet
23784
303
2