@blamejs/pki 0.6.39 → 0.6.41

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.
Files changed (79) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/lib/acme.js +24 -13
  3. package/lib/asn1-der.js +5 -5
  4. package/lib/attrcert-sign.js +16 -16
  5. package/lib/cbor-det.js +2 -2
  6. package/lib/cmc-build.js +16 -16
  7. package/lib/cmc-verify.js +5 -5
  8. package/lib/cmp-build.js +29 -19
  9. package/lib/cmp-session.js +25 -20
  10. package/lib/cmp-verify.js +8 -12
  11. package/lib/cms-decrypt.js +8 -8
  12. package/lib/cms-encrypt.js +22 -22
  13. package/lib/cms-sign.js +17 -17
  14. package/lib/cms-verify.js +13 -13
  15. package/lib/composite-kem.js +1 -1
  16. package/lib/composite-sig.js +4 -4
  17. package/lib/constants.js +13 -9
  18. package/lib/crl-sign.js +25 -25
  19. package/lib/crmf-sign.js +11 -11
  20. package/lib/csr-sign.js +4 -4
  21. package/lib/ct.js +33 -25
  22. package/lib/edwards-point.js +2 -2
  23. package/lib/est.js +74 -43
  24. package/lib/guard-async.js +17 -1
  25. package/lib/guard-bytes.js +3 -3
  26. package/lib/guard-compress.js +5 -5
  27. package/lib/guard-identifier.js +46 -2
  28. package/lib/guard-json.js +1 -1
  29. package/lib/guard-list.js +16 -0
  30. package/lib/guard-name.js +1 -1
  31. package/lib/guard-parsed.js +1 -1
  32. package/lib/guard-time.js +3 -1
  33. package/lib/guard-verdict.js +7 -1
  34. package/lib/hpke.js +10 -10
  35. package/lib/http-digest.js +2 -2
  36. package/lib/http-transport.js +3 -3
  37. package/lib/inspect.js +9 -9
  38. package/lib/ip-utils.js +1 -1
  39. package/lib/jose.js +14 -14
  40. package/lib/key.js +7 -7
  41. package/lib/lint.js +6 -4
  42. package/lib/merkle.js +2 -2
  43. package/lib/mime.js +2 -2
  44. package/lib/ocsp-verify.js +1 -1
  45. package/lib/ocsp.js +5 -5
  46. package/lib/oid.js +3 -3
  47. package/lib/path-validate.js +127 -117
  48. package/lib/pbes2.js +2 -2
  49. package/lib/pkcs12-build.js +26 -24
  50. package/lib/pki-build.js +2 -2
  51. package/lib/scep.js +47 -16
  52. package/lib/schema-all.js +1 -1
  53. package/lib/schema-attrcert.js +4 -3
  54. package/lib/schema-c509.js +23 -23
  55. package/lib/schema-cmc.js +6 -6
  56. package/lib/schema-cmp.js +3 -3
  57. package/lib/schema-cms.js +15 -8
  58. package/lib/schema-crmf.js +1 -1
  59. package/lib/schema-csr.js +1 -1
  60. package/lib/schema-engine.js +2 -1
  61. package/lib/schema-pkcs12.js +1 -1
  62. package/lib/schema-pkix.js +3 -0
  63. package/lib/schema-tsp.js +2 -2
  64. package/lib/shbs.js +2 -2
  65. package/lib/sign-scheme.js +9 -9
  66. package/lib/sigstore.js +24 -14
  67. package/lib/smime.js +16 -16
  68. package/lib/tls-cert-compress.js +6 -6
  69. package/lib/trust.js +9 -9
  70. package/lib/tsp-sign.js +30 -30
  71. package/lib/validator-attcert.js +2 -2
  72. package/lib/validator-cose.js +5 -5
  73. package/lib/validator-sig.js +3 -3
  74. package/lib/validator-tpm.js +5 -4
  75. package/lib/webauthn.js +58 -54
  76. package/lib/webcrypto.js +22 -14
  77. package/lib/x509-sign.js +8 -8
  78. package/package.json +1 -1
  79. package/sbom.cdx.json +6 -6
