From a0d01815dffa34c424ac081c9cf8bf6b92664970 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 6 Aug 2016 01:32:59 -0400 Subject: [PATCH] move attachCertInfo to utils.js --- lib/utils.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/utils.js b/lib/utils.js index e00919f..d98b779 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -5,6 +5,18 @@ var homeRe = new RegExp("^~(\\/|\\\|\\" + path.sep + ")"); var re = /^[a-zA-Z0-9\.\-]+$/; var punycode = require('punycode'); +module.exports.attachCertInfo = function (results) { + var getCertInfo = require('./cert-info').getCertInfo; + // XXX Note: Parsing the certificate info comes at a great cost (~500kb) + var certInfo = getCertInfo(results.cert); + + //results.issuedAt = arr[3].mtime.valueOf() + results.issuedAt = Date(certInfo.notBefore.value).valueOf(); // Date.now() + results.expiresAt = Date(certInfo.notAfter.value).valueOf(); + + return results; +}; + module.exports.isValidDomain = function (domain) { if (re.test(domain)) { return domain;