@blamejs/pki 0.5.22 → 0.5.23

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 CHANGED
@@ -4,7 +4,20 @@ All notable changes to `@blamejs/pki` are documented here. The format
4
4
  follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this
5
5
  project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## v0.5.22 — 2026-08-21
7
+ ## v0.5.23 — 2026-08-21
8
+
9
+ The tables that decide which status codes, revocation reasons, trust bits and extensions this toolkit recognizes now answer from an operation taken at load, and an unsupported HTTP Digest algorithm is refused rather than read off a prototype.
10
+
11
+ ### Changed
12
+
13
+ - Eighteen further modules -- ACME, EST, CMC, WebAuthn and its metadata reader, Certificate Transparency, trust-store ingest, TLS certificate compression, HPKE, HTTP Digest, the CRL and attribute-certificate signers, and the OCSP, CRL, attribute-certificate and shared PKIX schemas -- are held to the live-read rule, each declaring the reads it still carries as a count that can only fall.
14
+
15
+ ### Fixed
16
+
17
+ - An HTTP Digest challenge naming an unsupported algorithm is refused with a typed error. The algorithm registry was an ordinary object, so a name matching any member of `Object.prototype` answered the supported-algorithm gate with a value the registry never held: the refusal was skipped and the call ended in an untyped `TypeError`. The registry now carries a null prototype.
18
+ - OCSP response statuses and revocation reasons, CRL reason codes, CCADB trust bits, attribute-certificate critical extensions and object-digest types, Certificate Transparency log states, and the repeated-parameter check on an HTTP Digest challenge all decide membership through a captured operation, so replacing the runtime's own membership test after load cannot widen what they accept.
19
+
20
+ ## v0.5.22 — 2026-08-20
8
21
 
9
22
  The list tests that decide whether a caller's argument is refused, and which form an extension spec is in, now answer from operations taken at load rather than read when they run.
10
23
 
package/lib/acme.js CHANGED
@@ -49,6 +49,11 @@ var frameworkError = require("./framework-error");
49
49
  var httpTransport = require("./http-transport");
50
50
  var retryAfter = require("./http-retry-after");
51
51
  var guard = require("./guard-all");
52
+ var intrinsic = require("./guard-intrinsic");
53
+ // Membership is asked through an operation taken at load. Written out, the question reads two
54
+ // replaceable properties to answer one thing, and either answering wrongly changes whether a field
55
+ // counts as present in a document this client is deciding how to act on.
56
+ var _hasOwn = intrinsic.hasOwn;
52
57
  var pkgVersion = require("../package.json").version;
53
58
 
54
59
  var AcmeError = frameworkError.AcmeError;