@@ -279,6 +279,7 @@ function _walkSeq(schema, node, ctx) {
279
279
  var kids = _assertShape(schema, node, ctx);
280
280
  _assertArity(schema, kids, ctx);
281
281
 
282
+ // allow:registry-table-inherits-object-prototype -- the record a schema's own check and build callbacks read as m.fields, whose keys are the field names that schema declared rather than anything the input supplies
282
283
  var fields = {};
283
284
  var idx = 0;
284
285
  for (var f = 0; f < schema.fields.length; f++) {
@@ -322,7 +323,7 @@ function _walkSeq(schema, node, ctx) {
322
323
  }
323
324
 
324
325
  function _consumeTrailing(fld, kids, start, fields, ctx) {
325
- var byTag = {};
326
+ var byTag = Object.create(null);
326
327
  for (var m = 0; m < fld.members.length; m++) byTag[fld.members[m].tag] = fld.members[m];
327
328
  var last = fld.minTag != null ? fld.minTag - 1 : -1;
328
329
  for (var i = start; i < kids.length; i++) {
@@ -176,7 +176,7 @@ var SAFE_BAG = schema.seq([
176
176
  var attributes = [];
177
177
  var friendlyName = null;
178
178
  var localKeyId = null;
179
- var seen = {};
179
+ var seen = Object.create(null);
180
180
  if (m.fields.bagAttributes.present) {
181
181
  var items = m.fields.bagAttributes.value.items;
182
182
  for (var i = 0; i < items.length; i++) {
@@ -676,6 +676,7 @@ function certExtensionDecoders(ns) {
676
676
  for (var z = 0; z < bs.bytes.length; z++) { if (bs.bytes[z] !== 0) { anyBit = true; break; } }
677
677
  if (!anyBit) throw ns.E(C, "KeyUsage must assert at least one bit (RFC 5280 sec. 4.2.1.3)");
678
678
  schema.assertMinimalNamedBits(bs.unusedBits, bs.bytes, function (m) { throw ns.E(C, m); });
679
+ // allow:registry-table-inherits-object-prototype -- the decoded KeyUsage record, whose keys are the fixed KU_BITS names the schema declares rather than anything the certificate supplies
679
680
  var out = {};
680
681
  _forEach(KU_BITS, function (nm, bit) {
681
682
  var byte = bit >> 3, mask = 0x80 >> (bit & 7);
@@ -821,6 +822,7 @@ function certExtensionDecoders(ns) {
821
822
  function authorityKeyIdentifier(buf) {
822
823
  var C = ns.prefix + "/bad-extension-value";
823
824
  var kids = seqChildren(buf, C, "AuthorityKeyIdentifier");
825
+ // allow:registry-table-inherits-object-prototype -- the decoded AuthorityKeyIdentifier record, read by the three field names the schema declares rather than by anything the certificate supplies
824
826
  var out = { keyIdentifier: null, authorityCertIssuer: null, authorityCertSerialNumber: null };
825
827
  var lastTag = -1;
826
828
  _forEach(kids, function (k) {
@@ -867,6 +869,7 @@ function certExtensionDecoders(ns) {
867
869
  if (dp.tagClass !== "universal" || dp.tagNumber !== _T.SEQUENCE || !dp.children) {
868
870
  throw ns.E(C, "DistributionPoint must be a SEQUENCE { distributionPoint?, reasons?, cRLIssuer? }");
869
871
  }
872
+ // allow:registry-table-inherits-object-prototype -- the decoded DistributionPoint record, read by the three field names the schema declares rather than by anything the certificate supplies
870
873
  var out = { distributionPoint: null, reasons: null, cRLIssuer: null };
871
874
  var lastTag = -1;
872
875
  _forEach(dp.children, function (f) {
package/lib/schema-tsp.js CHANGED
@@ -58,10 +58,10 @@ var OID_SIGNING_CERT_V2 = oid.byName("signingCertificateV2");
58
58
 
59
59
  var TAGS = asn1.TAGS;
60
60
 
61
- var FAILURE_BITS = {
61
+ var FAILURE_BITS = Object.assign(Object.create(null), {
62
62
  0: "badAlg", 2: "badRequest", 5: "badDataFormat", 14: "timeNotAvailable",
63
63
  15: "unacceptedPolicy", 16: "unacceptedExtension", 17: "addInfoNotAvailable", 25: "systemFailure",
64
- };
64
+ });
65
65
 
66
66
 
67
67
  var GEN_TIME = pkix.generalizedTime(NS, { code: "tsp/bad-gentime", message: "genTime must be a GeneralizedTime (RFC 3161 sec. 2.4.2)", allowFractional: true });
package/lib/shbs.js CHANGED
@@ -48,8 +48,8 @@ function _deriveWinternitz(n, w) {
48
48
  return { p: u + v, ls: 16 - v * w };
49
49
  }
50
50
 
51
- var LMS_SETS = {};
52
- var LMOTS_SETS = {};
51
+ var LMS_SETS = Object.create(null);
52
+ var LMOTS_SETS = Object.create(null);
53
53
  (function seed() {
54
54
  var heights = [5, 10, 15, 20, 25];
55
55
  var ws = [1, 2, 4, 8];
@@ -26,26 +26,26 @@ var _isU8 = intrinsic.types.isUint8Array;
26
26
 
27
27
  var HASH = intrinsic.assign(intrinsic.create(null), { sha256: "SHA-256", sha384: "SHA-384", sha512: "SHA-512" });
28
28
  var NODE_DIGEST = intrinsic.assign(intrinsic.create(null), { sha256: "sha256", sha384: "sha384", sha512: "sha512", shake128: "shake128", shake256: "shake256" });
29
- var PSS_SALT = { "SHA-256": 32, "SHA-384": 48, "SHA-512": 64 };
30
- var ECDSA_ALG = { sha256: "ecdsaWithSHA256", sha384: "ecdsaWithSHA384", sha512: "ecdsaWithSHA512" };
31
- var RSA_PKCS1_SIG = { sha256: "sha256WithRSAEncryption", sha384: "sha384WithRSAEncryption", sha512: "sha512WithRSAEncryption" };
32
- var HASH_NAME_BY_OID = {};
29
+ var PSS_SALT = intrinsic.assign(intrinsic.create(null), { "SHA-256": 32, "SHA-384": 48, "SHA-512": 64 });
30
+ var ECDSA_ALG = intrinsic.assign(intrinsic.create(null), { sha256: "ecdsaWithSHA256", sha384: "ecdsaWithSHA384", sha512: "ecdsaWithSHA512" });
31
+ var RSA_PKCS1_SIG = intrinsic.assign(intrinsic.create(null), { sha256: "sha256WithRSAEncryption", sha384: "sha384WithRSAEncryption", sha512: "sha512WithRSAEncryption" });
32
+ var HASH_NAME_BY_OID = intrinsic.create(null);
33
33
  HASH_NAME_BY_OID[O("sha256")] = "sha256";
34
34
  HASH_NAME_BY_OID[O("sha384")] = "sha384";
35
35
  HASH_NAME_BY_OID[O("sha512")] = "sha512";
36
- var EC_BY_CURVE_OID = {};
36
+ var EC_BY_CURVE_OID = intrinsic.create(null);
37
37
  EC_BY_CURVE_OID[O("prime256v1")] = { curve: "P-256", coordLen: 32 };
38
38
  EC_BY_CURVE_OID[O("secp384r1")] = { curve: "P-384", coordLen: 48 };
39
39
  EC_BY_CURVE_OID[O("secp521r1")] = { curve: "P-521", coordLen: 66 };
40
- var MLDSA_BY_OID = {};
40
+ var MLDSA_BY_OID = intrinsic.create(null);
41
41
  MLDSA_BY_OID[O("id-ml-dsa-44")] = "ML-DSA-44";
42
42
  MLDSA_BY_OID[O("id-ml-dsa-65")] = "ML-DSA-65";
43
43
  MLDSA_BY_OID[O("id-ml-dsa-87")] = "ML-DSA-87";
44
- var MLDSA_SUITABLE_DIGEST = {
44
+ var MLDSA_SUITABLE_DIGEST = intrinsic.assign(intrinsic.create(null), {
45
45
  "ML-DSA-44": { sha256: 1, sha384: 1, sha512: 1, shake256: 1 },
46
46
  "ML-DSA-65": { sha384: 1, sha512: 1, shake256: 1 },
47
47
  "ML-DSA-87": { sha512: 1, shake256: 1 },
48
- };
48
+ });
49
49
  // @enforced-by behavioral -- an own-property table read has no rename-proof shape distinct from a legitimate lookup, so a RED conformance vector is the guard
50
50
  function mldsaDigestSuitable(mlName, md) {
51
51
  if (!intrinsic.hasOwn(MLDSA_SUITABLE_DIGEST, mlName)) return false;
@@ -53,7 +53,7 @@ function mldsaDigestSuitable(mlName, md) {
53
53
  return !!row && intrinsic.hasOwn(row, md) && !!row[md];
54
54
  }
55
55
 
56
- var SLHDSA_BY_OID = {};
56
+ var SLHDSA_BY_OID = intrinsic.create(null);
57
57
  [["sha2-128s", "sha256"], ["sha2-128f", "sha256"], ["sha2-192s", "sha512"], ["sha2-192f", "sha512"],
58
58
  ["sha2-256s", "sha512"], ["sha2-256f", "sha512"], ["shake-128s", "shake128"], ["shake-128f", "shake128"],
59
59
  ["shake-192s", "shake256"], ["shake-192f", "shake256"], ["shake-256s", "shake256"], ["shake-256f", "shake256"]
package/lib/sigstore.js CHANGED
@@ -70,14 +70,14 @@ function _stripTrailingEquals(s) {
70
70
  return s.slice(0, i);
71
71
  }
72
72
 
73
- var _BUNDLE_MEDIA_TYPES = {
73
+ var _BUNDLE_MEDIA_TYPES = Object.assign(Object.create(null), {
74
74
  "application/vnd.dev.sigstore.bundle.v0.1+json": 1,
75
75
  "application/vnd.dev.sigstore.bundle.v0.2+json": 1,
76
76
  "application/vnd.dev.sigstore.bundle.v0.3+json": 1,
77
77
  "application/vnd.dev.sigstore.bundle+json;version=0.1": 1,
78
78
  "application/vnd.dev.sigstore.bundle+json;version=0.2": 1,
79
79
  "application/vnd.dev.sigstore.bundle+json;version=0.3": 1
80
- };
80
+ });
81
81
  function _isBundleMediaType(mt) {
82
82
  return typeof mt === "string" && Object.prototype.hasOwnProperty.call(_BUNDLE_MEDIA_TYPES, mt);
83
83
  }
@@ -360,10 +360,19 @@ function _normRoots(fulcioRoots) {
360
360
 
361
361
  function _pathToAnchor(leaf, anchor, intBySubject) {
362
362
  var anchorSubj = _dn(anchor, "subject");
363
- var path = [leaf], cur = leaf, seen = {}, guardN = 0;
363
+ /** @internal Issuers are collected leaf-first and the path is assembled once, so no element is
364
+ * ever moved to a new index: an indexed setter has nothing to intercept and cannot replace the
365
+ * leaf the preceding signature checks authenticated. */
366
+ var above = [], cur = leaf, seen = Object.create(null), guardN = 0;
367
+ function assemble() {
368
+ var path = [];
369
+ for (var k = above.length - 1; k >= 0; k--) guard.list.append(path, above[k]);
370
+ guard.list.append(path, leaf);
371
+ return path;
372
+ }
364
373
  while (guardN++ < 16) {
365
374
  var issuerDn = _dn(cur, "issuer");
366
- if (issuerDn === anchorSubj) return path;
375
+ if (issuerDn === anchorSubj) return assemble();
367
376
  var cands = intBySubject[issuerDn] || [];
368
377
  var next = null;
369
378
  for (var j = 0; j < cands.length; j++) {
@@ -372,7 +381,7 @@ function _pathToAnchor(leaf, anchor, intBySubject) {
372
381
  }
373
382
  if (!next) return null;
374
383
  seen[_dn(next, "subject")] = 1;
375
- path.unshift(next);
384
+ guard.list.append(above, next);
376
385
  cur = next;
377
386
  }
378
387
  return null;
@@ -381,8 +390,8 @@ function _pathToAnchor(leaf, anchor, intBySubject) {
381
390
  async function _verifyChain(leaf, chainDers, fulcioRoots, timeMs) {
382
391
  var roots = _normRoots(fulcioRoots);
383
392
  var bundleLinks = chainDers.slice(1).map(function (d, i) { return _parseCert(d, "bundle intermediate [" + i + "]"); });
384
- var intBySubject = {};
385
- function addInt(c) { (intBySubject[_dn(c, "subject")] = intBySubject[_dn(c, "subject")] || []).push(c); }
393
+ var intBySubject = Object.create(null);
394
+ function addInt(c) { guard.list.append(intBySubject[_dn(c, "subject")] = intBySubject[_dn(c, "subject")] || [], c); }
386
395
  roots.forEach(function (r) { addInt(r.cert); });
387
396
  bundleLinks.forEach(addInt);
388
397
  var candidates = roots.filter(function (r) { return _inWindow(timeMs, r.validFor); });
@@ -412,7 +421,7 @@ async function _verifyChain(leaf, chainDers, fulcioRoots, timeMs) {
412
421
  var SAN_OID = oid.byName("subjectAltName");
413
422
  var FULCIO_PREFIX = oid.byName("otherName").split(".").slice(0, -1).join(".") + ".";
414
423
  function _identity(leaf) {
415
- var out = { san: null, extensions: {} };
424
+ var out = { san: null, extensions: Object.create(null) };
416
425
  try {
417
426
  (leaf.extensions || []).forEach(function (ext) {
418
427
  if (ext.oid === SAN_OID) { out.san = _sanValue(ext); return; }
@@ -426,7 +435,7 @@ function _identity(leaf) {
426
435
  }
427
436
  return out;
428
437
  }
429
- var GN_TYPE = { 1: "rfc822Name", 2: "dNSName", 6: "uri" };
438
+ var GN_TYPE = Object.assign(Object.create(null), { 1: "rfc822Name", 2: "dNSName", 6: "uri" });
430
439
  function _sanValue(ext) {
431
440
  var seq = asn1.decode(ext.value);
432
441
  var names = [];
@@ -446,7 +455,7 @@ function _sanValue(ext) {
446
455
  }
447
456
  val = { type: "otherName", oid: asn1.read.oid(n.children[0]), value: v };
448
457
  }
449
- if (val) names.push(val);
458
+ if (val) guard.list.append(names, val);
450
459
  }
451
460
  if (names.length > 1) throw _err("sigstore/bad-certificate", "the Fulcio certificate carries multiple SAN identities");
452
461
  return names[0] || null;
@@ -458,10 +467,11 @@ function _fulcioExtValue(ext, leafArc) {
458
467
  }
459
468
 
460
469
  var IDENTITY_FIELDS = ["san", "issuer", "sourceRepositoryURI"];
461
- var IDENTITY_KEYS = { san: 1, issuer: 1, sourceRepositoryURI: 1 };
462
- var _VERIFY_BUNDLE_OPTS = { fulcioRoots: 1, rekorKeys: 1, identity: 1, predicateType: 1, time: 1 };
470
+ var IDENTITY_KEYS = Object.assign(Object.create(null), { san: 1, issuer: 1, sourceRepositoryURI: 1 });
471
+ var _VERIFY_BUNDLE_OPTS = Object.assign(Object.create(null), { fulcioRoots: 1, rekorKeys: 1, identity: 1, predicateType: 1, time: 1 });
463
472
 
464
473
  function _checkIdentity(id, policy) {
474
+ // allow:registry-table-inherits-object-prototype -- the identityChecked record an operator reads by field name, whose three keys are the fixed IDENTITY_FIELDS rather than anything the bundle supplies
465
475
  var ran = { san: false, issuer: false, sourceRepositoryURI: false };
466
476
  if (policy === undefined || policy === null) return ran;
467
477
  if (typeof policy !== "object" || Array.isArray(policy)) {
@@ -582,7 +592,7 @@ async function verifyBundle(bundle, opts) {
582
592
 
583
593
  var st = _statement(payload, env.payloadType, opts.predicateType);
584
594
 
585
- return {
595
+ return guard.verdict.of({
586
596
  valid: true,
587
597
  verified: true,
588
598
  payload: payload,
@@ -596,7 +606,7 @@ async function verifyBundle(bundle, opts) {
596
606
  integratedTime: integratedTime,
597
607
  logIndex: rekor.logIndex,
598
608
  logId: rekor.logId,
599
- };
609
+ });
600
610
  }
601
611
 
602
612
  module.exports = {
package/lib/smime.js CHANGED
@@ -48,21 +48,21 @@ var SmimeError = frameworkError.SmimeError;
48
48
 
49
49
  function _err(code, msg, cause) { return new SmimeError(code, msg, cause); }
50
50
 
51
- var SIGN_OPTS = {
51
+ var SIGN_OPTS = Object.assign(Object.create(null), {
52
52
  form: 1, entity: 1, contentType: 1, signingTime: 1, protectHeaders: 1, headers: 1, hcp: 1,
53
53
  sid: 1, signedAttributes: 1, additionalSignedAttributes: 1,
54
- };
55
- var VERIFY_OPTS = {
54
+ });
55
+ var VERIFY_OPTS = Object.assign(Object.create(null), {
56
56
  certs: 1, trustAnchors: 1, time: 1, requiredEku: 1, checkPurpose: 1, strictMicalg: 1,
57
57
  legacyHeaderProtection: 1, expectedSender: 1,
58
- };
59
- var ENCRYPT_OPTS = {
58
+ });
59
+ var ENCRYPT_OPTS = Object.assign(Object.create(null), {
60
60
  entity: 1, contentType: 1, protectHeaders: 1, headers: 1, hcp: 1,
61
61
  contentEncryptionAlgorithm: 1, oaepHash: 1, keyIdentifier: 1, ukm: 1,
62
- };
63
- var DECRYPT_OPTS = { recipientIndex: 1, maxIterations: 1, strictSmimeType: 1, legacyHeaderProtection: 1 };
64
- var COMPRESS_OPTS = { entity: 1, contentType: 1, level: 1 };
65
- var DECOMPRESS_OPTS = { maxOutputBytes: 1 };
62
+ });
63
+ var DECRYPT_OPTS = Object.assign(Object.create(null), { recipientIndex: 1, maxIterations: 1, strictSmimeType: 1, legacyHeaderProtection: 1 });
64
+ var COMPRESS_OPTS = Object.assign(Object.create(null), { entity: 1, contentType: 1, level: 1 });
65
+ var DECOMPRESS_OPTS = Object.assign(Object.create(null), { maxOutputBytes: 1 });
66
66
 
67
67
  function _knownOpts(opts, known, verb) {
68
68
  guard.identifier.assertKnownKeys(opts, known, _err, "smime/bad-input", function (k) {
@@ -76,7 +76,7 @@ function _isPkcs7(type, kind) {
76
76
  return t === "application/pkcs7-" + kind || t === "application/x-pkcs7-" + kind;
77
77
  }
78
78
 
79
- var MICALG = { sha1: "sha-1", sha224: "sha-224", sha256: "sha-256", sha384: "sha-384", sha512: "sha-512", md5: "md5", shake128: "shake128", shake256: "shake256" };
79
+ var MICALG = Object.assign(Object.create(null), { sha1: "sha-1", sha224: "sha-224", sha256: "sha-256", sha384: "sha-384", sha512: "sha-512", md5: "md5", shake128: "shake128", shake256: "shake256" });
80
80
 
81
81
  function _entityBytes(content, opts) {
82
82
  var raw = guard.bytes.view(content, SmimeError, "smime/bad-input", "content");
@@ -320,7 +320,7 @@ var SMTP_UTF8_MAILBOX = oid.byName("smtpUtf8Mailbox");
320
320
  var EMAIL_ADDRESS_ATTR = oid.byName("emailAddress");
321
321
  var _extNs = pkix.makeNS("smime", SmimeError, oid);
322
322
  var _extDecoders = pkix.certExtensionDecoders(_extNs);
323
- var _extCtx = { E: function (c, m, cause) { return new SmimeError(c, m, cause); }, oid: oid };
323
+ var _extCtx = Object.assign(Object.create(null), { E: function (c, m, cause) { return new SmimeError(c, m, cause); }, oid: oid });
324
324
  function _signerEmails(certDer) {
325
325
  var out = { addresses: [], unreadable: 0 };
326
326
  var parsed = null;
@@ -334,7 +334,7 @@ function _signerEmails(certDer) {
334
334
  catch (sanFailed) { out.unreadable++; out.reason = sanFailed.code || "bad-san"; }
335
335
  if (dec === null) return;
336
336
  (dec.names || []).forEach(function (n) {
337
- if (n.tagNumber === 1) { out.addresses.push(String(n.value)); return; }
337
+ if (n.tagNumber === 1) { guard.list.append(out.addresses, String(n.value)); return; }
338
338
  if (n.tagNumber !== 0) return;
339
339
  var typeId = n.value && typeof n.value === "object" ? n.value.typeId : undefined;
340
340
  if (typeId === undefined) { out.unreadable++; return; }
@@ -346,7 +346,7 @@ function _signerEmails(certDer) {
346
346
  (rdns || []).forEach(function (rdn) {
347
347
  (rdn || []).forEach(function (attr) {
348
348
  if (!attr || attr.type !== EMAIL_ADDRESS_ATTR || typeof attr.value !== "string") return;
349
- if (out.addresses.indexOf(attr.value) === -1) out.addresses.push(attr.value);
349
+ if (out.addresses.indexOf(attr.value) === -1) guard.list.append(out.addresses, attr.value);
350
350
  });
351
351
  });
352
352
  return out;
@@ -362,7 +362,7 @@ function _senderSurface(signers, outerEnt, expectedSender) {
362
362
  }
363
363
  else {
364
364
  var froms = [];
365
- outerEnt.headers.forEach(function (h) { if (h.lname === "from") froms.push(h.value.trim()); });
365
+ outerEnt.headers.forEach(function (h) { if (h.lname === "from") guard.list.append(froms, h.value.trim()); });
366
366
  if (froms.length === 1) { expected = _addrSpec(froms[0]); source = expected === null ? null : "from"; }
367
367
  }
368
368
  var identities = [], undecidable = false, sawIdentity = false;
@@ -371,7 +371,7 @@ function _senderSurface(signers, outerEnt, expectedSender) {
371
371
  var e = s.cert ? _signerEmails(s.cert) : null;
372
372
  if (e === null) { undecidable = true; return; }
373
373
  if (e.unreadable > 0) { undecidable = true; sawIdentity = true; }
374
- e.addresses.forEach(function (a) { sawIdentity = true; if (identities.indexOf(a) === -1) identities.push(a); });
374
+ e.addresses.forEach(function (a) { sawIdentity = true; if (identities.indexOf(a) === -1) guard.list.append(identities, a); });
375
375
  });
376
376
  if (expected === null) return { checked: false, expected: null, source: null, identities: identities, match: null };
377
377
  if (!sawIdentity) return { checked: true, expected: expected, source: source, identities: identities, match: null };
@@ -875,7 +875,7 @@ function _decodeCms(ent) {
875
875
 
876
876
  function _toBuf(v) { return Buffer.isBuffer(v) ? v : Buffer.from(v); }
877
877
 
878
- var CERTS_ONLY_OPTS = { crls: 1 };
878
+ var CERTS_ONLY_OPTS = Object.assign(Object.create(null), { crls: 1 });
879
879
 
880
880
  /**
881
881
  * @primitive pki.smime.buildCertsOnly
@@ -62,17 +62,17 @@ var zlib = require("zlib");
62
62
  var TlsError = frameworkError.TlsError;
63
63
  function _err(code, message, cause) { return new TlsError(code, message, cause); }
64
64
 
65
- var ALG_BY_NUMBER = { 1: "zlib", 2: "brotli", 3: "zstd" };
66
- var ALG_BY_NAME = {};
65
+ var ALG_BY_NUMBER = intrinsic.assign(intrinsic.create(null), { 1: "zlib", 2: "brotli", 3: "zstd" });
66
+ var ALG_BY_NAME = intrinsic.create(null);
67
67
  Object.keys(ALG_BY_NUMBER).forEach(function (n) { ALG_BY_NAME[ALG_BY_NUMBER[n]] = Number(n); });
68
68
 
69
- var COMPRESS = { zlib: zlib.deflateSync, brotli: zlib.brotliCompressSync, zstd: zlib.zstdCompressSync };
69
+ var COMPRESS = intrinsic.assign(intrinsic.create(null), { zlib: zlib.deflateSync, brotli: zlib.brotliCompressSync, zstd: zlib.zstdCompressSync });
70
70
 
71
- var LEVEL_OPT = {
71
+ var LEVEL_OPT = intrinsic.assign(intrinsic.create(null), {
72
72
  zlib: function (n) { return { level: n }; },
73
73
  brotli: function (n) { var p = {}; p[zlib.constants.BROTLI_PARAM_QUALITY] = n; return { params: p }; },
74
74
  zstd: function (n) { var p = {}; p[zlib.constants.ZSTD_c_compressionLevel] = n; return { params: p }; },
75
- };
75
+ });
76
76
 
77
77
  var SUPPORTED = guard.compress.algorithms().filter(function (n) {
78
78
  return _hasOwn(ALG_BY_NAME, n) && typeof COMPRESS[n] === "function";
@@ -81,7 +81,7 @@ var SUPPORTED = guard.compress.algorithms().filter(function (n) {
81
81
  var MIN_CERT_MSG_BYTES = validator.tls.MIN_CERT_MSG_BYTES;
82
82
  var MAX_VECTOR_24 = validator.tls.MAX_VECTOR_24;
83
83
 
84
- var FRAMING_CODES = { truncated: "tls/truncated", framing: "tls/bad-framing", trailing: "tls/trailing-data" };
84
+ var FRAMING_CODES = intrinsic.assign(intrinsic.create(null), { truncated: "tls/truncated", framing: "tls/bad-framing", trailing: "tls/trailing-data" });
85
85
 
86
86
  var HEADER_BYTES = 8;
87
87
 
package/lib/trust.js CHANGED
@@ -327,7 +327,7 @@ function _certEntry(obj) {
327
327
  function _trustEntry(obj) {
328
328
  var issuer = _requireOctal(obj, "CKA_ISSUER", "trust");
329
329
  var serial = _requireOctal(obj, "CKA_SERIAL_NUMBER", "trust");
330
- var purposes = { serverAuth: false, emailProtection: false, codeSigning: false };
330
+ var purposes = intrinsic.assign(intrinsic.create(null), { serverAuth: false, emailProtection: false, codeSigning: false });
331
331
  PURPOSE_ATTRS.forEach(function (pair) {
332
332
  var a = obj.attrs[pair[0]];
333
333
  if (!a) return;
@@ -364,15 +364,15 @@ function _mkAnchor(cert, meta) {
364
364
  var _DERIVED_FROM = new WeakMap();
365
365
 
366
366
  function _copyPurposes(src) {
367
- return {
367
+ return intrinsic.assign(intrinsic.create(null), {
368
368
  serverAuth: !!src && src.serverAuth === true,
369
369
  emailProtection: !!src && src.emailProtection === true,
370
370
  codeSigning: !!src && src.codeSigning === true,
371
- };
371
+ });
372
372
  }
373
373
 
374
374
  function _copyDistrustAfter(src) {
375
- var out = {};
375
+ var out = intrinsic.create(null);
376
376
  if (!src || typeof src !== "object") return out;
377
377
  Object.keys(src).forEach(function (k) {
378
378
  out[k] = guard.time.isDate(src[k]) ? new Date(guard.time.instantOf(src[k])) : src[k];
@@ -521,7 +521,7 @@ function parseCertdata(text) {
521
521
  anchors: _dedupAnchors(certs.map(function (c) {
522
522
  return _mkAnchor(c.cert, {
523
523
  distrustAfter: c.distrustAfter,
524
- purposes: c.purposes || { serverAuth: false, emailProtection: false, codeSigning: false },
524
+ purposes: c.purposes || _copyPurposes(null),
525
525
  label: c.label,
526
526
  mozillaCaPolicy: c.mozillaCaPolicy,
527
527
  });
@@ -579,15 +579,15 @@ function _csvRows(text) {
579
579
  return rows;
580
580
  }
581
581
 
582
- var _TRUST_BIT_TOKENS = {
582
+ var _TRUST_BIT_TOKENS = intrinsic.assign(intrinsic.create(null), {
583
583
  "websites": "serverAuth", "server authentication": "serverAuth",
584
584
  "email": "emailProtection", "secure email": "emailProtection",
585
585
  "code": "codeSigning", "code signing": "codeSigning",
586
586
  "client authentication": null, "document signing": null,
587
587
  "time stamping": null, "ocsp signing": null,
588
- };
588
+ });
589
589
  function _trustBits(cell) {
590
- var purposes = { serverAuth: false, emailProtection: false, codeSigning: false };
590
+ var purposes = intrinsic.assign(intrinsic.create(null), { serverAuth: false, emailProtection: false, codeSigning: false });
591
591
  String(cell).split(";").forEach(function (tok) {
592
592
  var t = tok.trim();
593
593
  if (t === "") return;
@@ -746,7 +746,7 @@ function parseCcadbCsv(text) {
746
746
  * await pki.path.validate([pki.schema.x509.parse(der)],
747
747
  * { time: new Date("2026-06-01T00:00:00Z"), trustAnchors: anchor, checkPurpose: "serverAuth" });
748
748
  */
749
- var _ANCHOR_OPTS = { purpose: 1 };
749
+ var _ANCHOR_OPTS = intrinsic.assign(intrinsic.create(null), { purpose: 1 });
750
750
  function anchor(entry, opts) {
751
751
  if (!entry || typeof entry !== "object") {
752
752
  throw E("trust/bad-input", "anchor expects a trust-store entry ({ name, publicKey, algorithm, ... })");
package/lib/tsp-sign.js CHANGED
@@ -48,9 +48,9 @@ var _b = pkiBuild.makeBuilder({
48
48
  });
49
49
 
50
50
  var NODE_DIGEST = intrinsic.assign(intrinsic.create(null), { sha256: "sha256", sha384: "sha384", sha512: "sha512" });
51
- var HASH_LEN = { sha256: 32, sha384: 48, sha512: 64 };
51
+ var HASH_LEN = intrinsic.assign(intrinsic.create(null), { sha256: 32, sha384: 48, sha512: 64 });
52
52
 
53
- var _REVOCATION_RANK = { "false": 0, "undetermined": 1, "waived": 2, "determined": 3 };
53
+ var _REVOCATION_RANK = intrinsic.assign(intrinsic.create(null), { "false": 0, "undetermined": 1, "waived": 2, "determined": 3 });
54
54
  function _rankRevocation(v) {
55
55
  var r = _REVOCATION_RANK[String(v)];
56
56
  return r === undefined ? 0 : r;
@@ -132,12 +132,12 @@ function sign(messageImprint, tsa, opts) {
132
132
  ], _sign);
133
133
  }
134
134
 
135
- var _TSA_KEYS = { cert: 1, key: 1 };
136
- var _IMPRINT_KEYS = { hashAlgorithm: 1, hashedMessage: 1 };
137
- var _SIGN_OPTS = {
135
+ var _TSA_KEYS = intrinsic.assign(intrinsic.create(null), { cert: 1, key: 1 });
136
+ var _IMPRINT_KEYS = intrinsic.assign(intrinsic.create(null), { hashAlgorithm: 1, hashedMessage: 1 });
137
+ var _SIGN_OPTS = intrinsic.assign(intrinsic.create(null), {
138
138
  policy: 1, serialNumber: 1, genTime: 1, nonce: 1, accuracy: 1, ordering: 1, sid: 1,
139
139
  digestAlgorithm: 1, certHashAlgorithm: 1, additionalSignedAttributes: 1, pss: 1, pem: 1,
140
- };
140
+ });
141
141
 
142
142
  function _sign(messageImprint, tsa, opts) {
143
143
  opts = opts || {};
@@ -171,9 +171,9 @@ function _sign(messageImprint, tsa, opts) {
171
171
  var genTime = guard.time.isDate(opts.genTime) ? opts.genTime : new Date();
172
172
  var serial = guard.range.authoredInteger(opts.serialNumber, _err, "tsp/bad-input", "serialNumber");
173
173
  var fields = [b.integer(1n), _policy(opts.policy), imprint, b.integer(serial), b.generalizedTime(genTime)];
174
- if (opts.accuracy) fields.push(_accuracy(opts.accuracy));
175
- if (opts.ordering === true) fields.push(b.boolean(true));
176
- if (opts.nonce != null) fields.push(b.integer(guard.range.authoredInteger(opts.nonce, _err, "tsp/bad-input", "nonce")));
174
+ if (opts.accuracy) guard.list.append(fields,_accuracy(opts.accuracy));
175
+ if (opts.ordering === true) guard.list.append(fields,b.boolean(true));
176
+ if (opts.nonce != null) guard.list.append(fields,b.integer(guard.range.authoredInteger(opts.nonce, _err, "tsp/bad-input", "nonce")));
177
177
  var tstInfo = b.sequence(fields);
178
178
 
179
179
  var signCert = { type: "signingCertificateV2", values: [_signingCertV2(certDer, certHashAlg)] };
@@ -187,7 +187,7 @@ function _sign(messageImprint, tsa, opts) {
187
187
  });
188
188
  }
189
189
 
190
- var _ACCURACY_KEYS = { seconds: 1, millis: 1, micros: 1 };
190
+ var _ACCURACY_KEYS = intrinsic.assign(intrinsic.create(null), { seconds: 1, millis: 1, micros: 1 });
191
191
 
192
192
  function _accuracy(a) {
193
193
  guard.identifier.assertKnownKeys(a, _ACCURACY_KEYS, _err, "tsp/bad-input", function (k) {
@@ -199,10 +199,10 @@ function _accuracy(a) {
199
199
  if (typeof sec !== "number" && typeof sec !== "bigint") throw _err("tsp/bad-input", "Accuracy seconds must be a non-negative integer, got " + guard.text.showValue(sec));
200
200
  var s = intrinsic.Number(sec);
201
201
  if (!Number.isInteger(s) || s < 0 || s > 0x7fffffff) throw _err("tsp/bad-input", "Accuracy seconds must be a non-negative integer");
202
- f.push(b.integer(BigInt(s)));
202
+ guard.list.append(f,b.integer(BigInt(s)));
203
203
  }
204
- if (mil != null) f.push(b.contextPrimitive(0, _subMilliBytes(mil, "millis")));
205
- if (mic != null) f.push(b.contextPrimitive(1, _subMilliBytes(mic, "micros")));
204
+ if (mil != null) guard.list.append(f,b.contextPrimitive(0, _subMilliBytes(mil, "millis")));
205
+ if (mic != null) guard.list.append(f,b.contextPrimitive(1, _subMilliBytes(mic, "micros")));
206
206
  return b.sequence(f);
207
207
  }
208
208
  function _subMilliBytes(n, label) {
@@ -260,7 +260,7 @@ function _assertImprint(mi) {
260
260
  * var sha256Digest = Buffer.from(await pki.webcrypto.subtle.digest("SHA-256", Buffer.from("hello")));
261
261
  * var req = pki.tsp.request({ hashAlgorithm: "sha256", hashedMessage: sha256Digest }, { nonce: 0x0102030405060708n, certReq: true });
262
262
  */
263
- var _REQUEST_OPTS = { reqPolicy: 1, nonce: 1, certReq: 1, extensions: 1, pem: 1 };
263
+ var _REQUEST_OPTS = intrinsic.assign(intrinsic.create(null), { reqPolicy: 1, nonce: 1, certReq: 1, extensions: 1, pem: 1 });
264
264
 
265
265
  function request(messageImprint, opts) {
266
266
  opts = opts || {};
@@ -276,13 +276,13 @@ function request(messageImprint, opts) {
276
276
  _assertImprint(mi);
277
277
  var imprint = b.sequence([_hashAlgId(mi.hashAlgorithm), b.octetString(guard.bytes.source(mi.hashedMessage, TspError, "tsp/bad-input", "messageImprint.hashedMessage"))]);
278
278
  var fields = [b.integer(1n), imprint];
279
- if (opts.reqPolicy != null) fields.push(_policy(opts.reqPolicy));
280
- if (opts.nonce != null) fields.push(b.integer(guard.range.authoredInteger(opts.nonce, _err, "tsp/bad-input", "nonce")));
279
+ if (opts.reqPolicy != null) guard.list.append(fields,_policy(opts.reqPolicy));
280
+ if (opts.nonce != null) guard.list.append(fields,b.integer(guard.range.authoredInteger(opts.nonce, _err, "tsp/bad-input", "nonce")));
281
281
  if (opts.certReq != null && typeof opts.certReq !== "boolean") throw _err("tsp/bad-input", "certReq must be a boolean");
282
- if (opts.certReq === true) fields.push(b.boolean(true));
282
+ if (opts.certReq === true) guard.list.append(fields,b.boolean(true));
283
283
  if (opts.extensions != null) {
284
284
  if (!Array.isArray(opts.extensions) || !guard.list.allMatch(opts.extensions, function (e) { return guard.bytes.isByteSource(e); })) throw _err("tsp/bad-input", "extensions must be an array of encoded Extension DER buffers");
285
- var seenExt = {};
285
+ var seenExt = intrinsic.create(null);
286
286
  var encoded = opts.extensions.map(function (e, i) {
287
287
  var der = guard.bytes.source(e, TspError, "tsp/bad-input", "an extension");
288
288
  _b.assertValidExtension(der, i);
@@ -291,7 +291,7 @@ function request(messageImprint, opts) {
291
291
  seenExt[extnId] = true;
292
292
  return der;
293
293
  });
294
- if (encoded.length) fields.push(b.contextConstructed(0, Buffer.concat(encoded)));
294
+ if (encoded.length) guard.list.append(fields,b.contextConstructed(0, Buffer.concat(encoded)));
295
295
  }
296
296
  var der = b.sequence(fields);
297
297
  return opts.pem ? schemaTsp.pemEncode(der, "TIMESTAMP REQUEST") : der;
@@ -347,7 +347,7 @@ function parseRequest(input) { return schemaTsp.parseRequest(input); }
347
347
  * var resp = pki.tsp.response(token, {}); // granted
348
348
  * var rej = pki.tsp.response(null, { status: 2, failInfo: ["badAlg"] }); // rejection
349
349
  */
350
- var _RESPONSE_OPTS = { status: 1, statusString: 1, failInfo: 1, pem: 1 };
350
+ var _RESPONSE_OPTS = intrinsic.assign(intrinsic.create(null), { status: 1, statusString: 1, failInfo: 1, pem: 1 });
351
351
 
352
352
  function response(token, opts) {
353
353
  opts = opts || {};
@@ -364,14 +364,14 @@ function response(token, opts) {
364
364
  if (opts.statusString != null) {
365
365
  var texts = Array.isArray(opts.statusString) ? opts.statusString : [opts.statusString];
366
366
  if (!texts.length) throw _err("tsp/bad-input", "statusString must carry at least one PKIFreeText element (RFC 4210 SEQUENCE SIZE 1..MAX)");
367
- siFields.push(b.sequence(texts.map(function (t) { return b.utf8(String(t)); })));
367
+ guard.list.append(siFields,b.sequence(texts.map(function (t) { return b.utf8(String(t)); })));
368
368
  }
369
369
  if (opts.failInfo != null) {
370
370
  if (status !== 2) throw _err("tsp/unexpected-failinfo", "failInfo is present only when the status is rejection(2) (RFC 3161 sec. 2.4.2)");
371
- siFields.push(_failInfoBits(opts.failInfo));
371
+ guard.list.append(siFields,_failInfoBits(opts.failInfo));
372
372
  }
373
373
  var respFields = [b.sequence(siFields)];
374
- if (token != null) respFields.push(b.raw(_tokenDer(token)));
374
+ if (token != null) guard.list.append(respFields, b.raw(_tokenDer(token)));
375
375
  var der = b.sequence(respFields);
376
376
  return opts.pem ? schemaTsp.pemEncode(der, "TIMESTAMP RESPONSE") : der;
377
377
  }
@@ -508,12 +508,12 @@ function _buildTsaChains(leaf, pool) {
508
508
  var chains = [];
509
509
  function dfs(current, acc, used) {
510
510
  if (chains.length >= MAX_TSA_CHAINS) return;
511
- chains.push(acc.slice());
511
+ guard.list.append(chains, acc.slice());
512
512
  for (var i = 0; i < pool.length && chains.length < MAX_TSA_CHAINS; i++) {
513
513
  if (used[i]) continue;
514
514
  if (pool[i].serialNumberHex === current.serialNumberHex && guard.name.dnEqual(pool[i].issuer.rdns, current.issuer.rdns, _err, "tsp/bad-tsa-certificate", "the TSA certificate issuer")) continue;
515
515
  if (guard.name.dnEqual(pool[i].subject.rdns, current.issuer.rdns, _err, "tsp/bad-tsa-certificate", "the TSA certificate subject")) {
516
- used[i] = true; acc.push(pool[i]);
516
+ used[i] = true; guard.list.append(acc, pool[i]);
517
517
  dfs(pool[i], acc, used);
518
518
  acc.pop(); used[i] = false;
519
519
  }
@@ -585,7 +585,7 @@ function _buildTsaChains(leaf, pool) {
585
585
  * res.valid; // boolean; pass opts.trustAnchors to also chain the TSA cert to a root
586
586
  * res.genTime; // Date, read from the verified eContent
587
587
  */
588
- var _VERIFY_OPTS = { certs: 1, trustAnchors: 1, nonce: 1, reqPolicy: 1, revocationChecker: 1 };
588
+ var _VERIFY_OPTS = intrinsic.assign(intrinsic.create(null), { certs: 1, trustAnchors: 1, nonce: 1, reqPolicy: 1, revocationChecker: 1 });
589
589
 
590
590
  function _anyCritical(extensions) {
591
591
  return guard.list.anyMatches(extensions, function (e) { return !!e && !!e.critical; });
@@ -605,7 +605,7 @@ async function verify(token, data, opts) {
605
605
  var revocationChecked = false;
606
606
  var anchorConstraints = null;
607
607
  function fail(code, reason) {
608
- return { valid: false, trusted: false, revocationChecked: revocationChecked, anchorConstraints: anchorConstraints, code: code, reason: reason || null, genTime: tst.genTime, accuracy: tst.accuracy, serialNumber: tst.serialNumber, serialNumberHex: tst.serialNumberHex, policy: tst.policy, policyName: tst.policyName, nonce: tst.nonce, tsa: tst.tsa, tstInfo: tst, signer: null };
608
+ return guard.verdict.of({ valid: false, trusted: false, revocationChecked: revocationChecked, anchorConstraints: anchorConstraints, code: code, reason: reason || null, genTime: tst.genTime, accuracy: tst.accuracy, serialNumber: tst.serialNumber, serialNumberHex: tst.serialNumberHex, policy: tst.policy, policyName: tst.policyName, nonce: tst.nonce, tsa: tst.tsa, tstInfo: tst, signer: null });
609
609
  }
610
610
  var cmsRes = await cmsVerify.verify(tokenDer, { certs: opts.certs });
611
611
  var signer = cmsRes.signers[0];
@@ -642,7 +642,7 @@ async function verify(token, data, opts) {
642
642
  var ceilT = (tst.genTimeFraction != null && _hasNonZeroDigit(tst.genTimeFraction.slice(3))) ? new Date(guard.time.instantOf(floorT) + 1) : floorT;
643
643
  try {
644
644
  var pool = (parsed.certificates || []).filter(function (c) { return c.tagClass === "universal"; }).map(function (c) { return pkiX509.parse(c.bytes); });
645
- (opts.certs || []).forEach(function (c) { pool.push(pkiX509.parse(c)); });
645
+ (opts.certs || []).forEach(function (c) { guard.list.append(pool, pkiX509.parse(c)); });
646
646
  async function validateAt(chain, when) {
647
647
  var res = await pathValidate.validate(chain, {
648
648
  time: when, trustAnchors: opts.trustAnchors, requiredEku: ["timeStamping"], checkPurpose: "timeStamping", revocationChecker: opts.revocationChecker,
@@ -662,13 +662,13 @@ async function verify(token, data, opts) {
662
662
  anchorConstraints = pathRes.anchorConstraints;
663
663
  trusted = true;
664
664
  }
665
- return {
665
+ return guard.verdict.of({
666
666
  valid: true, trusted: trusted, revocationChecked: revocationChecked, anchorConstraints: anchorConstraints,
667
667
  genTime: tst.genTime, accuracy: tst.accuracy,
668
668
  serialNumber: tst.serialNumber, serialNumberHex: tst.serialNumberHex,
669
669
  policy: tst.policy, policyName: tst.policyName, nonce: tst.nonce, tsa: tst.tsa,
670
670
  tstInfo: tst, signer: { cert: tsaCertDer, sid: signer.sid },
671
- };
671
+ });
672
672
  }
673
673
 
674
674
  module.exports = { sign: sign, request: request, parseRequest: parseRequest, response: response, parseResponse: parseResponse, verify: verify };
@@ -25,7 +25,7 @@ function assertNotCa(cert, exts, E, code) {
25
25
  function packedCert(cert, exts, E, code) {
26
26
  requireV3(cert, E, code);
27
27
  assertNotCa(cert, exts, E, code);
28
- var have = {};
28
+ var have = Object.create(null);
29
29
  (cert.subject.rdns || []).forEach(function (rdn) { rdn.forEach(function (a) { have[a.type] = a.value; }); });
30
30
  if (have[oid.byName("countryName")] == null || have[oid.byName("organizationName")] == null || have[oid.byName("commonName")] == null) {
31
31
  throw new E(code, "the packed attestation certificate subject MUST set C, O, OU, and CN (WebAuthn 8.2.1)");
@@ -46,7 +46,7 @@ function aikCert(cert, exts, E, code) {
46
46
  }
47
47
  var san = exts.decode(cert, "subjectAltName");
48
48
  var dirName = san && san.value && san.value.names && san.value.names.filter(function (n) { return n.tagNumber === 4; })[0];
49
- var types = {};
49
+ var types = Object.create(null);
50
50
  if (dirName && dirName.value && dirName.value.rdns) {
51
51
  dirName.value.rdns.forEach(function (rdn) { rdn.forEach(function (a) { types[a.type] = true; }); });
52
52
  }