node-forge 0.9.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +97 -0
- package/README.md +11 -39
- package/dist/forge.all.min.js +1 -1
- package/dist/forge.all.min.js.map +1 -1
- package/dist/forge.min.js +1 -1
- package/dist/forge.min.js.map +1 -1
- package/dist/prime.worker.min.js +1 -1
- package/lib/http.js +16 -34
- package/lib/index.js +0 -2
- package/lib/log.js +10 -5
- package/lib/oids.js +4 -1
- package/lib/pem.js +8 -1
- package/lib/pkcs7.js +6 -3
- package/lib/pkcs7asn1.js +2 -1
- package/lib/prng.js +1 -1
- package/lib/util.js +0 -348
- package/lib/x509.js +6 -2
- package/lib/xhr.js +8 -6
- package/package.json +20 -17
- package/lib/debug.js +0 -78
- package/lib/task.js +0 -725
package/lib/util.js
CHANGED
|
@@ -2258,354 +2258,6 @@ util.clearItems = function(api, id, location) {
|
|
|
2258
2258
|
_callStorageFunction(_clearItems, arguments, location);
|
|
2259
2259
|
};
|
|
2260
2260
|
|
|
2261
|
-
/**
|
|
2262
|
-
* Parses the scheme, host, and port from an http(s) url.
|
|
2263
|
-
*
|
|
2264
|
-
* @param str the url string.
|
|
2265
|
-
*
|
|
2266
|
-
* @return the parsed url object or null if the url is invalid.
|
|
2267
|
-
*/
|
|
2268
|
-
util.parseUrl = function(str) {
|
|
2269
|
-
// FIXME: this regex looks a bit broken
|
|
2270
|
-
var regex = /^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;
|
|
2271
|
-
regex.lastIndex = 0;
|
|
2272
|
-
var m = regex.exec(str);
|
|
2273
|
-
var url = (m === null) ? null : {
|
|
2274
|
-
full: str,
|
|
2275
|
-
scheme: m[1],
|
|
2276
|
-
host: m[2],
|
|
2277
|
-
port: m[3],
|
|
2278
|
-
path: m[4]
|
|
2279
|
-
};
|
|
2280
|
-
if(url) {
|
|
2281
|
-
url.fullHost = url.host;
|
|
2282
|
-
if(url.port) {
|
|
2283
|
-
if(url.port !== 80 && url.scheme === 'http') {
|
|
2284
|
-
url.fullHost += ':' + url.port;
|
|
2285
|
-
} else if(url.port !== 443 && url.scheme === 'https') {
|
|
2286
|
-
url.fullHost += ':' + url.port;
|
|
2287
|
-
}
|
|
2288
|
-
} else if(url.scheme === 'http') {
|
|
2289
|
-
url.port = 80;
|
|
2290
|
-
} else if(url.scheme === 'https') {
|
|
2291
|
-
url.port = 443;
|
|
2292
|
-
}
|
|
2293
|
-
url.full = url.scheme + '://' + url.fullHost;
|
|
2294
|
-
}
|
|
2295
|
-
return url;
|
|
2296
|
-
};
|
|
2297
|
-
|
|
2298
|
-
/* Storage for query variables */
|
|
2299
|
-
var _queryVariables = null;
|
|
2300
|
-
|
|
2301
|
-
/**
|
|
2302
|
-
* Returns the window location query variables. Query is parsed on the first
|
|
2303
|
-
* call and the same object is returned on subsequent calls. The mapping
|
|
2304
|
-
* is from keys to an array of values. Parameters without values will have
|
|
2305
|
-
* an object key set but no value added to the value array. Values are
|
|
2306
|
-
* unescaped.
|
|
2307
|
-
*
|
|
2308
|
-
* ...?k1=v1&k2=v2:
|
|
2309
|
-
* {
|
|
2310
|
-
* "k1": ["v1"],
|
|
2311
|
-
* "k2": ["v2"]
|
|
2312
|
-
* }
|
|
2313
|
-
*
|
|
2314
|
-
* ...?k1=v1&k1=v2:
|
|
2315
|
-
* {
|
|
2316
|
-
* "k1": ["v1", "v2"]
|
|
2317
|
-
* }
|
|
2318
|
-
*
|
|
2319
|
-
* ...?k1=v1&k2:
|
|
2320
|
-
* {
|
|
2321
|
-
* "k1": ["v1"],
|
|
2322
|
-
* "k2": []
|
|
2323
|
-
* }
|
|
2324
|
-
*
|
|
2325
|
-
* ...?k1=v1&k1:
|
|
2326
|
-
* {
|
|
2327
|
-
* "k1": ["v1"]
|
|
2328
|
-
* }
|
|
2329
|
-
*
|
|
2330
|
-
* ...?k1&k1:
|
|
2331
|
-
* {
|
|
2332
|
-
* "k1": []
|
|
2333
|
-
* }
|
|
2334
|
-
*
|
|
2335
|
-
* @param query the query string to parse (optional, default to cached
|
|
2336
|
-
* results from parsing window location search query).
|
|
2337
|
-
*
|
|
2338
|
-
* @return object mapping keys to variables.
|
|
2339
|
-
*/
|
|
2340
|
-
util.getQueryVariables = function(query) {
|
|
2341
|
-
var parse = function(q) {
|
|
2342
|
-
var rval = {};
|
|
2343
|
-
var kvpairs = q.split('&');
|
|
2344
|
-
for(var i = 0; i < kvpairs.length; i++) {
|
|
2345
|
-
var pos = kvpairs[i].indexOf('=');
|
|
2346
|
-
var key;
|
|
2347
|
-
var val;
|
|
2348
|
-
if(pos > 0) {
|
|
2349
|
-
key = kvpairs[i].substring(0, pos);
|
|
2350
|
-
val = kvpairs[i].substring(pos + 1);
|
|
2351
|
-
} else {
|
|
2352
|
-
key = kvpairs[i];
|
|
2353
|
-
val = null;
|
|
2354
|
-
}
|
|
2355
|
-
if(!(key in rval)) {
|
|
2356
|
-
rval[key] = [];
|
|
2357
|
-
}
|
|
2358
|
-
// disallow overriding object prototype keys
|
|
2359
|
-
if(!(key in Object.prototype) && val !== null) {
|
|
2360
|
-
rval[key].push(unescape(val));
|
|
2361
|
-
}
|
|
2362
|
-
}
|
|
2363
|
-
return rval;
|
|
2364
|
-
};
|
|
2365
|
-
|
|
2366
|
-
var rval;
|
|
2367
|
-
if(typeof(query) === 'undefined') {
|
|
2368
|
-
// set cached variables if needed
|
|
2369
|
-
if(_queryVariables === null) {
|
|
2370
|
-
if(typeof(window) !== 'undefined' && window.location && window.location.search) {
|
|
2371
|
-
// parse window search query
|
|
2372
|
-
_queryVariables = parse(window.location.search.substring(1));
|
|
2373
|
-
} else {
|
|
2374
|
-
// no query variables available
|
|
2375
|
-
_queryVariables = {};
|
|
2376
|
-
}
|
|
2377
|
-
}
|
|
2378
|
-
rval = _queryVariables;
|
|
2379
|
-
} else {
|
|
2380
|
-
// parse given query
|
|
2381
|
-
rval = parse(query);
|
|
2382
|
-
}
|
|
2383
|
-
return rval;
|
|
2384
|
-
};
|
|
2385
|
-
|
|
2386
|
-
/**
|
|
2387
|
-
* Parses a fragment into a path and query. This method will take a URI
|
|
2388
|
-
* fragment and break it up as if it were the main URI. For example:
|
|
2389
|
-
* /bar/baz?a=1&b=2
|
|
2390
|
-
* results in:
|
|
2391
|
-
* {
|
|
2392
|
-
* path: ["bar", "baz"],
|
|
2393
|
-
* query: {"k1": ["v1"], "k2": ["v2"]}
|
|
2394
|
-
* }
|
|
2395
|
-
*
|
|
2396
|
-
* @return object with a path array and query object.
|
|
2397
|
-
*/
|
|
2398
|
-
util.parseFragment = function(fragment) {
|
|
2399
|
-
// default to whole fragment
|
|
2400
|
-
var fp = fragment;
|
|
2401
|
-
var fq = '';
|
|
2402
|
-
// split into path and query if possible at the first '?'
|
|
2403
|
-
var pos = fragment.indexOf('?');
|
|
2404
|
-
if(pos > 0) {
|
|
2405
|
-
fp = fragment.substring(0, pos);
|
|
2406
|
-
fq = fragment.substring(pos + 1);
|
|
2407
|
-
}
|
|
2408
|
-
// split path based on '/' and ignore first element if empty
|
|
2409
|
-
var path = fp.split('/');
|
|
2410
|
-
if(path.length > 0 && path[0] === '') {
|
|
2411
|
-
path.shift();
|
|
2412
|
-
}
|
|
2413
|
-
// convert query into object
|
|
2414
|
-
var query = (fq === '') ? {} : util.getQueryVariables(fq);
|
|
2415
|
-
|
|
2416
|
-
return {
|
|
2417
|
-
pathString: fp,
|
|
2418
|
-
queryString: fq,
|
|
2419
|
-
path: path,
|
|
2420
|
-
query: query
|
|
2421
|
-
};
|
|
2422
|
-
};
|
|
2423
|
-
|
|
2424
|
-
/**
|
|
2425
|
-
* Makes a request out of a URI-like request string. This is intended to
|
|
2426
|
-
* be used where a fragment id (after a URI '#') is parsed as a URI with
|
|
2427
|
-
* path and query parts. The string should have a path beginning and
|
|
2428
|
-
* delimited by '/' and optional query parameters following a '?'. The
|
|
2429
|
-
* query should be a standard URL set of key value pairs delimited by
|
|
2430
|
-
* '&'. For backwards compatibility the initial '/' on the path is not
|
|
2431
|
-
* required. The request object has the following API, (fully described
|
|
2432
|
-
* in the method code):
|
|
2433
|
-
* {
|
|
2434
|
-
* path: <the path string part>.
|
|
2435
|
-
* query: <the query string part>,
|
|
2436
|
-
* getPath(i): get part or all of the split path array,
|
|
2437
|
-
* getQuery(k, i): get part or all of a query key array,
|
|
2438
|
-
* getQueryLast(k, _default): get last element of a query key array.
|
|
2439
|
-
* }
|
|
2440
|
-
*
|
|
2441
|
-
* @return object with request parameters.
|
|
2442
|
-
*/
|
|
2443
|
-
util.makeRequest = function(reqString) {
|
|
2444
|
-
var frag = util.parseFragment(reqString);
|
|
2445
|
-
var req = {
|
|
2446
|
-
// full path string
|
|
2447
|
-
path: frag.pathString,
|
|
2448
|
-
// full query string
|
|
2449
|
-
query: frag.queryString,
|
|
2450
|
-
/**
|
|
2451
|
-
* Get path or element in path.
|
|
2452
|
-
*
|
|
2453
|
-
* @param i optional path index.
|
|
2454
|
-
*
|
|
2455
|
-
* @return path or part of path if i provided.
|
|
2456
|
-
*/
|
|
2457
|
-
getPath: function(i) {
|
|
2458
|
-
return (typeof(i) === 'undefined') ? frag.path : frag.path[i];
|
|
2459
|
-
},
|
|
2460
|
-
/**
|
|
2461
|
-
* Get query, values for a key, or value for a key index.
|
|
2462
|
-
*
|
|
2463
|
-
* @param k optional query key.
|
|
2464
|
-
* @param i optional query key index.
|
|
2465
|
-
*
|
|
2466
|
-
* @return query, values for a key, or value for a key index.
|
|
2467
|
-
*/
|
|
2468
|
-
getQuery: function(k, i) {
|
|
2469
|
-
var rval;
|
|
2470
|
-
if(typeof(k) === 'undefined') {
|
|
2471
|
-
rval = frag.query;
|
|
2472
|
-
} else {
|
|
2473
|
-
rval = frag.query[k];
|
|
2474
|
-
if(rval && typeof(i) !== 'undefined') {
|
|
2475
|
-
rval = rval[i];
|
|
2476
|
-
}
|
|
2477
|
-
}
|
|
2478
|
-
return rval;
|
|
2479
|
-
},
|
|
2480
|
-
getQueryLast: function(k, _default) {
|
|
2481
|
-
var rval;
|
|
2482
|
-
var vals = req.getQuery(k);
|
|
2483
|
-
if(vals) {
|
|
2484
|
-
rval = vals[vals.length - 1];
|
|
2485
|
-
} else {
|
|
2486
|
-
rval = _default;
|
|
2487
|
-
}
|
|
2488
|
-
return rval;
|
|
2489
|
-
}
|
|
2490
|
-
};
|
|
2491
|
-
return req;
|
|
2492
|
-
};
|
|
2493
|
-
|
|
2494
|
-
/**
|
|
2495
|
-
* Makes a URI out of a path, an object with query parameters, and a
|
|
2496
|
-
* fragment. Uses jQuery.param() internally for query string creation.
|
|
2497
|
-
* If the path is an array, it will be joined with '/'.
|
|
2498
|
-
*
|
|
2499
|
-
* @param path string path or array of strings.
|
|
2500
|
-
* @param query object with query parameters. (optional)
|
|
2501
|
-
* @param fragment fragment string. (optional)
|
|
2502
|
-
*
|
|
2503
|
-
* @return string object with request parameters.
|
|
2504
|
-
*/
|
|
2505
|
-
util.makeLink = function(path, query, fragment) {
|
|
2506
|
-
// join path parts if needed
|
|
2507
|
-
path = jQuery.isArray(path) ? path.join('/') : path;
|
|
2508
|
-
|
|
2509
|
-
var qstr = jQuery.param(query || {});
|
|
2510
|
-
fragment = fragment || '';
|
|
2511
|
-
return path +
|
|
2512
|
-
((qstr.length > 0) ? ('?' + qstr) : '') +
|
|
2513
|
-
((fragment.length > 0) ? ('#' + fragment) : '');
|
|
2514
|
-
};
|
|
2515
|
-
|
|
2516
|
-
/**
|
|
2517
|
-
* Follows a path of keys deep into an object hierarchy and set a value.
|
|
2518
|
-
* If a key does not exist or it's value is not an object, create an
|
|
2519
|
-
* object in it's place. This can be destructive to a object tree if
|
|
2520
|
-
* leaf nodes are given as non-final path keys.
|
|
2521
|
-
* Used to avoid exceptions from missing parts of the path.
|
|
2522
|
-
*
|
|
2523
|
-
* @param object the starting object.
|
|
2524
|
-
* @param keys an array of string keys.
|
|
2525
|
-
* @param value the value to set.
|
|
2526
|
-
*/
|
|
2527
|
-
util.setPath = function(object, keys, value) {
|
|
2528
|
-
// need to start at an object
|
|
2529
|
-
if(typeof(object) === 'object' && object !== null) {
|
|
2530
|
-
var i = 0;
|
|
2531
|
-
var len = keys.length;
|
|
2532
|
-
while(i < len) {
|
|
2533
|
-
var next = keys[i++];
|
|
2534
|
-
if(i == len) {
|
|
2535
|
-
// last
|
|
2536
|
-
object[next] = value;
|
|
2537
|
-
} else {
|
|
2538
|
-
// more
|
|
2539
|
-
var hasNext = (next in object);
|
|
2540
|
-
if(!hasNext ||
|
|
2541
|
-
(hasNext && typeof(object[next]) !== 'object') ||
|
|
2542
|
-
(hasNext && object[next] === null)) {
|
|
2543
|
-
object[next] = {};
|
|
2544
|
-
}
|
|
2545
|
-
object = object[next];
|
|
2546
|
-
}
|
|
2547
|
-
}
|
|
2548
|
-
}
|
|
2549
|
-
};
|
|
2550
|
-
|
|
2551
|
-
/**
|
|
2552
|
-
* Follows a path of keys deep into an object hierarchy and return a value.
|
|
2553
|
-
* If a key does not exist, create an object in it's place.
|
|
2554
|
-
* Used to avoid exceptions from missing parts of the path.
|
|
2555
|
-
*
|
|
2556
|
-
* @param object the starting object.
|
|
2557
|
-
* @param keys an array of string keys.
|
|
2558
|
-
* @param _default value to return if path not found.
|
|
2559
|
-
*
|
|
2560
|
-
* @return the value at the path if found, else default if given, else
|
|
2561
|
-
* undefined.
|
|
2562
|
-
*/
|
|
2563
|
-
util.getPath = function(object, keys, _default) {
|
|
2564
|
-
var i = 0;
|
|
2565
|
-
var len = keys.length;
|
|
2566
|
-
var hasNext = true;
|
|
2567
|
-
while(hasNext && i < len &&
|
|
2568
|
-
typeof(object) === 'object' && object !== null) {
|
|
2569
|
-
var next = keys[i++];
|
|
2570
|
-
hasNext = next in object;
|
|
2571
|
-
if(hasNext) {
|
|
2572
|
-
object = object[next];
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
return (hasNext ? object : _default);
|
|
2576
|
-
};
|
|
2577
|
-
|
|
2578
|
-
/**
|
|
2579
|
-
* Follow a path of keys deep into an object hierarchy and delete the
|
|
2580
|
-
* last one. If a key does not exist, do nothing.
|
|
2581
|
-
* Used to avoid exceptions from missing parts of the path.
|
|
2582
|
-
*
|
|
2583
|
-
* @param object the starting object.
|
|
2584
|
-
* @param keys an array of string keys.
|
|
2585
|
-
*/
|
|
2586
|
-
util.deletePath = function(object, keys) {
|
|
2587
|
-
// need to start at an object
|
|
2588
|
-
if(typeof(object) === 'object' && object !== null) {
|
|
2589
|
-
var i = 0;
|
|
2590
|
-
var len = keys.length;
|
|
2591
|
-
while(i < len) {
|
|
2592
|
-
var next = keys[i++];
|
|
2593
|
-
if(i == len) {
|
|
2594
|
-
// last
|
|
2595
|
-
delete object[next];
|
|
2596
|
-
} else {
|
|
2597
|
-
// more
|
|
2598
|
-
if(!(next in object) ||
|
|
2599
|
-
(typeof(object[next]) !== 'object') ||
|
|
2600
|
-
(object[next] === null)) {
|
|
2601
|
-
break;
|
|
2602
|
-
}
|
|
2603
|
-
object = object[next];
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
}
|
|
2607
|
-
};
|
|
2608
|
-
|
|
2609
2261
|
/**
|
|
2610
2262
|
* Check if an object is empty.
|
|
2611
2263
|
*
|
package/lib/x509.js
CHANGED
|
@@ -1372,6 +1372,8 @@ pki.certificateFromAsn1 = function(obj, computeHash) {
|
|
|
1372
1372
|
|
|
1373
1373
|
// handle issuer, build issuer message digest
|
|
1374
1374
|
var imd = forge.md.sha1.create();
|
|
1375
|
+
var ibytes = asn1.toDer(capture.certIssuer);
|
|
1376
|
+
imd.update(ibytes.getBytes());
|
|
1375
1377
|
cert.issuer.getField = function(sn) {
|
|
1376
1378
|
return _getAttribute(cert.issuer, sn);
|
|
1377
1379
|
};
|
|
@@ -1379,7 +1381,7 @@ pki.certificateFromAsn1 = function(obj, computeHash) {
|
|
|
1379
1381
|
_fillMissingFields([attr]);
|
|
1380
1382
|
cert.issuer.attributes.push(attr);
|
|
1381
1383
|
};
|
|
1382
|
-
cert.issuer.attributes = pki.RDNAttributesAsArray(capture.certIssuer
|
|
1384
|
+
cert.issuer.attributes = pki.RDNAttributesAsArray(capture.certIssuer);
|
|
1383
1385
|
if(capture.certIssuerUniqueId) {
|
|
1384
1386
|
cert.issuer.uniqueId = capture.certIssuerUniqueId;
|
|
1385
1387
|
}
|
|
@@ -1387,6 +1389,8 @@ pki.certificateFromAsn1 = function(obj, computeHash) {
|
|
|
1387
1389
|
|
|
1388
1390
|
// handle subject, build subject message digest
|
|
1389
1391
|
var smd = forge.md.sha1.create();
|
|
1392
|
+
var sbytes = asn1.toDer(capture.certSubject);
|
|
1393
|
+
smd.update(sbytes.getBytes());
|
|
1390
1394
|
cert.subject.getField = function(sn) {
|
|
1391
1395
|
return _getAttribute(cert.subject, sn);
|
|
1392
1396
|
};
|
|
@@ -1394,7 +1398,7 @@ pki.certificateFromAsn1 = function(obj, computeHash) {
|
|
|
1394
1398
|
_fillMissingFields([attr]);
|
|
1395
1399
|
cert.subject.attributes.push(attr);
|
|
1396
1400
|
};
|
|
1397
|
-
cert.subject.attributes = pki.RDNAttributesAsArray(capture.certSubject
|
|
1401
|
+
cert.subject.attributes = pki.RDNAttributesAsArray(capture.certSubject);
|
|
1398
1402
|
if(capture.certSubjectUniqueId) {
|
|
1399
1403
|
cert.subject.uniqueId = capture.certSubjectUniqueId;
|
|
1400
1404
|
}
|
package/lib/xhr.js
CHANGED
|
@@ -151,7 +151,7 @@ xhrApi.init = function(options) {
|
|
|
151
151
|
getPrivateKey: options.getPrivateKey,
|
|
152
152
|
getSignature: options.getSignature
|
|
153
153
|
});
|
|
154
|
-
_clients[_client.url.
|
|
154
|
+
_clients[_client.url.origin] = _client;
|
|
155
155
|
|
|
156
156
|
forge.log.debug(cat, 'ready');
|
|
157
157
|
};
|
|
@@ -380,8 +380,10 @@ xhrApi.create = function(options) {
|
|
|
380
380
|
// use default
|
|
381
381
|
_state.client = _client;
|
|
382
382
|
} else {
|
|
383
|
-
var url
|
|
384
|
-
|
|
383
|
+
var url;
|
|
384
|
+
try {
|
|
385
|
+
url = new URL(options.url);
|
|
386
|
+
} catch(e) {
|
|
385
387
|
var error = new Error('Invalid url.');
|
|
386
388
|
error.details = {
|
|
387
389
|
url: options.url
|
|
@@ -389,9 +391,9 @@ xhrApi.create = function(options) {
|
|
|
389
391
|
}
|
|
390
392
|
|
|
391
393
|
// find client
|
|
392
|
-
if(url.
|
|
394
|
+
if(url.origin in _clients) {
|
|
393
395
|
// client found
|
|
394
|
-
_state.client = _clients[url.
|
|
396
|
+
_state.client = _clients[url.origin];
|
|
395
397
|
} else {
|
|
396
398
|
// create client
|
|
397
399
|
_state.client = http.createClient({
|
|
@@ -409,7 +411,7 @@ xhrApi.create = function(options) {
|
|
|
409
411
|
getPrivateKey: options.getPrivateKey,
|
|
410
412
|
getSignature: options.getSignature
|
|
411
413
|
});
|
|
412
|
-
_clients[url.
|
|
414
|
+
_clients[url.origin] = _state.client;
|
|
413
415
|
}
|
|
414
416
|
}
|
|
415
417
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-forge",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.",
|
|
5
5
|
"homepage": "https://github.com/digitalbazaar/forge",
|
|
6
6
|
"author": {
|
|
@@ -15,31 +15,32 @@
|
|
|
15
15
|
"Christoph Dorn <christoph@christophdorn.com>"
|
|
16
16
|
],
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"browserify": "^16.
|
|
18
|
+
"browserify": "^16.5.2",
|
|
19
19
|
"commander": "^2.20.0",
|
|
20
|
-
"cross-env": "^5.1
|
|
21
|
-
"eslint": "^
|
|
22
|
-
"eslint-config-digitalbazaar": "^2.
|
|
20
|
+
"cross-env": "^5.2.1",
|
|
21
|
+
"eslint": "^7.27.0",
|
|
22
|
+
"eslint-config-digitalbazaar": "^2.8.0",
|
|
23
23
|
"express": "^4.16.2",
|
|
24
|
-
"karma": "^
|
|
25
|
-
"karma-browserify": "^
|
|
26
|
-
"karma-chrome-launcher": "^
|
|
24
|
+
"karma": "^4.4.1",
|
|
25
|
+
"karma-browserify": "^7.0.0",
|
|
26
|
+
"karma-chrome-launcher": "^3.1.0",
|
|
27
27
|
"karma-edge-launcher": "^0.4.2",
|
|
28
|
-
"karma-firefox-launcher": "^1.
|
|
28
|
+
"karma-firefox-launcher": "^1.3.0",
|
|
29
29
|
"karma-ie-launcher": "^1.0.0",
|
|
30
30
|
"karma-mocha": "^1.3.0",
|
|
31
31
|
"karma-mocha-reporter": "^2.2.5",
|
|
32
32
|
"karma-safari-launcher": "^1.0.0",
|
|
33
|
-
"karma-sauce-launcher": "^
|
|
34
|
-
"karma-sourcemap-loader": "^0.3.
|
|
33
|
+
"karma-sauce-launcher": "^2.0.2",
|
|
34
|
+
"karma-sourcemap-loader": "^0.3.8",
|
|
35
35
|
"karma-tap-reporter": "0.0.6",
|
|
36
|
-
"karma-webpack": "^
|
|
36
|
+
"karma-webpack": "^4.0.2",
|
|
37
37
|
"mocha": "^5.2.0",
|
|
38
38
|
"mocha-lcov-reporter": "^1.2.0",
|
|
39
39
|
"nodejs-websocket": "^1.7.1",
|
|
40
|
-
"nyc": "^
|
|
41
|
-
"opts": "^1.2.
|
|
42
|
-
"webpack": "^
|
|
40
|
+
"nyc": "^15.1.0",
|
|
41
|
+
"opts": "^1.2.7",
|
|
42
|
+
"webpack": "^4.44.1",
|
|
43
|
+
"webpack-cli": "^3.3.12",
|
|
43
44
|
"worker-loader": "^2.0.0"
|
|
44
45
|
},
|
|
45
46
|
"repository": {
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
"dist/*.min.js.map"
|
|
60
61
|
],
|
|
61
62
|
"engines": {
|
|
62
|
-
"node": ">=
|
|
63
|
+
"node": ">= 6.13.0"
|
|
63
64
|
},
|
|
64
65
|
"keywords": [
|
|
65
66
|
"aes",
|
|
@@ -94,13 +95,15 @@
|
|
|
94
95
|
"prepublish": "npm run build",
|
|
95
96
|
"build": "webpack",
|
|
96
97
|
"test-build": "webpack --config webpack-tests.config.js",
|
|
97
|
-
"test": "
|
|
98
|
+
"test": "npm run test-node",
|
|
99
|
+
"test-node": "cross-env NODE_ENV=test mocha -t 30000 -R ${REPORTER:-spec} tests/unit/index.js",
|
|
98
100
|
"test-karma": "karma start",
|
|
99
101
|
"test-karma-sauce": "karma start karma-sauce.conf",
|
|
100
102
|
"test-server": "node tests/server.js",
|
|
101
103
|
"test-server-ws": "node tests/websockets/server-ws.js",
|
|
102
104
|
"test-server-webid": "node tests/websockets/server-webid.js",
|
|
103
105
|
"coverage": "rm -rf coverage && nyc --reporter=lcov --reporter=text-summary npm test",
|
|
106
|
+
"coverage-ci": "rm -rf coverage && nyc --reporter=lcovonly npm test",
|
|
104
107
|
"coverage-report": "nyc report",
|
|
105
108
|
"lint": "eslint *.js lib/*.js tests/*.js tests/**/*.js examples/*.js flash/*.js"
|
|
106
109
|
},
|
package/lib/debug.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Debugging support for web applications.
|
|
3
|
-
*
|
|
4
|
-
* @author David I. Lehn <dlehn@digitalbazaar.com>
|
|
5
|
-
*
|
|
6
|
-
* Copyright 2008-2013 Digital Bazaar, Inc.
|
|
7
|
-
*/
|
|
8
|
-
var forge = require('./forge');
|
|
9
|
-
|
|
10
|
-
/* DEBUG API */
|
|
11
|
-
module.exports = forge.debug = forge.debug || {};
|
|
12
|
-
|
|
13
|
-
// Private storage for debugging.
|
|
14
|
-
// Useful to expose data that is otherwise unviewable behind closures.
|
|
15
|
-
// NOTE: remember that this can hold references to data and cause leaks!
|
|
16
|
-
// format is "forge._debug.<modulename>.<dataname> = data"
|
|
17
|
-
// Example:
|
|
18
|
-
// (function() {
|
|
19
|
-
// var cat = 'forge.test.Test'; // debugging category
|
|
20
|
-
// var sState = {...}; // local state
|
|
21
|
-
// forge.debug.set(cat, 'sState', sState);
|
|
22
|
-
// })();
|
|
23
|
-
forge.debug.storage = {};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Gets debug data. Omit name for all cat data Omit name and cat for
|
|
27
|
-
* all data.
|
|
28
|
-
*
|
|
29
|
-
* @param cat name of debugging category.
|
|
30
|
-
* @param name name of data to get (optional).
|
|
31
|
-
* @return object with requested debug data or undefined.
|
|
32
|
-
*/
|
|
33
|
-
forge.debug.get = function(cat, name) {
|
|
34
|
-
var rval;
|
|
35
|
-
if(typeof(cat) === 'undefined') {
|
|
36
|
-
rval = forge.debug.storage;
|
|
37
|
-
} else if(cat in forge.debug.storage) {
|
|
38
|
-
if(typeof(name) === 'undefined') {
|
|
39
|
-
rval = forge.debug.storage[cat];
|
|
40
|
-
} else {
|
|
41
|
-
rval = forge.debug.storage[cat][name];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return rval;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Sets debug data.
|
|
49
|
-
*
|
|
50
|
-
* @param cat name of debugging category.
|
|
51
|
-
* @param name name of data to set.
|
|
52
|
-
* @param data data to set.
|
|
53
|
-
*/
|
|
54
|
-
forge.debug.set = function(cat, name, data) {
|
|
55
|
-
if(!(cat in forge.debug.storage)) {
|
|
56
|
-
forge.debug.storage[cat] = {};
|
|
57
|
-
}
|
|
58
|
-
forge.debug.storage[cat][name] = data;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Clears debug data. Omit name for all cat data. Omit name and cat for
|
|
63
|
-
* all data.
|
|
64
|
-
*
|
|
65
|
-
* @param cat name of debugging category.
|
|
66
|
-
* @param name name of data to clear or omit to clear entire category.
|
|
67
|
-
*/
|
|
68
|
-
forge.debug.clear = function(cat, name) {
|
|
69
|
-
if(typeof(cat) === 'undefined') {
|
|
70
|
-
forge.debug.storage = {};
|
|
71
|
-
} else if(cat in forge.debug.storage) {
|
|
72
|
-
if(typeof(name) === 'undefined') {
|
|
73
|
-
delete forge.debug.storage[cat];
|
|
74
|
-
} else {
|
|
75
|
-
delete forge.debug.storage[cat][name];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|