@@ -211,7 +216,7 @@ function _validate(kind, obj) {
211
216
  var spec = SPECS[kind];
212
217
  for (var f = 0; f < spec.length; f++) {
213
218
  var field = spec[f];
214
- var present = Object.prototype.hasOwnProperty.call(obj, field.name);
219
+ var present = _hasOwn(obj, field.name);
215
220
  var required = field.required || (field.requiredWhen && field.requiredWhen(obj));
216
221
  if (!present) {
217
222
  if (required) throw E("acme/missing-field", "an ACME " + kind + " is missing the required field " + JSON.stringify(field.name));
@@ -383,9 +388,9 @@ var ERROR_NAMESPACE = "urn:ietf:params:acme:error:";
383
388
  */
384
389
  function validateProblem(obj) {
385
390
  if (!_isObject(obj)) throw E("acme/bad-problem", "a problem document must be a JSON object");
386
- if (Object.prototype.hasOwnProperty.call(obj, "identifier")) throw E("acme/bad-problem", "a top-level problem document must not carry an identifier (RFC 8555 sec. 6.7.1)");
391
+ if (_hasOwn(obj, "identifier")) throw E("acme/bad-problem", "a top-level problem document must not carry an identifier (RFC 8555 sec. 6.7.1)");
387
392
  if (!_isString(obj.type) || obj.type.indexOf(ERROR_NAMESPACE) !== 0) throw E("acme/bad-problem", "an ACME problem type must be in the " + ERROR_NAMESPACE + " namespace (RFC 8555 sec. 6.7)");
388
- if (Object.prototype.hasOwnProperty.call(obj, "subproblems")) {
393
+ if (_hasOwn(obj, "subproblems")) {
389
394
  if (!Array.isArray(obj.subproblems)) throw E("acme/bad-problem", "subproblems must be an array");
390
395
  for (var i = 0; i < obj.subproblems.length; i++) {
391
396
  var sub = obj.subproblems[i];
@@ -393,7 +398,7 @@ function validateProblem(obj) {
393
398
  // A subproblem identifier reflects a submitted order identifier, which MAY be a
394
399
  // wildcard (a rejectedIdentifier for a *.example.org order), so it is validated
395
400
  // with the order-identifier rule, not the stricter authorization one.
396
- if (Object.prototype.hasOwnProperty.call(sub, "identifier")) _validateOrderIdentifier(sub.identifier);
401
+ if (_hasOwn(sub, "identifier")) _validateOrderIdentifier(sub.identifier);
397
402
  }
398
403
  }
399
404
  return obj;
@@ -455,7 +460,7 @@ function validate(kind, obj) {
455
460
  */
456
461
  function identify(obj) {
457
462
  if (!_isObject(obj)) return "unknown";
458
- var has = function (k) { return Object.prototype.hasOwnProperty.call(obj, k); };
463
+ var has = function (k) { return _hasOwn(obj, k); };
459
464
  if (has("protected") && has("signature") && _isString(obj.protected) && _isString(obj.signature)) return "jws";
460
465
  if (_isString(obj.type) && obj.type.indexOf(ERROR_NAMESPACE) === 0) return "problem";
461
466
  if (has("newNonce") && has("newAccount")) return "directory";
@@ -677,8 +682,8 @@ async function verifyTlsAlpn01(certDer, token, accountJwk, identifier) {
677
682
  // `url`, and either `kid` (an account URL) or `jwk` (an embedded public JWK).
678
683
  function _outerHeader(o) {
679
684
  var h = { alg: o.alg, nonce: o.nonce, url: o.url };
680
- if (Object.prototype.hasOwnProperty.call(o, "kid")) h.kid = o.kid;
681
- if (Object.prototype.hasOwnProperty.call(o, "jwk")) h.jwk = o.jwk;
685
+ if (_hasOwn(o, "kid")) h.kid = o.kid;
686
+ if (_hasOwn(o, "jwk")) h.jwk = o.jwk;
682
687
  return h;
683
688
  }
684
689
  function _payloadBuf(obj) {
@@ -1113,8 +1118,8 @@ function revokeCert(o) {
1113
1118
  return _promised(function () {
1114
1119
  if (!_isObject(o) || !Buffer.isBuffer(o.certificate)) throw E("acme/bad-input", "revokeCert requires a DER certificate Buffer (opts.certificate)");
1115
1120
  x509.parse(o.certificate); // structural validation of the target
1116
- var hasKid = Object.prototype.hasOwnProperty.call(o, "kid");
1117
- var hasJwk = Object.prototype.hasOwnProperty.call(o, "jwk");
1121
+ var hasKid = _hasOwn(o, "kid");
1122
+ var hasJwk = _hasOwn(o, "jwk");
1118
1123
  if (hasKid === hasJwk) throw E("acme/bad-input", "revokeCert must be signed with EXACTLY ONE of the account kid or the certificate jwk (RFC 8555 sec. 7.6)");
1119
1124
  var payload = { certificate: jose.base64url.encode(o.certificate) };
1120
1125
  if (o.reason !== undefined) {
@@ -1675,7 +1680,7 @@ function _parseLinkValue(raw) {
1675
1680
  // unresolvable target fails closed as acme/bad-link. Scoped to the alternate relation the download consumes.
1676
1681
  function _parseLinkAlternates(headers, base) {
1677
1682
  var raw = null;
1678
- for (var k in headers) { if (Object.prototype.hasOwnProperty.call(headers, k) && k.toLowerCase() === "link") { raw = headers[k]; break; } }
1683
+ for (var k in headers) { if (_hasOwn(headers, k) && k.toLowerCase() === "link") { raw = headers[k]; break; } }
1679
1684
  if (raw == null) return [];
1680
1685
  var baseUrl = new URL(base), baseOrigin = baseUrl.origin, baseHref = baseUrl.href; // the download URL
1681
1686
  var fields = Array.isArray(raw) ? raw : [raw], out = [], seen = Object.create(null), totalBytes = 0;
@@ -33,6 +33,11 @@ var attrcert = require("./schema-attrcert");
33
33
  var x509 = require("./schema-x509");
34
34
  var signScheme = require("./sign-scheme");
35
35
  var guard = require("./guard-all");
36
+ var intrinsic = require("./guard-intrinsic");
37
+ // Membership is asked through an operation taken at load. Written out, the question reads two
38
+ // replaceable properties to answer one thing, and either answering true admits a name the table
39
+ // never carried -- here, an unrecognized critical extension counted as one this profile supports.
40
+ var _hasOwn = intrinsic.hasOwn;
36
41
  var pkix = require("./schema-pkix");
37
42
  var schema = require("./schema-engine");
38
43
  require("./path-validate"); // side-effect: path-validate injects its signature engine into attrcert-verify at load
@@ -373,10 +378,10 @@ function _buildAttributes(attrSpec) {
373
378
  // carrying, so BOTH extension forms meet it -- the object form and the pre-encoded array form, which
374
379
  // is the one that can name a pointer at all. `seen` is the OID-keyed set each branch already builds.
375
380
  function _assertRevocationSchemesExclusive(seen) {
376
- if (!Object.prototype.hasOwnProperty.call(seen, O("noRevAvail"))) return;
381
+ if (!_hasOwn(seen, O("noRevAvail"))) return;
377
382
  var names = Object.keys(REVOCATION_POINTERS);
378
383
  for (var i = 0; i < names.length; i++) {
379
- if (Object.prototype.hasOwnProperty.call(seen, names[i])) {
384
+ if (_hasOwn(seen, names[i])) {
380
385
  throw _err("attrcert/bad-input", "an attribute certificate must not carry both noRevAvail and a " +
381
386
  REVOCATION_POINTERS[names[i]] + " revocation pointer (RFC 5755 sec. 6)");
382
387
  }
@@ -762,7 +767,7 @@ function _unsupportedCritical(ac) {
762
767
  if (e.critical !== true) continue;
763
768
  // Own-property membership, so an extension OID that happens to name something on Object.prototype
764
769
  // cannot read as supported.
765
- if (!Object.prototype.hasOwnProperty.call(SUPPORTED_CRITICAL, e.oid)) return e.oid;
770
+ if (!_hasOwn(SUPPORTED_CRITICAL, e.oid)) return e.oid;
766
771
  // A supported OID whose value this build could not interpret is still unusable.
767
772
  if (e.decoded === null || e.decoded === undefined || e.decoded.opaque === true) return e.oid;
768
773
  }
@@ -887,7 +892,7 @@ function _fixVerifyOptions(opts) {
887
892
  var revocationStatus = null;
888
893
  if (o.revocationStatus !== undefined) {
889
894
  if (typeof o.revocationStatus !== "string" ||
890
- !Object.prototype.hasOwnProperty.call(REVOCATION_STATUS, o.revocationStatus)) {
895
+ !_hasOwn(REVOCATION_STATUS, o.revocationStatus)) {
891
896
  throw _err("attrcert/bad-input", 'pki.attrcert.verify opts.revocationStatus must be "notRevoked" or "revoked"');
892
897
  }
893
898
  revocationStatus = o.revocationStatus;
@@ -916,7 +921,7 @@ function _revocationScheme(ac) {
916
921
  var e = ac.extensions[i];
917
922
  if (e.name === "noRevAvail") out.noRevAvail = true;
918
923
  var p = REVOCATION_POINTERS[e.oid];
919
- if (p !== undefined && Object.prototype.hasOwnProperty.call(REVOCATION_POINTERS, e.oid)) out.pointer = p;
924
+ if (p !== undefined && _hasOwn(REVOCATION_POINTERS, e.oid)) out.pointer = p;
920
925
  }
921
926
  return out;
922
927
  }
package/lib/cmc-build.js CHANGED
@@ -33,6 +33,10 @@ var cmcFmt = require("./schema-cmc"); // to read the assembled message back bef
33
33
  var oid = require("./oid");
34
34
  var cmsSign = require("./cms-sign");
35
35
  var guard = require("./guard-all");
36
+ var intrinsic = require("./guard-intrinsic");
37
+ // Own-key membership through an operation taken at load. Written out, the question reads two
38
+ // replaceable properties to answer one thing, and here it decides which controls a request carries.
39
+ var _hasOwn = intrinsic.hasOwn;
36
40
  var frameworkError = require("./framework-error");
37
41
 
38
42
  var CmcError = frameworkError.CmcError;
@@ -710,7 +714,7 @@ function _copySigners(signer, owned) {
710
714
  if (!s || typeof s !== "object") return s;
711
715
  var out = {}, k;
712
716
  for (k in s) {
713
- if (!Object.prototype.hasOwnProperty.call(s, k)) continue;
717
+ if (!_hasOwn(s, k)) continue;
714
718
  out[k] = copyValue(s[k], k === "key");
715
719
  }
716
720
  return out;
@@ -725,7 +729,7 @@ function _copySigners(signer, owned) {
725
729
  if (!v || typeof v !== "object" || typeof v.type === "string") return v; // CryptoKey / scalar
726
730
  var c = {}, ck;
727
731
  for (ck in v) {
728
- if (!Object.prototype.hasOwnProperty.call(v, ck)) continue;
732
+ if (!_hasOwn(v, ck)) continue;
729
733
  var cv = v[ck];
730
734
  c[ck] = (Buffer.isBuffer(cv) || cv instanceof Uint8Array) ? _own(Buffer.from(cv), isSecret) : cv;
731
735
  }
package/lib/cmc-verify.js CHANGED
@@ -25,6 +25,10 @@ var cmc = require("./schema-cmc");
25
25
  var cmsVerify = require("./cms-verify"); // PD14: the carrier's signature MUST be verified
26
26
  var cmsDecrypt = require("./cms-decrypt"); // ... and an AuthenticatedData carrier by its MAC
27
27
  var guard = require("./guard-all");
28
+ var intrinsic = require("./guard-intrinsic");
29
+ // Own-key membership through an operation taken at load. Written out, the question reads two
30
+ // replaceable properties to answer one thing, and here it decides which controls a response carries.
31
+ var _hasOwn = intrinsic.hasOwn;
28
32
  var frameworkError = require("./framework-error");
29
33
 
30
34
  var CmcError = frameworkError.CmcError;
@@ -428,7 +432,7 @@ function _copyAnyBytes(v) {
428
432
 
429
433
  function _snapshotSent(sent) {
430
434
  var out = {}, k;
431
- for (k in sent) { if (Object.prototype.hasOwnProperty.call(sent, k)) out[k] = sent[k]; }
435
+ for (k in sent) { if (_hasOwn(sent, k)) out[k] = sent[k]; }
432
436
  // Normalized through the SAME authoring guard pki.cmc.build puts an authored
433
437
  // integer through. A Transaction Identifier is an unbounded INTEGER on the wire,
434
438
  // so one above Number.MAX_SAFE_INTEGER has already been rounded by the time it
@@ -458,7 +462,7 @@ function _snapshotSent(sent) {
458
462
  if (out.recipient && typeof out.recipient === "object") {
459
463
  var r = {}, rk;
460
464
  for (rk in out.recipient) {
461
- if (!Object.prototype.hasOwnProperty.call(out.recipient, rk)) continue;
465
+ if (!_hasOwn(out.recipient, rk)) continue;
462
466
  r[rk] = _copyAnyBytes(out.recipient[rk]);
463
467
  }
464
468
  out.recipient = r;
package/lib/cmp-verify.js CHANGED
@@ -935,9 +935,9 @@ function _fixTime(v) {
935
935
  }
936
936
  function _fixVerifyOptions(opts, made) {
937
937
  if (opts == null) opts = {}; // ONLY null / undefined -> the default empty opts (a falsy false/0/"" is a bad config, not a default)
938
- // Through the toolkit's own options door, which this verb used to skip in favor of its own two
939
- // checks. The door does the thing those could not: it REFUSES an options bag whose fields are
940
- // accessors, and refuses one that changes which fields it carries while they are read.
938
+ // Through the toolkit's own options door rather than a pair of local field checks. The door
939
+ // REFUSES an options bag whose fields are accessors, and refuses one that changes which fields it
940
+ // carries while they are read; a local check on each field it needs can do neither.
941
941
  //
942
942
  // That is what closes this whole class rather than one member of it. An accessor is caller code
943
943
  // running inside the call, before the verb has done anything, and from there it can rewrite the
package/lib/cms-verify.js CHANGED
@@ -829,7 +829,7 @@ function _cloneAnchorValue(v, depth) {
829
829
  if (Array.isArray(v)) return v.map(function (e) { return _cloneAnchorValue(e, depth + 1); });
830
830
  var out = {}, k;
831
831
  for (k in v) {
832
- if (!Object.prototype.hasOwnProperty.call(v, k)) continue;
832
+ if (!intrinsic.hasOwn(v, k)) continue;
833
833
  out[k] = _cloneAnchorValue(v[k], depth + 1);
834
834
  }
835
835
  return out;
package/lib/crl-sign.js CHANGED
@@ -29,6 +29,11 @@ var crlSchema = require("./schema-crl");
29
29
  var x509Schema = require("./schema-x509");
30
30
  var signScheme = require("./sign-scheme");
31
31
  var guard = require("./guard-all");
32
+ var intrinsic = require("./guard-intrinsic");
33
+ // Membership is asked through an operation taken at load. Written out, the question reads two
34
+ // replaceable properties to answer one thing, and either of them answering true admits a name the
35
+ // table never carried -- here, a reason code the CRL profile does not define.
36
+ var _hasOwn = intrinsic.hasOwn;
32
37
  var frameworkError = require("./framework-error");
33
38
  var pkix = require("./schema-pkix");
34
39
  var schema = require("./schema-engine");
@@ -164,10 +169,10 @@ function _resolveReason(reason, isDelta) {
164
169
  var codeNum;
165
170
  if (typeof reason === "number") codeNum = reason;
166
171
  else if (typeof reason === "string") {
167
- if (!Object.prototype.hasOwnProperty.call(REASON_BY_NAME, reason)) throw _err("crl/bad-reason-code", "unknown CRLReason " + JSON.stringify(reason));
172
+ if (!_hasOwn(REASON_BY_NAME, reason)) throw _err("crl/bad-reason-code", "unknown CRLReason " + JSON.stringify(reason));
168
173
  codeNum = REASON_BY_NAME[reason];
169
174
  } else throw _err("crl/bad-reason-code", "reason must be a CRLReason name or number");
170
- if (!Object.prototype.hasOwnProperty.call(CRL_REASON, String(codeNum))) throw _err("crl/bad-reason-code", "undefined or reserved CRLReason " + codeNum + " (RFC 5280 sec. 5.3.1)");
175
+ if (!_hasOwn(CRL_REASON, String(codeNum))) throw _err("crl/bad-reason-code", "undefined or reserved CRLReason " + codeNum + " (RFC 5280 sec. 5.3.1)");
171
176
  if (codeNum === 8 && !isDelta) throw _err("crl/bad-reason-code", "removeFromCRL(8) may appear only in a delta CRL (RFC 5280 sec. 5.3.1)");
172
177
  return codeNum;
173
178
  }
@@ -284,7 +289,7 @@ function _buildCrlExtensions(spec, ctx) {
284
289
  // fixed criticality (assertValidExtension rejects an explicit critical=FALSE, so 3 children == critical,
285
290
  // 2 == non-critical) AND a well-formed value of the right type (INTEGER for cRLNumber/deltaCRLIndicator,
286
291
  // else a SEQUENCE), never emitted opaque.
287
- if (Object.prototype.hasOwnProperty.call(REQUIRED_CRITICALITY, extnId)) {
292
+ if (_hasOwn(REQUIRED_CRITICALITY, extnId)) {
288
293
  if ((node.children.length === 3) !== REQUIRED_CRITICALITY[extnId]) {
289
294
  throw _err("crl/bad-input", "pre-encoded " + (oid.name(extnId) || extnId) + " extension has the wrong criticality (RFC 5280 sec. 5.2 requires it " + (REQUIRED_CRITICALITY[extnId] ? "critical" : "non-critical") + ")");
290
295
  }
@@ -387,13 +392,13 @@ function _buildRevoked(entryList, isDelta) {
387
392
  // RFC 5280 sec. 5.3 -- a recognized entry extension is held to the profile even via the escape hatch:
388
393
  // its fixed criticality AND a well-formed value of the right type (reasonCode an ENUMERATED in the
389
394
  // legal set, invalidityDate a GeneralizedTime).
390
- if (Object.prototype.hasOwnProperty.call(REQUIRED_ENTRY_CRITICALITY, extnId)) {
395
+ if (_hasOwn(REQUIRED_ENTRY_CRITICALITY, extnId)) {
391
396
  if ((xnode.children.length === 3) !== REQUIRED_ENTRY_CRITICALITY[extnId]) throw _err("crl/bad-input", "pre-encoded entry extension " + (oid.name(extnId) || extnId) + " has the wrong criticality (RFC 5280 sec. 5.3 requires it " + (REQUIRED_ENTRY_CRITICALITY[extnId] ? "critical" : "non-critical") + ")");
392
397
  var einner = _extInner(xnode, oid.name(extnId) || extnId);
393
398
  if (extnId === O("reasonCode")) {
394
399
  if (einner.tagClass !== "universal" || einner.tagNumber !== TAGS.ENUMERATED) throw _err("crl/bad-reason-code", "pre-encoded reasonCode value must be an ENUMERATED (RFC 5280 sec. 5.3.1)");
395
400
  var rc = asn1.read.enumerated(einner);
396
- if (!Object.prototype.hasOwnProperty.call(CRL_REASON, rc.toString())) throw _err("crl/bad-reason-code", "pre-encoded reasonCode " + rc + " is undefined or reserved (RFC 5280 sec. 5.3.1)");
401
+ if (!_hasOwn(CRL_REASON, rc.toString())) throw _err("crl/bad-reason-code", "pre-encoded reasonCode " + rc + " is undefined or reserved (RFC 5280 sec. 5.3.1)");
397
402
  if (rc === 8n && !isDelta) throw _err("crl/bad-reason-code", "removeFromCRL(8) may appear only in a delta CRL (RFC 5280 sec. 5.3.1)");
398
403
  } else if (extnId === O("invalidityDate")) {
399
404
  if (einner.tagClass !== "universal" || einner.tagNumber !== TAGS.GENERALIZED_TIME) throw _err("crl/bad-input", "pre-encoded invalidityDate value must be a GeneralizedTime (RFC 5280 sec. 5.3.2)");
package/lib/ct.js CHANGED
@@ -44,6 +44,11 @@ var asn1 = require("./asn1-der.js");
44
44
  var constants = require("./constants.js");
45
45
  var frameworkError = require("./framework-error.js");
46
46
  var guard = require("./guard-all.js");
47
+ var intrinsic = require("./guard-intrinsic.js");
48
+ // Own-key membership through an operation taken at load. Written out, the question reads two
49
+ // replaceable properties to answer one thing, and here it decides whether a log state is one this
50
+ // toolkit trusts -- answering true for a name the table never carried trusts an untrusted log.
51
+ var _hasOwn = intrinsic.hasOwn;
47
52
  var ByteReader = require("./byte-reader.js");
48
53
  var ByteWriter = require("./byte-writer.js");
49
54
  var oid = require("./oid.js");
@@ -650,7 +655,7 @@ var LOG_STATE_TRUST = { pending: "no", qualified: "yes", usable: "yes", readonly
650
655
  function _parseLogState(state) {
651
656
  if (state == null || typeof state !== "object") throw _ctErr("ct/bad-state", "a CT log entry is missing its state");
652
657
  var keys = Object.keys(state);
653
- if (keys.length !== 1 || !Object.prototype.hasOwnProperty.call(LOG_STATE_TRUST, keys[0])) {
658
+ if (keys.length !== 1 || !_hasOwn(LOG_STATE_TRUST, keys[0])) {
654
659
  throw _ctErr("ct/bad-state", "a CT log state must carry exactly one recognized member (pending/qualified/usable/readonly/retired/rejected)");
655
660
  }
656
661
  var name = keys[0], member = state[name];
package/lib/est.js CHANGED
@@ -72,6 +72,10 @@ var OID_CMC_DATA_RETURN = oid.byName("id-cmc-dataReturn");
72
72
  var crmfFmt = require("./schema-crmf");
73
73
  var frameworkError = require("./framework-error");
74
74
  var guard = require("./guard-all");
75
+ var intrinsic = require("./guard-intrinsic");
76
+ // Own-key membership through an operation taken at load: written out it reads two replaceable
77
+ // properties to answer one question, and here it decides which fields of a response are copied.
78
+ var _hasOwn = intrinsic.hasOwn;
75
79
  var httpTransport = require("./http-transport");
76
80
  var httpDigest = require("./http-digest");
77
81
  var retryAfter = require("./http-retry-after");
@@ -1592,7 +1596,7 @@ function _assertAgrees(name, supplied, carried) {
1592
1596
  function _copyRecipient(r) {
1593
1597
  if (!r || typeof r !== "object") return r;
1594
1598
  var out = {}, k;
1595
- for (k in r) { if (Object.prototype.hasOwnProperty.call(r, k)) out[k] = _copyBytes(r[k]); }
1599
+ for (k in r) { if (_hasOwn(r, k)) out[k] = _copyBytes(r[k]); }
1596
1600
  return out;
1597
1601
  }
1598
1602
 
@@ -1606,10 +1610,10 @@ function _copyRecipient(r) {
1606
1610
  // transport function, a tls config).
1607
1611
  function _shallowCopy(o) {
1608
1612
  var out = {}, k;
1609
- for (k in o) { if (Object.prototype.hasOwnProperty.call(o, k)) out[k] = o[k]; }
1613
+ for (k in o) { if (_hasOwn(o, k)) out[k] = o[k]; }
1610
1614
  if (out.auth && typeof out.auth === "object") {
1611
1615
  var a = {}, ak;
1612
- for (ak in out.auth) { if (Object.prototype.hasOwnProperty.call(out.auth, ak)) a[ak] = out.auth[ak]; }
1616
+ for (ak in out.auth) { if (_hasOwn(out.auth, ak)) a[ak] = out.auth[ak]; }
1613
1617
  out.auth = a;
1614
1618
  }
1615
1619
  return out;
package/lib/hpke.js CHANGED
@@ -27,6 +27,10 @@
27
27
  var nodeCrypto = require("crypto");
28
28
  var frameworkError = require("./framework-error");
29
29
  var guard = require("./guard-all");
30
+ var intrinsic = require("./guard-intrinsic");
31
+ // Own-key membership through an operation taken at load. Written out, the question reads two
32
+ // replaceable properties to answer one thing, and here it decides which suite parameters are read.
33
+ var _hasOwn = intrinsic.hasOwn;
30
34
 
31
35
  var HpkeError = frameworkError.HpkeError;
32
36
  function _err(code, message, cause) { return new HpkeError(code, message, cause); }
@@ -423,7 +427,7 @@ function _mode(opts, keys, who) {
423
427
  guard.identifier.assertKnownKeys(opts, keys, _err, "hpke/bad-input", function (k) {
424
428
  var other = (keys === _SETUP_S_KEYS ? _SETUP_R_KEYS : _SETUP_S_KEYS);
425
429
  return "unknown HPKE " + who + " option " + JSON.stringify(k) +
426
- (Object.prototype.hasOwnProperty.call(other, k)
430
+ (_hasOwn(other, k)
427
431
  ? " -- that option belongs to the other end of the exchange, where it would authenticate or seed; here it would do nothing"
428
432
  : "") + " -- accepted: " + Object.keys(keys).sort().join(", ");
429
433
  });
@@ -14,14 +14,24 @@
14
14
 
15
15
  var crypto = require("crypto");
16
16
  var constants = require("./constants");
17
+ var intrinsic = require("./guard-intrinsic");
18
+ // Own-key membership through an operation taken at load. Written out, the question reads two
19
+ // replaceable properties to answer one thing, and here it decides whether an auth-param repeats --
20
+ // answering false lets the second copy of a nonce overwrite the first.
21
+ var _hasOwn = intrinsic.hasOwn;
17
22
 
18
23
  // Algorithm registry, a data row and not a switch: rank orders the RFC 7616 sec. 3.7
19
24
  // "most secure the client can use" selection (SHA-512-256 > SHA-256 > MD5); an unknown algorithm ranks 0.
20
- var ALGS = {
25
+ //
26
+ // Null prototype, because the gate on an unknown algorithm is `if (!ALGS[name])`. With an ordinary
27
+ // object literal that question is asked of the prototype chain too, so an algorithm named for any
28
+ // member of Object.prototype answers with a truthy value the table never carried: the
29
+ // unsupported-algorithm refusal is skipped and the descriptor's own fields read as undefined.
30
+ var ALGS = intrinsic.assign(intrinsic.create(null), {
21
31
  "SHA-512-256": { hash: "sha512-256", rank: 3, sess: false }, "SHA-512-256-SESS": { hash: "sha512-256", rank: 3, sess: true },
22
32
  "SHA-256": { hash: "sha256", rank: 2, sess: false }, "SHA-256-SESS": { hash: "sha256", rank: 2, sess: true },
23
33
  "MD5": { hash: "md5", rank: 1, sess: false }, "MD5-SESS": { hash: "md5", rank: 1, sess: true },
24
- };
34
+ });
25
35
  var DEFAULT_CODES = {
26
36
  unsupportedAlgorithm: "digest/unsupported-algorithm", weakAlgorithm: "digest/weak-algorithm",
27
37
  noQop: "digest/no-qop", badChallenge: "digest/bad-challenge",
@@ -110,7 +120,7 @@ function _parseParams(paramText, E, code) {
110
120
  var rawVal = seg.slice(eq + 1).replace(/^\s+|\s+$/g, "");
111
121
  var quoted = rawVal.charAt(0) === "\"";
112
122
  if (quoted && !_closedQuote(rawVal)) throw E(code, "an unterminated or trailing-garbage Digest quoted-string (RFC 7230 sec. 3.2.6)");
113
- if (Object.prototype.hasOwnProperty.call(map, key)) throw E(code, "repeated Digest auth-param " + JSON.stringify(key));
123
+ if (_hasOwn(map, key)) throw E(code, "repeated Digest auth-param " + JSON.stringify(key));
114
124
  var value = quoted ? _unq(rawVal) : rawVal;
115
125
  // Reject a control octet in any value (CR / LF / NUL / ...): it is a MUST-reject per RFC 7230 qdtext AND a
116
126
  // header-injection sink -- an unescaped CR/LF reflected into the outgoing Authorization would split the header.
@@ -3081,7 +3081,7 @@ async function build(leaf, opts) {
3081
3081
  // supplied and `opts.softFail` answers for it. Own membership decides only whether a name is
3082
3082
  // build-only, which is a question about this module's own table and never about the caller.
3083
3083
  Object.keys(_VALIDATE_OPTS).forEach(function (k) {
3084
- if (Object.prototype.hasOwnProperty.call(BUILD_ONLY_OPT, k)) return;
3084
+ if (intrinsic.hasOwn(BUILD_ONLY_OPT, k)) return;
3085
3085
  if (k in opts) forwarded[k] = opts[k];
3086
3086
  });
3087
3087
  function validateOpts(anchor) {
@@ -39,6 +39,10 @@ var schema = require("./schema-engine");
39
39
  var pkix = require("./schema-pkix");
40
40
  var oid = require("./oid");
41
41
  var guard = require("./guard-all");
42
+ var intrinsic = require("./guard-intrinsic");
43
+ // Own-key membership through an operation taken at load. Written out, the question reads two
44
+ // replaceable properties to answer one thing, and here it decides which object-digest types resolve.
45
+ var _hasOwn = intrinsic.hasOwn;
42
46
  var frameworkError = require("./framework-error");
43
47
 
44
48
  var AttrCertError = frameworkError.AttrCertError;
@@ -69,7 +73,7 @@ var ODT_NAMES = constants.NAMES.OBJECT_DIGEST_TYPE;
69
73
  var DIGESTED_OBJECT_TYPE = schema.decode(function (n, ctx) {
70
74
  var v = asn1.read.enumerated(n);
71
75
  var k = v.toString();
72
- if (!Object.prototype.hasOwnProperty.call(ODT_NAMES, k)) {
76
+ if (!_hasOwn(ODT_NAMES, k)) {
73
77
  throw ctx.E("attrcert/bad-digested-object-type", "digestedObjectType " + k + " is not a defined value (RFC 5755 sec. 4.1)");
74
78
  }
75
79
  // RFC 5755 sec. 7.3 -- a conformant AC MUST NOT use otherObjectTypes(2); the digested
package/lib/schema-crl.js CHANGED
@@ -28,6 +28,10 @@ var schema = require("./schema-engine");
28
28
  var pkix = require("./schema-pkix");
29
29
  var oid = require("./oid");
30
30
  var frameworkError = require("./framework-error");
31
+ var intrinsic = require("./guard-intrinsic");
32
+ // Own-key membership through an operation taken at load. Written out, the question reads two
33
+ // replaceable properties to answer one thing, and here it decides which CRLReason values are defined.
34
+ var _hasOwn = intrinsic.hasOwn;
31
35
 
32
36
  var CrlError = frameworkError.CrlError;
33
37
  var PemError = frameworkError.PemError;
@@ -77,7 +81,7 @@ function decodeExt(ext) {
77
81
  // read.enumerated asserts the ENUMERATED tag (a bare INTEGER is rejected) --
78
82
  // the codec owns the tag check, so this reader need not repeat it.
79
83
  var reason = asn1.read.enumerated(asn1.decode(ext.value));
80
- if (!Object.prototype.hasOwnProperty.call(CRL_REASONS, reason.toString())) throw new Error("undefined CRLReason " + reason.toString());
84
+ if (!_hasOwn(CRL_REASONS, reason.toString())) throw new Error("undefined CRLReason " + reason.toString());
81
85
  value = Number(reason);
82
86
  } else if (ext.oid === OID_INVALIDITY_DATE) { // invalidityDate ::= GeneralizedTime
83
87
  var n = asn1.decode(ext.value);
@@ -39,6 +39,11 @@ var pkix = require("./schema-pkix");
39
39
  var oid = require("./oid");
40
40
  var constants = require("./constants");
41
41
  var frameworkError = require("./framework-error");
42
+ var intrinsic = require("./guard-intrinsic");
43
+ // Own-key membership through an operation taken at load. Written out, the question reads two
44
+ // replaceable properties to answer one thing, and here it decides which response statuses and
45
+ // revocation reasons are defined -- an admitted name names a status RFC 6960 never assigned.
46
+ var _hasOwn = intrinsic.hasOwn;
42
47
 
43
48
  var OcspError = frameworkError.OcspError;
44
49
  var PemError = frameworkError.PemError;
@@ -85,7 +90,7 @@ var GENERALIZED_TIME = pkix.generalizedTime(NS, { code: "ocsp/bad-time", message
85
90
  var OCSP_RESPONSE_STATUS = schema.decode(function (n, ctx) {
86
91
  var v = asn1.read.enumerated(n);
87
92
  var key = v.toString();
88
- if (!Object.prototype.hasOwnProperty.call(STATUS_NAMES, key)) throw ctx.E("ocsp/bad-response-status", "undefined OCSPResponseStatus " + key + " (RFC 6960 sec. 4.2.1)");
93
+ if (!_hasOwn(STATUS_NAMES, key)) throw ctx.E("ocsp/bad-response-status", "undefined OCSPResponseStatus " + key + " (RFC 6960 sec. 4.2.1)");
89
94
  return { code: Number(v), name: STATUS_NAMES[key] };
90
95
  });
91
96
 
@@ -93,7 +98,7 @@ var OCSP_RESPONSE_STATUS = schema.decode(function (n, ctx) {
93
98
  var CRL_REASON = schema.decode(function (n, ctx) {
94
99
  var v = asn1.read.enumerated(n);
95
100
  var key = v.toString();
96
- if (!Object.prototype.hasOwnProperty.call(CRL_REASONS, key)) throw ctx.E("ocsp/bad-revocation-reason", "undefined CRLReason " + key + " (RFC 5280 sec. 5.3.1)");
101
+ if (!_hasOwn(CRL_REASONS, key)) throw ctx.E("ocsp/bad-revocation-reason", "undefined CRLReason " + key + " (RFC 5280 sec. 5.3.1)");
97
102
  return CRL_REASONS[key];
98
103
  });
99
104
 
@@ -17,6 +17,11 @@ var asn1 = require("./asn1-der");
17
17
  var constants = require("./constants");
18
18
  var schema = require("./schema-engine");
19
19
  var guard = require("./guard-all");
20
+ var intrinsic = require("./guard-intrinsic");
21
+ // Own-key membership through an operation taken at load. Written out, the question reads two
22
+ // replaceable properties to answer one thing, and here it decides which version numbers a format
23
+ // accepts -- shared by every format module, so one admitted name widens all of them at once.
24
+ var _hasOwn = intrinsic.hasOwn;
20
25
  // ct is a leaf format module (requires only the codec / oid / constants / error
21
26
  // core, never pkix) so the SCT-list extension VALUE decoder registers here as a
22
27
  // registry row, not a switch. The one-directional edge keeps the layering acyclic.
@@ -174,7 +179,7 @@ function makeNS(prefix, ErrorClass, oidModule) {
174
179
  function versionReader(ns, accept) {
175
180
  return schema.decode(function (n) {
176
181
  var key = asn1.read.integer(n).toString();
177
- if (Object.prototype.hasOwnProperty.call(accept, key)) return accept[key];
182
+ if (_hasOwn(accept, key)) return accept[key];
178
183
  throw ns.E(ns.prefix + "/bad-version", "unsupported version " + key);
179
184
  });
180
185
  }
@@ -52,6 +52,10 @@
52
52
 
53
53
  var C = require("./constants");
54
54
  var guard = require("./guard-all");
55
+ var intrinsic = require("./guard-intrinsic");
56
+ // Own-key membership through an operation taken at load. Written out, the question reads two
57
+ // replaceable properties to answer one thing, and here it decides which algorithms are supported.
58
+ var _hasOwn = intrinsic.hasOwn;
55
59
  var frameworkError = require("./framework-error");
56
60
  var validator = require("./validator-all");
57
61
  var ByteWriter = require("./byte-writer");
@@ -88,7 +92,7 @@ var LEVEL_OPT = {
88
92
  // guard on this runtime. An algorithm the guard cannot decompress must never be offered
89
93
  // or accepted: advertising one would mean accepting a message we then cannot open.
90
94
  var SUPPORTED = guard.compress.algorithms().filter(function (n) {
91
- return Object.prototype.hasOwnProperty.call(ALG_BY_NAME, n) && typeof COMPRESS[n] === "function";
95
+ return _hasOwn(ALG_BY_NAME, n) && typeof COMPRESS[n] === "function";
92
96
  });
93
97
 
94
98
  // The minimum Certificate message size and the widest opaque<..2^24-1> vector, both owned
package/lib/trust.js CHANGED
@@ -40,6 +40,10 @@ var constants = require("./constants");
40
40
  var errors = require("./framework-error");
41
41
  var asn1 = require("./asn1-der");
42
42
  var guard = require("./guard-all");
43
+ var intrinsic = require("./guard-intrinsic");
44
+ // Own-key membership through an operation taken at load. Written out, the question reads two
45
+ // replaceable properties to answer one thing, and here it decides which trust bits an anchor carries.
46
+ var _hasOwn = intrinsic.hasOwn;
43
47
  var x509 = require("./schema-x509");
44
48
 
45
49
  var TrustError = errors.TrustError;
@@ -604,7 +608,7 @@ function _trustBits(cell) {
604
608
  var t = tok.trim();
605
609
  if (t === "") return;
606
610
  var l = t.toLowerCase();
607
- if (!Object.prototype.hasOwnProperty.call(_TRUST_BIT_TOKENS, l)) {
611
+ if (!_hasOwn(_TRUST_BIT_TOKENS, l)) {
608
612
  throw E("trust/bad-csv", "unrecognized Trust Bits token " + JSON.stringify(t));
609
613
  }
610
614
  var p = _TRUST_BIT_TOKENS[l];
@@ -22,6 +22,10 @@
22
22
  var frameworkError = require("./framework-error");
23
23
  var x509 = require("./schema-x509");
24
24
  var guard = require("./guard-all");
25
+ var intrinsic = require("./guard-intrinsic");
26
+ // Own-key membership through an operation taken at load. Written out, the question reads two
27
+ // replaceable properties to answer one thing, and here it decides which status rows an entry carries.
28
+ var _hasOwn = intrinsic.hasOwn;
25
29
  var jose = require("./jose");
26
30
  var rfc3339 = require("./rfc3339");
27
31
  var constants = require("./constants");
@@ -348,7 +352,7 @@ function _verifyMetadataBlob(blob, opts) {
348
352
  // reader that skips the list accepts a token on terms it never met. Nothing here processes an
349
353
  // extension parameter, so any name is unprocessed, including a standard name, which sec. 4.1.11
350
354
  // forbids listing at all.
351
- if (Object.prototype.hasOwnProperty.call(header, "crit")) {
355
+ if (_hasOwn(header, "crit")) {
352
356
  var crit = header.crit;
353
357
  if (!Array.isArray(crit) || crit.length === 0) {
354
358
  throw _err("webauthn/bad-metadata-blob", "the metadata BLOB header crit must be a non-empty array (RFC 7515 sec. 4.1.11)");
package/lib/webauthn.js CHANGED
@@ -34,6 +34,10 @@ var constants = require("./constants");
34
34
  var validator = require("./validator-all");
35
35
  var edwardsPoint = require("./edwards-point");
36
36
  var guard = require("./guard-all");
37
+ var intrinsic = require("./guard-intrinsic");
38
+ // Own-key membership through an operation taken at load: written out it reads two replaceable
39
+ // properties to answer one question, and either answering true admits a name the table never had.
40
+ var _hasOwn = intrinsic.hasOwn;
37
41
  var jose = require("./jose");
38
42
  var mds = require("./webauthn-mds");
39
43
  var nodeCrypto = require("crypto");
@@ -2220,7 +2224,7 @@ function _snapshotAssertion(input) {
2220
2224
  if (!_isPlainObject(input)) throw _err("webauthn/bad-input", "pki.webauthn.verifyAssertion takes an options object");
2221
2225
  guard.identifier.assertKnownKeys(input, _ASSERT_OPTS, _err, "webauthn/bad-input", "verifyAssertion input has an unknown key ");
2222
2226
  var out = {}, k;
2223
- for (k in input) { if (Object.prototype.hasOwnProperty.call(input, k)) out[k] = input[k]; }
2227
+ for (k in input) { if (_hasOwn(input, k)) out[k] = input[k]; }
2224
2228
  // The SAME set of byte forms the arguments accept. A snapshot list narrower than the accept list
2225
2229
  // leaves whatever falls in the gap aliased across the yield -- which is the one input a widened
2226
2230
  // accept list newly admits, so the two must be written from one predicate.
@@ -2237,7 +2241,7 @@ function _snapshotAssertion(input) {
2237
2241
  } else if (_isPlainObject(out.credentialPublicKey)) {
2238
2242
  var key = {}, kk;
2239
2243
  for (kk in out.credentialPublicKey) {
2240
- if (!Object.prototype.hasOwnProperty.call(out.credentialPublicKey, kk)) continue;
2244
+ if (!_hasOwn(out.credentialPublicKey, kk)) continue;
2241
2245
  // The read itself can fault: a stored key is a caller-supplied object, so a field may be an
2242
2246
  // accessor, and one that THROWS would escape as a raw error from the very copy whose job is
2243
2247
  // to make the descriptor stop being the caller's. The copy is the boundary, so the fault is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blamejs/pki",
3
- "version": "0.5.22",
3
+ "version": "0.5.23",
4
4
  "description": "Pure-JavaScript PKI toolkit that owns its stack — X.509, ASN.1/DER, CMS, PQC-first.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "blamejs contributors",
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:3735feb6-6447-4894-953a-28811d47f2c0",
5
+ "serialNumber": "urn:uuid:efde95e7-f09e-4942-88b0-af9566cae79a",
6
6
  "version": 1,
7
7
  "metadata": {
8
- "timestamp": "2026-08-21T03:44:09.554Z",
8
+ "timestamp": "2026-08-21T04:42:14.069Z",
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.5.22",
22
+ "bom-ref": "@blamejs/pki@0.5.23",
23
23
  "type": "application",
24
24
  "name": "pki",
25
- "version": "0.5.22",
25
+ "version": "0.5.23",
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.5.22",
29
+ "purl": "pkg:npm/%40blamejs/pki@0.5.23",
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.5.22",
57
+ "ref": "@blamejs/pki@0.5.23",
58
58
  "dependsOn": []
59
59
  }
60
60
  ]