diff --git a/lib/keypairs.js b/lib/keypairs.js index 1492954..79566d9 100644 --- a/lib/keypairs.js +++ b/lib/keypairs.js @@ -3,8 +3,8 @@ 'use strict'; var Keypairs = exports.Keypairs = {}; -var Rasha = exports.Rasha || require('rasha'); -var Eckles = exports.Eckles || require('eckles'); +var Rasha = exports.Rasha; +var Eckles = exports.Eckles; var Enc = exports.Enc || {}; Keypairs._stance = "We take the stance that if you're knowledgeable enough to" @@ -34,10 +34,12 @@ Keypairs.generate = function (opts) { }; -// Chopping off the private parts is now part of the public API. -// I thought it sounded a little too crude at first, but it really is the best name in every possible way. +/** + * Chopping off the private parts is now part of the public API. + * I thought it sounded a little too crude at first, but it really is the best name in every possible way. + */ Keypairs.neuter = Keypairs._neuter = function (opts) { - // trying to find the best balance of an immutable copy with custom attributes + /** trying to find the best balance of an immutable copy with custom attributes */ var jwk = {}; Object.keys(opts.jwk).forEach(function (k) { if ('undefined' === typeof opts.jwk[k]) { return; } @@ -61,7 +63,7 @@ Keypairs.thumbprint = function (opts) { Keypairs.publish = function (opts) { if ('object' !== typeof opts.jwk || !opts.jwk.kty) { throw new Error("invalid jwk: " + JSON.stringify(opts.jwk)); } - // returns a copy + /** returns a copy */ var jwk = Keypairs.neuter(opts); if (jwk.exp) { diff --git a/lib/x509.js b/lib/x509.js index 114375d..3bf60fd 100644 --- a/lib/x509.js +++ b/lib/x509.js @@ -136,6 +136,10 @@ , ASN1('A1', ASN1.BitStr('04' + x + y))) ); }; + /** + * take a private jwk and creates a der from it + * @param {*} jwk + */ x509.packPkcs8 = function (jwk) { var d = Enc.base64ToHex(jwk.d); var x = Enc.base64ToHex(jwk.x);