move some docs to js formatted documentation
This commit is contained in:
parent
735ec948da
commit
4b44a576c1
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue