@blamejs/pki 0.8.61 → 0.9.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 +24 -0
- package/README.md +7 -0
- package/index.js +55 -26
- package/lib/acme.js +5 -5
- package/lib/asn1-der.js +1 -1
- package/lib/attrcert-sign.js +2 -2
- package/lib/cbor-det.js +4 -1
- package/lib/cmc-build.js +1 -1
- package/lib/cmp-build.js +5 -5
- package/lib/cmp-session.js +6 -3
- package/lib/cmp-verify.js +1 -1
- package/lib/cms-compress.js +5 -2
- package/lib/cms-decrypt.js +2 -2
- package/lib/cms-encrypt.js +2 -2
- package/lib/cms-sign.js +2 -2
- package/lib/crl-sign.js +3 -3
- package/lib/crmf-sign.js +1 -1
- package/lib/csr-sign.js +1 -1
- package/lib/ct.js +14 -13
- package/lib/est.js +12 -12
- package/lib/framework-error.js +1 -1
- package/lib/guard-bytes.js +1 -1
- package/lib/guard-limits.js +3 -2
- package/lib/hpke.js +2 -2
- package/lib/http-retry-after.js +4 -1
- package/lib/http-transport.js +6 -6
- package/lib/inspect.js +9 -4
- package/lib/jose.js +3 -3
- package/lib/merkle.js +4 -4
- package/lib/ocsp.js +2 -2
- package/lib/path-validate.js +3 -3
- package/lib/pbes2.js +8 -4
- package/lib/pkcs12-build.js +5 -5
- package/lib/scep.js +1 -1
- package/lib/schema-engine.js +12 -12
- package/lib/schema-pkix.js +12 -12
- package/lib/sign-scheme.js +2 -2
- package/lib/sigstore.js +1 -1
- package/lib/smime.js +11 -7
- package/lib/tlog.js +2 -2
- package/lib/tls-cert-compress.js +3 -3
- package/lib/tsp-sign.js +6 -6
- package/lib/tuf.js +3 -3
- package/lib/webauthn-mds.js +1 -1
- package/lib/webauthn.js +1 -1
- package/lib/x509-sign.js +3 -3
- package/package.json +1 -1
- package/sbom.cdx.json +6 -6
package/lib/schema-pkix.js
CHANGED
|
@@ -330,7 +330,7 @@ function _blockCap(given, ceiling, what, PemError) {
|
|
|
330
330
|
* label is the only thing separating a CERTIFICATE from a TRUSTED CERTIFICATE or a PRIVATE KEY, and
|
|
331
331
|
* the byte offset it started at, so a fault in a file of hundreds names the one object it is about. */
|
|
332
332
|
function pemDecodeBundle(text, opts, PemError, detect) {
|
|
333
|
-
opts = opts ||
|
|
333
|
+
opts = opts || _create(null);
|
|
334
334
|
var maxBlocks = _blockCap(opts.maxBlocks, constants.LIMITS.PEM_MAX_BLOCKS, "maxBlocks", PemError);
|
|
335
335
|
var maxDecoded = _blockCap(opts.maxDecodedBytes, constants.LIMITS.PEM_MAX_DECODED_BYTES, "maxDecodedBytes", PemError);
|
|
336
336
|
var route = opts.route === true;
|
|
@@ -739,7 +739,7 @@ function versionReader(ns, accept) {
|
|
|
739
739
|
}
|
|
740
740
|
|
|
741
741
|
function algorithmIdentifier(ns, opts) {
|
|
742
|
-
opts = opts ||
|
|
742
|
+
opts = opts || _create(null);
|
|
743
743
|
return schema.seq([
|
|
744
744
|
schema.field("algorithm", schema.oidLeaf()),
|
|
745
745
|
schema.optional("parameters", schema.any(), { whenAny: true }),
|
|
@@ -761,7 +761,7 @@ function algorithmIdentifier(ns, opts) {
|
|
|
761
761
|
* (RFC 5652 sec. 10.2.4). CMS names the type and RFC 9763 sec. 3.1 reuses it inside a CSR attribute,
|
|
762
762
|
* so the shape is defined once and each caller supplies its own code and name for the refusal. */
|
|
763
763
|
function issuerAndSerialNumber(ns, opts) {
|
|
764
|
-
opts = opts ||
|
|
764
|
+
opts = opts || _create(null);
|
|
765
765
|
return schema.seq([
|
|
766
766
|
schema.field("issuer", name(ns)),
|
|
767
767
|
schema.field("serialNumber", schema.integerLeaf()),
|
|
@@ -952,7 +952,7 @@ function relativeDistinguishedName(ns) {
|
|
|
952
952
|
return schema.setOf(attributeTypeAndValue(ns), { assert: "set", min: 1, code: ns.prefix + "/bad-rdn", what: "RelativeDistinguishedName" });
|
|
953
953
|
}
|
|
954
954
|
function name(ns, opts) {
|
|
955
|
-
opts = opts ||
|
|
955
|
+
opts = opts || _create(null);
|
|
956
956
|
function nameBuild(m) {
|
|
957
957
|
var rdns = [], parts = [];
|
|
958
958
|
_forEach(m.items, function (rdnItem) {
|
|
@@ -978,7 +978,7 @@ function name(ns, opts) {
|
|
|
978
978
|
}
|
|
979
979
|
|
|
980
980
|
function generalizedTime(ns, opts) {
|
|
981
|
-
opts = opts ||
|
|
981
|
+
opts = opts || _create(null);
|
|
982
982
|
var code = opts.code || (ns.prefix + "/bad-time");
|
|
983
983
|
var message = opts.message || "the time must be a GeneralizedTime";
|
|
984
984
|
var readOpts = opts.allowFractional ? { allowFractional: true } : undefined;
|
|
@@ -991,7 +991,7 @@ function generalizedTime(ns, opts) {
|
|
|
991
991
|
}
|
|
992
992
|
|
|
993
993
|
function utf8Text(ns, opts) {
|
|
994
|
-
opts = opts ||
|
|
994
|
+
opts = opts || _create(null);
|
|
995
995
|
var code = opts.code || (ns.prefix + "/bad-freetext");
|
|
996
996
|
var message = opts.message || "the element must be a UTF8String";
|
|
997
997
|
return schema.decode(function (n, ctx) {
|
|
@@ -1003,7 +1003,7 @@ function utf8Text(ns, opts) {
|
|
|
1003
1003
|
}
|
|
1004
1004
|
|
|
1005
1005
|
function rawNonEmptySequence(ns, opts) {
|
|
1006
|
-
opts = opts ||
|
|
1006
|
+
opts = opts || _create(null);
|
|
1007
1007
|
var code = opts.code || (ns.prefix + "/bad-sequence");
|
|
1008
1008
|
var message = opts.message || "expected a non-empty universal SEQUENCE";
|
|
1009
1009
|
return schema.decode(function (n, ctx) {
|
|
@@ -1069,7 +1069,7 @@ var GN_IA5 = _assign(_create(null), { 1: 1, 2: 1, 6: 1 });
|
|
|
1069
1069
|
var DIRECTORY_STRING_TAGS = [asn1.TAGS.UTF8_STRING, asn1.TAGS.PRINTABLE_STRING, asn1.TAGS.TELETEX_STRING,
|
|
1070
1070
|
asn1.TAGS.UNIVERSAL_STRING, asn1.TAGS.BMP_STRING];
|
|
1071
1071
|
function generalName(ns, opts) {
|
|
1072
|
-
opts = opts ||
|
|
1072
|
+
opts = opts || _create(null);
|
|
1073
1073
|
var code = opts.code || (ns.prefix + "/bad-general-name");
|
|
1074
1074
|
var decodeValue = opts.decodeValue === true;
|
|
1075
1075
|
var subtreeBase = opts.subtreeBase === true;
|
|
@@ -1165,7 +1165,7 @@ function generalName(ns, opts) {
|
|
|
1165
1165
|
}
|
|
1166
1166
|
|
|
1167
1167
|
function generalNames(ns, opts) {
|
|
1168
|
-
opts = opts ||
|
|
1168
|
+
opts = opts || _create(null);
|
|
1169
1169
|
var code = opts.code || (ns.prefix + "/bad-general-names");
|
|
1170
1170
|
var gn = generalName(ns, { code: code, decodeValue: opts.decodeValue === true, subtreeBase: opts.subtreeBase === true });
|
|
1171
1171
|
function build(m) { return { names: _map(m.items, function (it) { return it.value; }), bytes: m.node.bytes }; }
|
|
@@ -2528,7 +2528,7 @@ function extension(ns) {
|
|
|
2528
2528
|
});
|
|
2529
2529
|
}
|
|
2530
2530
|
function extensions(ns, opts) {
|
|
2531
|
-
opts = opts ||
|
|
2531
|
+
opts = opts || _create(null);
|
|
2532
2532
|
var EXT = extension(ns);
|
|
2533
2533
|
var extOpts = {
|
|
2534
2534
|
min: 1, code: ns.prefix + "/bad-extensions", what: "Extensions",
|
|
@@ -2540,7 +2540,7 @@ function extensions(ns, opts) {
|
|
|
2540
2540
|
}
|
|
2541
2541
|
|
|
2542
2542
|
function spki(ns, opts) {
|
|
2543
|
-
opts = opts ||
|
|
2543
|
+
opts = opts || _create(null);
|
|
2544
2544
|
return schema.seq([
|
|
2545
2545
|
schema.field("algorithm", algorithmIdentifier(ns)),
|
|
2546
2546
|
schema.field("subjectPublicKey", schema.bitString()),
|
|
@@ -2558,7 +2558,7 @@ function spki(ns, opts) {
|
|
|
2558
2558
|
}
|
|
2559
2559
|
|
|
2560
2560
|
function attribute(ns, opts) {
|
|
2561
|
-
opts = opts ||
|
|
2561
|
+
opts = opts || _create(null);
|
|
2562
2562
|
var minValues = opts.minValues === undefined ? 1 : opts.minValues;
|
|
2563
2563
|
return schema.seq([
|
|
2564
2564
|
schema.field("type", schema.oidLeaf()),
|
package/lib/sign-scheme.js
CHANGED
|
@@ -124,7 +124,7 @@ function resolveSignScheme(cert, so, noSignedAttrs, E) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
function _resolveSignScheme(cert, so, noSignedAttrs, E) {
|
|
127
|
-
so = so ||
|
|
127
|
+
so = so || intrinsic.create(null);
|
|
128
128
|
var alg = cert.subjectPublicKeyInfo.algorithm;
|
|
129
129
|
var keyOid = alg.oid;
|
|
130
130
|
var comp = compositeSig.COMPOSITE_ALGS[keyOid];
|
|
@@ -180,7 +180,7 @@ function _resolveSignScheme(cert, so, noSignedAttrs, E) {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
function _assertKeyMatchesScheme(key, imp, E, what) {
|
|
183
|
-
var ka = key.algorithm ||
|
|
183
|
+
var ka = key.algorithm || intrinsic.create(null);
|
|
184
184
|
var subject = what || "CryptoKey";
|
|
185
185
|
if (_toUpperCase(_String(ka.name)) !== _toUpperCase(_String(imp.name))) {
|
|
186
186
|
var hint = (_toUpperCase(_String(ka.name)) === "RSA-PSS" && _toUpperCase(_String(imp.name)) === "RSASSA-PKCS1-V1_5")
|
package/lib/sigstore.js
CHANGED
|
@@ -1715,7 +1715,7 @@ async function verifyBundle(bundle, opts) {
|
|
|
1715
1715
|
if (bundle === null || typeof bundle !== "object" && typeof bundle !== "string" && !_isBuffer(bundle)) {
|
|
1716
1716
|
throw new TypeError("verifyBundle: bundle must be an object, JSON string, or Buffer");
|
|
1717
1717
|
}
|
|
1718
|
-
opts = opts ||
|
|
1718
|
+
opts = opts || _create(null);
|
|
1719
1719
|
guard.identifier.assertKnownKeys(opts, _VERIFY_BUNDLE_OPTS, _err, "sigstore/bad-input", "pki.sigstore.verifyBundle has an unknown option ");
|
|
1720
1720
|
/** @internal parseBundle takes the copy, so every check below runs on plain data that cannot change
|
|
1721
1721
|
* under it, whichever field it reads and however many times. */
|
package/lib/smime.js
CHANGED
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
* algorithm-agnostic.
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
|
+
/** @internal The record constructor, captured at load, for the reason the same capture in
|
|
37
|
+
* `lib/inspect.js` gives: requiring the guard-intrinsic captures arms the module whole, which counts
|
|
38
|
+
* 176 live runtime reads here. */
|
|
39
|
+
var _create = Object.create;
|
|
36
40
|
var frameworkError = require("./framework-error.js");
|
|
37
41
|
var mime = require("./mime.js");
|
|
38
42
|
var cms = require("./cms-verify.js");
|
|
@@ -654,7 +658,7 @@ function _base64Body(der) {
|
|
|
654
658
|
*/
|
|
655
659
|
async function sign(content, signers, opts) {
|
|
656
660
|
content = _fixedContent(content);
|
|
657
|
-
opts = opts ||
|
|
661
|
+
opts = opts || _create(null);
|
|
658
662
|
opts = _knownOpts(opts, SIGN_OPTS, "sign");
|
|
659
663
|
signers = _snapshotSignersFitForMail(signers);
|
|
660
664
|
var hp = opts.protectHeaders === true;
|
|
@@ -767,7 +771,7 @@ function _capped(msg) {
|
|
|
767
771
|
* if (res.valid) { res.content; res.signers[0].sid; }
|
|
768
772
|
*/
|
|
769
773
|
async function verify(message, opts) {
|
|
770
|
-
opts = opts ||
|
|
774
|
+
opts = opts || _create(null);
|
|
771
775
|
opts = _knownOpts(opts, VERIFY_OPTS, "verify");
|
|
772
776
|
var ent = mime.parse(message, SmimeError, "smime/bad-mime");
|
|
773
777
|
var ct = ent.contentType;
|
|
@@ -877,7 +881,7 @@ function _cmsEncryptOpts(opts) {
|
|
|
877
881
|
*/
|
|
878
882
|
async function encrypt(content, recipients, opts) {
|
|
879
883
|
content = _fixedContent(content);
|
|
880
|
-
opts = opts ||
|
|
884
|
+
opts = opts || _create(null);
|
|
881
885
|
opts = _knownOpts(opts, ENCRYPT_OPTS, "encrypt");
|
|
882
886
|
var hp = opts.protectHeaders === true;
|
|
883
887
|
var hpList = hp ? _hpHeaderList(opts.headers) : null;
|
|
@@ -934,7 +938,7 @@ async function encrypt(content, recipients, opts) {
|
|
|
934
938
|
* res.authenticated; // true here (an AEAD content cipher); false for an enveloped-only CBC message, which carries no integrity
|
|
935
939
|
*/
|
|
936
940
|
async function decrypt(message, keyMaterial, opts) {
|
|
937
|
-
opts = opts ||
|
|
941
|
+
opts = opts || _create(null);
|
|
938
942
|
opts = _knownOpts(opts, DECRYPT_OPTS, "decrypt");
|
|
939
943
|
var ent = mime.parse(message, SmimeError, "smime/bad-mime");
|
|
940
944
|
var ct = ent.contentType;
|
|
@@ -984,7 +988,7 @@ async function decrypt(message, keyMaterial, opts) {
|
|
|
984
988
|
*/
|
|
985
989
|
async function compress(content, opts) {
|
|
986
990
|
content = _fixedContent(content);
|
|
987
|
-
opts = opts ||
|
|
991
|
+
opts = opts || _create(null);
|
|
988
992
|
opts = _knownOpts(opts, COMPRESS_OPTS, "compress");
|
|
989
993
|
var entity = _entityBytes(content, opts);
|
|
990
994
|
var cOpts = {};
|
|
@@ -1018,7 +1022,7 @@ async function compress(content, opts) {
|
|
|
1018
1022
|
* res.content; // the recovered inner MIME entity
|
|
1019
1023
|
*/
|
|
1020
1024
|
async function decompress(message, opts) {
|
|
1021
|
-
opts = opts ||
|
|
1025
|
+
opts = opts || _create(null);
|
|
1022
1026
|
opts = _knownOpts(opts, DECOMPRESS_OPTS, "decompress");
|
|
1023
1027
|
var ent = mime.parse(message, SmimeError, "smime/bad-mime");
|
|
1024
1028
|
var ct = ent.contentType;
|
|
@@ -1064,7 +1068,7 @@ var CERTS_ONLY_OPTS = Object.assign(Object.create(null), { crls: 1 });
|
|
|
1064
1068
|
* var p7c = pki.smime.buildCertsOnly([leafDer]);
|
|
1065
1069
|
*/
|
|
1066
1070
|
function buildCertsOnly(certs, opts) {
|
|
1067
|
-
opts = opts ||
|
|
1071
|
+
opts = opts || _create(null);
|
|
1068
1072
|
opts = _knownOpts(opts, CERTS_ONLY_OPTS, "buildCertsOnly");
|
|
1069
1073
|
var der = _toBuf(cms.certsOnly(certs, { crls: opts.crls }));
|
|
1070
1074
|
return _capped(Buffer.concat([_pkcs7MimeHead("certs-only", "smime.p7c"), _base64Body(der), mime.CRLF]));
|
package/lib/tlog.js
CHANGED
|
@@ -671,7 +671,7 @@ function parseCheckpoint(input) {
|
|
|
671
671
|
*/
|
|
672
672
|
var _CHECKPOINT_OPTS = _assign(_create(null), { origin: 1 });
|
|
673
673
|
async function verifyCheckpoint(input, keys, opts) {
|
|
674
|
-
opts = opts ||
|
|
674
|
+
opts = opts || _create(null);
|
|
675
675
|
guard.identifier.assertKnownKeys(opts, _CHECKPOINT_OPTS, _err,
|
|
676
676
|
"tlog/bad-input", "unknown verifyCheckpoint option ");
|
|
677
677
|
/** @internal ONE read of the caller's input, shared by the decode and the verification below. Reading
|
|
@@ -1209,7 +1209,7 @@ async function _tilePath(lo, hi, m, size, unitAt) {
|
|
|
1209
1209
|
*/
|
|
1210
1210
|
var _INCLUSION_PROOF_KEYS = _assign(_create(null), { index: 1, size: 1, read: 1 });
|
|
1211
1211
|
async function inclusionProof(opts) {
|
|
1212
|
-
opts = opts ||
|
|
1212
|
+
opts = opts || _create(null);
|
|
1213
1213
|
guard.identifier.assertKnownKeys(opts, _INCLUSION_PROOF_KEYS, _err,
|
|
1214
1214
|
"tlog/bad-input", "unknown inclusionProof option ");
|
|
1215
1215
|
var size = guard.range.uint64(opts.size, _err, "tlog/bad-input", "size");
|
package/lib/tls-cert-compress.js
CHANGED
|
@@ -167,7 +167,7 @@ function _resolveAllowed(opts) {
|
|
|
167
167
|
* pki.schema.x509.parse(out.certificate.entries[0].certData).subject;
|
|
168
168
|
*/
|
|
169
169
|
function decompressCertificate(bytes, opts) {
|
|
170
|
-
opts = opts ||
|
|
170
|
+
opts = opts || intrinsic.create(null);
|
|
171
171
|
/** @internal Viewed, CAPPED, then COPIED, and only then are the options read. A view stays a window
|
|
172
172
|
* onto the caller's buffer, and `_resolveCap` reads `opts`, which is caller code when it is an
|
|
173
173
|
* accessor: a `maxOutputBytes` getter that wrote another valid message of the same length over the
|
|
@@ -262,7 +262,7 @@ function decompressCertificate(bytes, opts) {
|
|
|
262
262
|
* pki.schema.x509.parse(msg.entries[0].certData).subject;
|
|
263
263
|
*/
|
|
264
264
|
function parseCertificateMessage(bytes, opts) {
|
|
265
|
-
opts = opts ||
|
|
265
|
+
opts = opts || intrinsic.create(null);
|
|
266
266
|
var type = opts.certificateType === undefined ? "X509" : opts.certificateType;
|
|
267
267
|
if (type !== "X509" && type !== "RawPublicKey") {
|
|
268
268
|
throw _err("tls/bad-input", "opts.certificateType must be \"X509\" or \"RawPublicKey\"");
|
|
@@ -315,7 +315,7 @@ function parseCertificateMessage(bytes, opts) {
|
|
|
315
315
|
* wire.length < message.length; // true
|
|
316
316
|
*/
|
|
317
317
|
function compressCertificate(certificateMessage, opts) {
|
|
318
|
-
opts = opts ||
|
|
318
|
+
opts = opts || intrinsic.create(null);
|
|
319
319
|
/** @internal Copied, not viewed. `opts.algorithm` is read below, and reading an option is caller code
|
|
320
320
|
* when it is an accessor, so over a view it would run between the message being looked at and being
|
|
321
321
|
* compressed and replace what this verb compresses, after it had accepted the message it was handed.
|
package/lib/tsp-sign.js
CHANGED
|
@@ -155,7 +155,7 @@ var _SIGN_OPTS = intrinsic.assign(intrinsic.create(null), {
|
|
|
155
155
|
});
|
|
156
156
|
|
|
157
157
|
function _sign(messageImprint, tsa, opts) {
|
|
158
|
-
opts = opts ||
|
|
158
|
+
opts = opts || intrinsic.create(null);
|
|
159
159
|
if (messageImprint && typeof messageImprint === "object" && !Buffer.isBuffer(messageImprint)) {
|
|
160
160
|
guard.identifier.assertKnownKeys(messageImprint, _IMPRINT_KEYS, _err, "tsp/bad-input", function (k) {
|
|
161
161
|
return "unknown messageImprint field " + JSON.stringify(k) + " (the imprint is { hashAlgorithm, hashedMessage })";
|
|
@@ -169,7 +169,7 @@ function _sign(messageImprint, tsa, opts) {
|
|
|
169
169
|
" (the TSA is { cert, key }; a signing option belongs in the third argument)";
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
var mi = messageImprint ||
|
|
172
|
+
var mi = messageImprint || intrinsic.create(null);
|
|
173
173
|
if (!mi.hashAlgorithm || !NODE_DIGEST[guard.text.keyOf(mi.hashAlgorithm)]) throw _err("tsp/unsupported-algorithm", "messageImprint.hashAlgorithm must be a supported hash name");
|
|
174
174
|
if (!guard.bytes.isByteSource(mi.hashedMessage)) throw _err("tsp/bad-input", "messageImprint.hashedMessage must be a BufferSource");
|
|
175
175
|
var _signHmLen = guard.bytes.source(mi.hashedMessage, TspError, "tsp/bad-input", "messageImprint.hashedMessage").length;
|
|
@@ -292,10 +292,10 @@ function _assertImprint(mi) {
|
|
|
292
292
|
var _REQUEST_OPTS = intrinsic.assign(intrinsic.create(null), { reqPolicy: 1, nonce: 1, certReq: 1, extensions: 1, pem: 1 });
|
|
293
293
|
|
|
294
294
|
function request(messageImprint, opts) {
|
|
295
|
-
opts = opts ||
|
|
295
|
+
opts = opts || intrinsic.create(null);
|
|
296
296
|
if (typeof opts !== "object" || Buffer.isBuffer(opts)) throw _err("tsp/bad-input", "pki.tsp.request options must be an object");
|
|
297
297
|
guard.identifier.assertKnownKeys(opts, _REQUEST_OPTS, _err, "tsp/bad-input", "pki.tsp.request has an unknown option ");
|
|
298
|
-
var mi = messageImprint ||
|
|
298
|
+
var mi = messageImprint || intrinsic.create(null);
|
|
299
299
|
if (mi && typeof mi === "object" && !Buffer.isBuffer(mi)) {
|
|
300
300
|
guard.identifier.assertKnownKeys(mi, _IMPRINT_KEYS, _err, "tsp/bad-input", function (k) {
|
|
301
301
|
return "unknown messageImprint field " + JSON.stringify(k) +
|
|
@@ -379,7 +379,7 @@ function parseRequest(input) { return schemaTsp.parseRequest(input); }
|
|
|
379
379
|
var _RESPONSE_OPTS = intrinsic.assign(intrinsic.create(null), { status: 1, statusString: 1, failInfo: 1, pem: 1 });
|
|
380
380
|
|
|
381
381
|
function response(token, opts) {
|
|
382
|
-
opts = opts ||
|
|
382
|
+
opts = opts || intrinsic.create(null);
|
|
383
383
|
if (typeof opts !== "object" || Buffer.isBuffer(opts)) throw _err("tsp/bad-input", "pki.tsp.response options must be an object");
|
|
384
384
|
guard.identifier.assertKnownKeys(opts, _RESPONSE_OPTS, _err, "tsp/bad-input", "pki.tsp.response has an unknown option ");
|
|
385
385
|
var st = opts.status;
|
|
@@ -664,7 +664,7 @@ function _anyCritical(extensions) {
|
|
|
664
664
|
}
|
|
665
665
|
|
|
666
666
|
async function verify(token, data, opts) {
|
|
667
|
-
opts = opts ||
|
|
667
|
+
opts = opts || intrinsic.create(null);
|
|
668
668
|
if (typeof opts !== "object" || Buffer.isBuffer(opts)) throw _err("tsp/bad-input", "pki.tsp.verify options must be an object");
|
|
669
669
|
guard.identifier.assertKnownKeys(opts, _VERIFY_OPTS, _err, "tsp/bad-input",
|
|
670
670
|
"pki.tsp.verify has an unknown option (the anchor option is `trustAnchors`) ");
|
package/lib/tuf.js
CHANGED
|
@@ -804,7 +804,7 @@ function _checkedPublicKey(key, d) {
|
|
|
804
804
|
guard.text.showValue(importedType) + " public key, so the signature would be checked " +
|
|
805
805
|
"under an algorithm the metadata does not name");
|
|
806
806
|
}
|
|
807
|
-
var details = guard.crypto.keyDetails(imported) ||
|
|
807
|
+
var details = guard.crypto.keyDetails(imported) || _create(null);
|
|
808
808
|
if (d.curve !== null && details.namedCurve !== d.curve) {
|
|
809
809
|
throw _err("tuf/bad-key", "the scheme " + key.scheme + " names the " + d.curve +
|
|
810
810
|
" curve; the key is on " + guard.text.showValue(details.namedCurve));
|
|
@@ -889,7 +889,7 @@ function _publicFromPem(pem, label) {
|
|
|
889
889
|
*/
|
|
890
890
|
var _VERIFY_KEYS = intrinsic.assign(_create(null), { metadata: 1, keys: 1, role: 1 });
|
|
891
891
|
async function verifySignatures(opts) {
|
|
892
|
-
opts = opts ||
|
|
892
|
+
opts = opts || _create(null);
|
|
893
893
|
guard.identifier.assertKnownKeys(opts, _VERIFY_KEYS, _err, "tuf/bad-input", "unknown verifySignatures option ");
|
|
894
894
|
/** @internal Every caller-owned input is taken ONCE, at the top, and everything below reads the copy.
|
|
895
895
|
* Validating the caller's object and then reading it again is two reads, and a member reached through an
|
|
@@ -1297,7 +1297,7 @@ function _asRoot(input, label) {
|
|
|
1297
1297
|
*/
|
|
1298
1298
|
var _UPDATE_KEYS = intrinsic.assign(_create(null), { trustedRoot: 1, candidates: 1, now: 1 });
|
|
1299
1299
|
async function updateRoot(opts) {
|
|
1300
|
-
opts = opts ||
|
|
1300
|
+
opts = opts || _create(null);
|
|
1301
1301
|
guard.identifier.assertKnownKeys(opts, _UPDATE_KEYS, _err, "tuf/bad-input", "unknown updateRoot option ");
|
|
1302
1302
|
/** @internal The instant is CAPTURED here, at the call, into a Date this function owns. A Date is
|
|
1303
1303
|
* mutable and the caller keeps theirs, and the freeze-attack check runs at the END, after a signature
|
package/lib/webauthn-mds.js
CHANGED
|
@@ -318,7 +318,7 @@ function _verifyMetadataBlob(blob, opts) {
|
|
|
318
318
|
});
|
|
319
319
|
var leaf = chain[0];
|
|
320
320
|
_assertLeafSigns(leaf);
|
|
321
|
-
var leafAlg = (leaf.subjectPublicKeyInfo.algorithm ||
|
|
321
|
+
var leafAlg = (leaf.subjectPublicKeyInfo.algorithm || intrinsic.create(null)).name;
|
|
322
322
|
var leafSchemes = typeof leafAlg === "string" ? LEAF_SCHEMES_BY_SPKI_ALG[leafAlg] : undefined;
|
|
323
323
|
if (!leafSchemes || !leafSchemes[algRow.scheme]) {
|
|
324
324
|
throw _err("webauthn/unsupported-algorithm", "the metadata BLOB alg " + header.alg + " does not match the x5c leaf key type " + intrinsic.stringify(leafAlg));
|
package/lib/webauthn.js
CHANGED
|
@@ -268,7 +268,7 @@ function _certKeyAlgNames(cose) {
|
|
|
268
268
|
return [];
|
|
269
269
|
}
|
|
270
270
|
function _assertCertKeyAlgorithm(cert, cose, E) {
|
|
271
|
-
var alg = (cert.subjectPublicKeyInfo && cert.subjectPublicKeyInfo.algorithm) ||
|
|
271
|
+
var alg = (cert.subjectPublicKeyInfo && cert.subjectPublicKeyInfo.algorithm) || intrinsic.create(null);
|
|
272
272
|
var want = _certKeyAlgNames(cose);
|
|
273
273
|
if (!want.length || intrinsic.indexOf(want, alg.name) < 0) {
|
|
274
274
|
throw E("webauthn/key-mismatch", "the attestation certificate carries a " + intrinsic.stringify(alg.name) +
|
package/lib/x509-sign.js
CHANGED
|
@@ -166,7 +166,7 @@ var RESERVED_ALT_EXTS = intrinsic.assign(intrinsic.create(null), (function () {
|
|
|
166
166
|
})());
|
|
167
167
|
|
|
168
168
|
function _buildExtensions(extSpec, ctx) {
|
|
169
|
-
if (extSpec == null) extSpec =
|
|
169
|
+
if (extSpec == null) extSpec = intrinsic.create(null);
|
|
170
170
|
if (_isArray(extSpec)) {
|
|
171
171
|
var seenExt = intrinsic.create(null), arrCa = false, arrKeyCertSign = false, arrPathLen = false, arrNameConstraints = false;
|
|
172
172
|
var oidBc = O("basicConstraints"), oidKu = O("keyUsage"), oidNc = O("nameConstraints"), oidPm = O("policyMappings");
|
|
@@ -708,9 +708,9 @@ function sign(spec, issuer, opts) {
|
|
|
708
708
|
}
|
|
709
709
|
|
|
710
710
|
function _sign(spec, issuer, opts) {
|
|
711
|
-
opts = opts ||
|
|
711
|
+
opts = opts || intrinsic.create(null);
|
|
712
712
|
if (!spec || typeof spec !== "object" || Buffer.isBuffer(spec)) throw _err("x509/bad-input", "the certificate spec must be an object");
|
|
713
|
-
issuer = issuer ||
|
|
713
|
+
issuer = issuer || intrinsic.create(null);
|
|
714
714
|
guard.identifier.assertKnownKeys(spec, KNOWN_SPEC_KEYS, _err, "x509/bad-input", function (k) {
|
|
715
715
|
return "unknown certificate spec field " + JSON.stringify(k) +
|
|
716
716
|
(k === "issuer" ? "; the issuer is the SECOND argument to pki.x509.sign, not a spec field" : "") +
|
package/package.json
CHANGED
package/sbom.cdx.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
|
|
3
3
|
"bomFormat": "CycloneDX",
|
|
4
4
|
"specVersion": "1.5",
|
|
5
|
-
"serialNumber": "urn:uuid:
|
|
5
|
+
"serialNumber": "urn:uuid:f52bf92f-41f7-4879-bff9-6077f2cf84f5",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-10-
|
|
8
|
+
"timestamp": "2026-10-08T01:34:26.318Z",
|
|
9
9
|
"lifecycles": [
|
|
10
10
|
{
|
|
11
11
|
"phase": "build"
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
}
|
|
20
20
|
],
|
|
21
21
|
"component": {
|
|
22
|
-
"bom-ref": "@blamejs/pki@0.
|
|
22
|
+
"bom-ref": "@blamejs/pki@0.9.0",
|
|
23
23
|
"type": "application",
|
|
24
24
|
"name": "pki",
|
|
25
|
-
"version": "0.
|
|
25
|
+
"version": "0.9.0",
|
|
26
26
|
"scope": "required",
|
|
27
27
|
"author": "blamejs contributors",
|
|
28
28
|
"description": "Pure-JavaScript PKI toolkit that owns its stack — X.509, ASN.1/DER, CMS, PQC-first.",
|
|
29
|
-
"purl": "pkg:npm/%40blamejs/pki@0.
|
|
29
|
+
"purl": "pkg:npm/%40blamejs/pki@0.9.0",
|
|
30
30
|
"properties": [],
|
|
31
31
|
"externalReferences": [
|
|
32
32
|
{
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"components": [],
|
|
55
55
|
"dependencies": [
|
|
56
56
|
{
|
|
57
|
-
"ref": "@blamejs/pki@0.
|
|
57
|
+
"ref": "@blamejs/pki@0.9.0",
|
|
58
58
|
"dependsOn": []
|
|
59
59
|
}
|
|
60
60
|
]
|