@blamejs/pki 0.6.39 → 0.6.40
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 +12 -0
- package/lib/attrcert-sign.js +2 -2
- package/lib/cmp-session.js +4 -4
- package/lib/cmp-verify.js +4 -8
- package/lib/cms-verify.js +7 -7
- package/lib/crl-sign.js +8 -8
- package/lib/csr-sign.js +2 -2
- package/lib/ct.js +14 -14
- package/lib/guard-bytes.js +1 -1
- package/lib/guard-identifier.js +1 -1
- package/lib/guard-json.js +1 -1
- package/lib/guard-list.js +16 -0
- package/lib/guard-parsed.js +1 -1
- package/lib/guard-verdict.js +7 -1
- package/lib/ip-utils.js +1 -1
- package/lib/path-validate.js +95 -95
- package/lib/pkcs12-build.js +11 -9
- package/lib/sigstore.js +16 -7
- package/lib/smime.js +4 -4
- package/lib/tsp-sign.js +19 -19
- package/lib/webauthn.js +46 -42
- package/package.json +1 -1
- package/sbom.cdx.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ 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.6.40 — 2026-09-05
|
|
8
|
+
|
|
9
|
+
Every verify verdict now reaches its caller as the object the verb built, and a list the toolkit assembles carries the entries the toolkit put in it.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- The verdicts of pki.attrcert.verify, pki.crl.verify, pki.csr.verify, pki.ct.verifySctWithLogList, pki.ct.verifySctList, pki.path.validate, pki.path.build, pki.pkcs12.verifyMac, pki.pkcs12.open, pki.webauthn.verify, pki.webauthn.verifyAssertion, pki.cmp.verify, pki.tsp.verify, pki.ocsp.verifyRequest and pki.sigstore.verifyBundle end the prototype lookup for then on themselves. An accessor installed there while a verification was pending could otherwise run with the verdict as its receiver and change what the caller reads.
|
|
14
|
+
- A list a verdict reports is appended to by defining the entry rather than assigning it, so a setter at the appended index cannot take the value and answer the read with something else. This covers the keys, certificates, CRLs and secrets pki.pkcs12.open returns from an authenticated store, the signers pki.cms.verify reports and the countersignatures under them, the per-SCT results and the distinct operators pki.ct.verifySctList counts its policy against, the per-certificate results pki.path.validate reports and the checks under each of them that name which gate refused, the elements of a compound attestation pki.webauthn.verify returns along with the routes its anchoredTo names, the certificate chain and transcript a pki.cmp session returns, and the signer identities pki.smime.verify reports. The arrays a pki.schema parser fills are not covered: a verify verb re-derives its answer from the bytes and refuses a parse result whose fields were rebuilt, so a substituted entry there decides nothing.
|
|
15
|
+
- pki.webauthn.verify builds the fields it learns after the attestation itself is checked into the verdict rather than writing them onto it. bindingChecked, which tells a relying party which of its expectations were enforced, could otherwise be taken by an inherited setter and reported by its getter as a check that never ran. anchoredTo, anchoredElements, metadata, clientData, safetyNet, tpm and compound are built the same way.
|
|
16
|
+
- The results of pki.path.crlChecker(...).check and pki.path.ocspChecker(...).check, the build-only result pki.path.build returns under validate:false, and the results of pki.ct.signSct and pki.ct.fetchLogList carry the same protection. Each is handed to a caller, so each ends the prototype lookup for then on itself.
|
|
17
|
+
- Path validation, CMS verification, timestamp verification, CMP protection verification and Sigstore bundle verification append to every one of their own lists the same way. Each reads its answer back out of those lists, so the name forms a name-constraint check compares, the CRLs a revocation decision scans, the policy-tree nodes that produce the user-constrained set, the candidate certificates a signer identifier selects, the chains a timestamp is trusted through and the path a Fulcio leaf is anchored by are all written where an indexed setter cannot reach them.
|
|
18
|
+
|
|
7
19
|
## v0.6.39 — 2026-09-05
|
|
8
20
|
|
|
9
21
|
A verdict field is created with the verdict rather than written onto it afterward, so a value left on Object.prototype can no longer answer a question the verification never asked.
|
package/lib/attrcert-sign.js
CHANGED
|
@@ -717,7 +717,7 @@ function _verify(ac, issuer, opts) {
|
|
|
717
717
|
var trust = _resolveIssuer(issuer);
|
|
718
718
|
|
|
719
719
|
var acIssuer = _acIssuerName(parsed);
|
|
720
|
-
var result = {
|
|
720
|
+
var result = guard.verdict.of({
|
|
721
721
|
holder: parsed.holder,
|
|
722
722
|
issuer: acIssuer,
|
|
723
723
|
attributes: parsed.attributes,
|
|
@@ -735,7 +735,7 @@ function _verify(ac, issuer, opts) {
|
|
|
735
735
|
valid: false,
|
|
736
736
|
verified: false,
|
|
737
737
|
reason: undefined,
|
|
738
|
-
};
|
|
738
|
+
});
|
|
739
739
|
|
|
740
740
|
return Promise.resolve(attrcertVerify.verifyAcSignature(parsed, trust.spki)).then(function (sigOk) {
|
|
741
741
|
result.signatureValid = sigOk === true;
|
package/lib/cmp-session.js
CHANGED
|
@@ -507,7 +507,7 @@ function session(opts) {
|
|
|
507
507
|
if (!Buffer.isBuffer(c)) return;
|
|
508
508
|
var k = c.toString("base64");
|
|
509
509
|
if (caPubsSeen[k]) {
|
|
510
|
-
if (isGrantLeg) { for (var pi = 0; pi < caPubsAccum.length; pi++) { if (caPubsAccum[pi].toString("base64") === k) {
|
|
510
|
+
if (isGrantLeg) { for (var pi = 0; pi < caPubsAccum.length; pi++) { if (caPubsAccum[pi].toString("base64") === k) { guard.list.append(caPubsAccum, caPubsAccum.splice(pi, 1)[0]); if (pi < caPubsWaitingCount) caPubsWaitingCount--; break; } } }
|
|
511
511
|
return;
|
|
512
512
|
}
|
|
513
513
|
try { x509.parse(c); } catch (e) { throw _err("cmp/bad-cert-response", "an authenticated caPubs entry is not a valid X.509 certificate", e); }
|
|
@@ -522,7 +522,7 @@ function session(opts) {
|
|
|
522
522
|
if (caPubsAccum.length >= CAPUBS_MAX || caPubsBytes + c.length > caPubsByteBudget) return;
|
|
523
523
|
caPubsSeen[k] = 1;
|
|
524
524
|
caPubsBytes += c.length;
|
|
525
|
-
|
|
525
|
+
guard.list.append(caPubsAccum, Buffer.from(c));
|
|
526
526
|
if (!isGrantLeg) caPubsWaitingCount++;
|
|
527
527
|
});
|
|
528
528
|
if (isGrantLeg) return { state: "granted", resp: resp, code: code };
|
|
@@ -592,7 +592,7 @@ function session(opts) {
|
|
|
592
592
|
var len = Buffer.isBuffer(entry.bytes) ? entry.bytes.length : 0;
|
|
593
593
|
var over = transcriptBytes + len > transcriptCap;
|
|
594
594
|
if (!over) transcriptBytes += len;
|
|
595
|
-
|
|
595
|
+
guard.list.append(transcript, over
|
|
596
596
|
? guard.verdict.of(entry, { byteLength: len, bytes: null, truncated: true })
|
|
597
597
|
: guard.verdict.of(entry));
|
|
598
598
|
}
|
|
@@ -703,7 +703,7 @@ function session(opts) {
|
|
|
703
703
|
var k = _certIdentity(c);
|
|
704
704
|
if (k != null && seenChain[k]) return;
|
|
705
705
|
if (k != null) seenChain[k] = 1;
|
|
706
|
-
|
|
706
|
+
guard.list.append(chain, c);
|
|
707
707
|
});
|
|
708
708
|
await _validateLeaf(leaf, caPubsAccum);
|
|
709
709
|
var info = { status: PKI_STATUS_NAMES[granted.code] || granted.code, grantedWithMods: granted.code === 1 };
|
package/lib/cmp-verify.js
CHANGED
|
@@ -77,7 +77,7 @@ var _engine = null;
|
|
|
77
77
|
function setEngine(engine) { _engine = engine; }
|
|
78
78
|
|
|
79
79
|
function _verdict(m, type, protectionAlg, valid, trusted, code, reason, signer) {
|
|
80
|
-
|
|
80
|
+
return guard.verdict.of({
|
|
81
81
|
valid: valid,
|
|
82
82
|
trusted: trusted,
|
|
83
83
|
protectionType: type,
|
|
@@ -88,9 +88,7 @@ function _verdict(m, type, protectionAlg, valid, trusted, code, reason, signer)
|
|
|
88
88
|
recipNonce: m.header.recipNonce || null,
|
|
89
89
|
header: m.header,
|
|
90
90
|
body: m.body,
|
|
91
|
-
};
|
|
92
|
-
if (code) { v.code = code; v.reason = reason; }
|
|
93
|
-
return v;
|
|
91
|
+
}, code ? { code: code, reason: reason } : null);
|
|
94
92
|
}
|
|
95
93
|
function _ok(m, type, alg, trusted, signer) { return _verdict(m, type, alg, true, trusted, null, null, signer); }
|
|
96
94
|
function _fail(m, type, alg, code, reason, signer) { return _verdict(m, type, alg, false, false, code, reason, signer || null); }
|
|
@@ -438,7 +436,7 @@ async function _verifySignature(m, protectedPart, protectionAlg, protection, opt
|
|
|
438
436
|
|
|
439
437
|
if (opts.trustAnchors == null) return _ok(m, "signature", protectionAlg, false, signer);
|
|
440
438
|
var trust = await _chainSigner(signer, m, opts, extra);
|
|
441
|
-
if (trust.chain) signer
|
|
439
|
+
if (trust.chain) guard.verdict.set(signer, "chain", trust.chain);
|
|
442
440
|
return _verdict(m, "signature", protectionAlg, true, trust.trusted, trust.trusted ? null : "cmp/untrusted-signer", trust.reason, signer);
|
|
443
441
|
}
|
|
444
442
|
|
|
@@ -521,9 +519,7 @@ function _boundExtraCerts(extra) {
|
|
|
521
519
|
|
|
522
520
|
var _defineOwn = Object.defineProperty;
|
|
523
521
|
var _Date = Date;
|
|
524
|
-
|
|
525
|
-
_defineOwn(arr, arr.length, { value: v, writable: true, enumerable: true, configurable: true });
|
|
526
|
-
}
|
|
522
|
+
var _append = guard.list.append;
|
|
527
523
|
|
|
528
524
|
function _certList(v) {
|
|
529
525
|
if (v == null) return [];
|
package/lib/cms-verify.js
CHANGED
|
@@ -111,9 +111,9 @@ function _findSignerCerts(sid, parsedCerts) {
|
|
|
111
111
|
for (var i = 0; i < parsedCerts.length; i++) {
|
|
112
112
|
var c = parsedCerts[i];
|
|
113
113
|
if (sid.subjectKeyIdentifier != null) {
|
|
114
|
-
if (c.ski && intrinsic.bufferEquals(c.ski, _toBuf(sid.subjectKeyIdentifier, "sid.subjectKeyIdentifier")))
|
|
114
|
+
if (c.ski && intrinsic.bufferEquals(c.ski, _toBuf(sid.subjectKeyIdentifier, "sid.subjectKeyIdentifier"))) guard.list.append(out, c);
|
|
115
115
|
} else if (sid.issuer && sid.serialNumberHex != null) {
|
|
116
|
-
if (c.cert.serialNumberHex === sid.serialNumberHex && guard.name.dnEqual(c.cert.issuer.rdns, sid.issuer.rdns, _err, "cms/bad-name", "the signer certificate issuer"))
|
|
116
|
+
if (c.cert.serialNumberHex === sid.serialNumberHex && guard.name.dnEqual(c.cert.issuer.rdns, sid.issuer.rdns, _err, "cms/bad-name", "the signer certificate issuer")) guard.list.append(out, c);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
return out;
|
|
@@ -391,10 +391,10 @@ async function _verifyCountersignatures(si, parsedCerts) {
|
|
|
391
391
|
var values = [];
|
|
392
392
|
intrinsic.forEach(si.unsignedAttrs || [], function (a) {
|
|
393
393
|
if (a.type !== OID_COUNTERSIGNATURE) return;
|
|
394
|
-
intrinsic.forEach(a.values, function (v) {
|
|
394
|
+
intrinsic.forEach(a.values, function (v) { guard.list.append(values, v && v.bytes ? v.bytes : v); });
|
|
395
395
|
});
|
|
396
396
|
var out = [];
|
|
397
|
-
for (var _cp = 0; _cp < values.length; _cp++)
|
|
397
|
+
for (var _cp = 0; _cp < values.length; _cp++) guard.list.append(out, await _verifyOneCountersig(values[_cp], targetSig, parsedCerts));
|
|
398
398
|
return out;
|
|
399
399
|
}
|
|
400
400
|
|
|
@@ -495,7 +495,7 @@ async function _resolveContentDigests(parsed, streamSource) {
|
|
|
495
495
|
var names = [], seen = {};
|
|
496
496
|
intrinsic.forEach(parsed.signerInfos, function (si) {
|
|
497
497
|
var dn = si.digestAlgorithm.name;
|
|
498
|
-
if (si.signedAttrsBytes && _supportedDigest(dn) && !seen[dn]) { seen[dn] = 1;
|
|
498
|
+
if (si.signedAttrsBytes && _supportedDigest(dn) && !seen[dn]) { seen[dn] = 1; guard.list.append(names, dn); }
|
|
499
499
|
});
|
|
500
500
|
if (!names.length) return {};
|
|
501
501
|
var ds;
|
|
@@ -546,7 +546,7 @@ async function _verify(input, opts) {
|
|
|
546
546
|
var siOne = parsed.signerInfos[_sp];
|
|
547
547
|
var verdict = await _verifyOne(siOne, content, eContentType, parsedCerts, null, digestByName);
|
|
548
548
|
var counters = await _verifyCountersignatures(siOne, parsedCerts);
|
|
549
|
-
|
|
549
|
+
guard.list.append(signers, guard.verdict.of(verdict, {
|
|
550
550
|
countersignatures: counters,
|
|
551
551
|
unsignedAttrs: _surfaceUnsignedAttrs(siOne),
|
|
552
552
|
signedAttributesPresent: !!siOne.signedAttrsBytes,
|
|
@@ -677,7 +677,7 @@ function _addCert(out, der) {
|
|
|
677
677
|
try {
|
|
678
678
|
cert = x509.parse(buf);
|
|
679
679
|
} catch (_e2) { return; }
|
|
680
|
-
|
|
680
|
+
guard.list.append(out, { cert: cert, der: buf, ski: _certSki(cert) });
|
|
681
681
|
}
|
|
682
682
|
|
|
683
683
|
/**
|
package/lib/crl-sign.js
CHANGED
|
@@ -525,14 +525,14 @@ function _verify(crl, issuer) {
|
|
|
525
525
|
return crlVerify.verifyCrlSignature(parsed, resolved.spki).then(function (sigOk) {
|
|
526
526
|
var signatureValid = sigOk === true;
|
|
527
527
|
var valid = issuerMaySign && signatureValid;
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
528
|
+
return guard.verdict.of(
|
|
529
|
+
{ valid: valid, issuerMaySign: issuerMaySign, signatureValid: signatureValid, issuer: parsed.issuer },
|
|
530
|
+
valid ? null : {
|
|
531
|
+
code: !issuerMaySign ? "crl/issuer-may-not-sign" : "crl/bad-signature",
|
|
532
|
+
reason: !issuerMaySign
|
|
533
|
+
? "the issuer certificate is not this CRL's issuer, or its keyUsage does not assert cRLSign (RFC 5280 sec. 4.2.1.3)"
|
|
534
|
+
: "the CRL signature did not verify under the issuer key",
|
|
535
|
+
});
|
|
536
536
|
});
|
|
537
537
|
}
|
|
538
538
|
|
package/lib/csr-sign.js
CHANGED
|
@@ -205,14 +205,14 @@ function verify(request) { return guard.async.deferred(function () { return _ver
|
|
|
205
205
|
function _verify(request) {
|
|
206
206
|
var parsed = _coerceCsr(request);
|
|
207
207
|
return Promise.resolve(csrVerify.verifyCsrSignature(parsed)).then(function (ok) {
|
|
208
|
-
return {
|
|
208
|
+
return guard.verdict.of({
|
|
209
209
|
valid: ok === true,
|
|
210
210
|
verified: ok === true,
|
|
211
211
|
subject: parsed.subject,
|
|
212
212
|
subjectPublicKeyInfo: parsed.subjectPublicKeyInfo,
|
|
213
213
|
attributes: parsed.attributes,
|
|
214
214
|
certificationRequestInfoBytes: parsed.certificationRequestInfoBytes,
|
|
215
|
-
};
|
|
215
|
+
});
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
|
package/lib/ct.js
CHANGED
|
@@ -551,7 +551,7 @@ async function signSct(entry, logKey, opts) {
|
|
|
551
551
|
var priv = await subtle.importKey("pkcs8", mat.pkcs8, imp, false, ["sign"]);
|
|
552
552
|
var sigRaw = Buffer.from(await subtle.sign(sign, priv, preimage));
|
|
553
553
|
var signature = ecdsaDer ? validator.sig.rawToEcdsaDer(sigRaw, coordLen) : sigRaw;
|
|
554
|
-
return {
|
|
554
|
+
return guard.verdict.of({
|
|
555
555
|
version: 0,
|
|
556
556
|
logId: logId, logIdHex: logId.toString("hex"),
|
|
557
557
|
timestamp: timestamp,
|
|
@@ -559,7 +559,7 @@ async function signSct(entry, logKey, opts) {
|
|
|
559
559
|
hashAlg: hashAlg, sigAlg: sigAlg,
|
|
560
560
|
signatureAlgorithm: { hash: hashAlg, hashName: HASH_ALGORITHMS[hashAlg] || null, signature: sigAlg, signatureName: SIGNATURE_ALGORITHMS[sigAlg] || null },
|
|
561
561
|
signature: signature,
|
|
562
|
-
};
|
|
562
|
+
});
|
|
563
563
|
}
|
|
564
564
|
|
|
565
565
|
|
|
@@ -766,14 +766,14 @@ async function verifySctWithLogList(entry, sct, logList, opts) {
|
|
|
766
766
|
var c = _classifyLog(sct, logList, entry, opts);
|
|
767
767
|
if (c.status !== "ok") throw _ctErr(c.code, c.message);
|
|
768
768
|
var valid = await verifySct(entry, sct, c.log.key);
|
|
769
|
-
return {
|
|
769
|
+
return guard.verdict.of({
|
|
770
770
|
valid: valid,
|
|
771
771
|
logId: c.log.logId,
|
|
772
772
|
logIdHex: c.log.logIdHex,
|
|
773
773
|
operator: c.log.operator,
|
|
774
774
|
logState: c.log.state.name,
|
|
775
775
|
timestamp: sct.timestamp,
|
|
776
|
-
};
|
|
776
|
+
});
|
|
777
777
|
}
|
|
778
778
|
|
|
779
779
|
var _VERIFY_SCT_LIST_OPTS = { minScts: 1, minOperators: 1, certNotAfter: 1, at: 1 };
|
|
@@ -860,37 +860,37 @@ async function verifySctList(entry, list, logList, opts) {
|
|
|
860
860
|
try { c = _classifyLog(sct, logList, entry, opts); }
|
|
861
861
|
catch (e) {
|
|
862
862
|
if (!(e && e.isPkiError)) throw e;
|
|
863
|
-
row.code = e.code; row.reason = e.message;
|
|
863
|
+
row.code = e.code; row.reason = e.message; guard.list.append(results, row); continue;
|
|
864
864
|
}
|
|
865
865
|
if (c.log) { row.operator = c.log.operator; row.logState = c.log.state.name; }
|
|
866
|
-
if (c.status !== "ok") { row.code = c.code; row.reason = c.message;
|
|
866
|
+
if (c.status !== "ok") { row.code = c.code; row.reason = c.message; guard.list.append(results, row); continue; }
|
|
867
867
|
var ok;
|
|
868
868
|
try { ok = await verifySct(entry, sct, c.log.key); }
|
|
869
869
|
catch (e) {
|
|
870
870
|
if (!(e && e.isPkiError)) throw e;
|
|
871
|
-
row.code = e.code; row.reason = e.message;
|
|
871
|
+
row.code = e.code; row.reason = e.message; guard.list.append(results, row); continue;
|
|
872
872
|
}
|
|
873
873
|
if (ok === true && atMs != null && sct.timestamp > atMs) {
|
|
874
874
|
row.code = "ct/future-timestamp"; row.reason = "the SCT timestamp is later than the validation time (RFC 6962 sec. 5.2)";
|
|
875
|
-
|
|
875
|
+
guard.list.append(results, row); continue;
|
|
876
876
|
}
|
|
877
877
|
row.valid = ok === true;
|
|
878
878
|
if (row.valid && !seenLogs[sct.logIdHex]) {
|
|
879
879
|
seenLogs[sct.logIdHex] = true;
|
|
880
880
|
validScts++;
|
|
881
|
-
if (c.log.operator != null && !seenOps[c.log.operator]) { seenOps[c.log.operator] = true;
|
|
881
|
+
if (c.log.operator != null && !seenOps[c.log.operator]) { seenOps[c.log.operator] = true; guard.list.append(operators, c.log.operator); }
|
|
882
882
|
}
|
|
883
|
-
|
|
883
|
+
guard.list.append(results, row);
|
|
884
884
|
}
|
|
885
885
|
var operatorCount = operators.length;
|
|
886
886
|
var policyOk = validScts >= minScts && operatorCount >= minOperators;
|
|
887
|
-
return {
|
|
887
|
+
return guard.verdict.of({
|
|
888
888
|
valid: policyOk,
|
|
889
889
|
policyOk: policyOk, totalScts: scts.length + unknownScts, validScts: validScts, unknownScts: unknownScts,
|
|
890
890
|
operatorCount: operatorCount, operators: operators, required: { minScts: minScts, minOperators: minOperators },
|
|
891
891
|
results: results,
|
|
892
892
|
reason: policyOk ? null : ("CT policy not met: " + validScts + " valid SCT(s) from " + operatorCount + " distinct operator(s); require at least " + minScts + " SCT(s) from at least " + minOperators + " operator(s)"),
|
|
893
|
-
};
|
|
893
|
+
});
|
|
894
894
|
}
|
|
895
895
|
|
|
896
896
|
function _asParsedCert(v, field) {
|
|
@@ -1143,10 +1143,10 @@ async function fetchLogList(opts) {
|
|
|
1143
1143
|
var ok = await verifyLogListSignature(jsonRes.body, sigRes.body, opts.signerKey);
|
|
1144
1144
|
if (ok !== true) throw _ctErr("ct/log-list-untrusted", "the CT log-list detached signature did not verify against the pinned distributor key -- the fetched list is untrusted and was not parsed");
|
|
1145
1145
|
var parsed = parseLogList(jsonRes.body);
|
|
1146
|
-
return {
|
|
1146
|
+
return guard.verdict.of({
|
|
1147
1147
|
logs: parsed.logs, byLogId: parsed.byLogId, version: parsed.version, timestamp: parsed.timestamp,
|
|
1148
1148
|
raw: { json: jsonRes.body, sig: sigRes.body }, status: jsonRes.status, contentType: jsonRes.contentType, tls: jsonRes.tls,
|
|
1149
|
-
};
|
|
1149
|
+
});
|
|
1150
1150
|
}
|
|
1151
1151
|
|
|
1152
1152
|
module.exports = {
|
package/lib/guard-bytes.js
CHANGED
|
@@ -41,7 +41,7 @@ var _mapSet = intrinsic.mapSet;
|
|
|
41
41
|
var _taSet = intrinsic.typedArraySet;
|
|
42
42
|
var _Set = intrinsic.Set;
|
|
43
43
|
var _Map = intrinsic.Map;
|
|
44
|
-
|
|
44
|
+
var _append = require("./guard-list").append;
|
|
45
45
|
|
|
46
46
|
function _ownArrayIndices(v, n) {
|
|
47
47
|
var keys = _ownKeys(v);
|
package/lib/guard-identifier.js
CHANGED
|
@@ -38,7 +38,7 @@ var _Number = intrinsic.Number;
|
|
|
38
38
|
var _BigInt = intrinsic.BigInt;
|
|
39
39
|
var _Object = intrinsic.Object;
|
|
40
40
|
var _BufferProto = intrinsic.BufferProto;
|
|
41
|
-
|
|
41
|
+
var _append = require("./guard-list").append;
|
|
42
42
|
|
|
43
43
|
function _isDottedDecimal(str) {
|
|
44
44
|
if (str.length === 0) return false;
|
package/lib/guard-json.js
CHANGED
|
@@ -12,7 +12,7 @@ var _hasOwn = require("./guard-intrinsic").hasOwn;
|
|
|
12
12
|
var _Number = require("./guard-intrinsic").Number;
|
|
13
13
|
var _isFinite = require("./guard-intrinsic").isFinite;
|
|
14
14
|
var _stringify = require("./guard-intrinsic").stringify;
|
|
15
|
-
|
|
15
|
+
var _append = require("./guard-list").append;
|
|
16
16
|
var limits = require("./guard-limits");
|
|
17
17
|
|
|
18
18
|
function _hexVal(c) {
|
package/lib/guard-list.js
CHANGED
|
@@ -4,6 +4,21 @@
|
|
|
4
4
|
// @internal
|
|
5
5
|
|
|
6
6
|
var _freeze = require("./guard-intrinsic").freeze;
|
|
7
|
+
var _defineProperty = require("./guard-intrinsic").defineProperty;
|
|
8
|
+
var _isArray = require("./guard-intrinsic").isArray;
|
|
9
|
+
|
|
10
|
+
var MAX_ARRAY_LENGTH = 4294967295;
|
|
11
|
+
|
|
12
|
+
// @enforced-by guard-shape-reinlined
|
|
13
|
+
// @guard-shape defineProperty\(\s*\w+\s*,\s*\w+\.length\s*,\s*\{\s*value:
|
|
14
|
+
// @guard-via guard\.list\.append\(
|
|
15
|
+
function append(list, value) {
|
|
16
|
+
if (!_isArray(list)) throw new TypeError("guard.list.append: the receiver must be an array");
|
|
17
|
+
var n = list.length;
|
|
18
|
+
if (n >= MAX_ARRAY_LENGTH) throw new RangeError("guard.list.append: the array is at its maximum length");
|
|
19
|
+
_defineProperty(list, n, { value: value, writable: true, enumerable: true, configurable: true });
|
|
20
|
+
return list;
|
|
21
|
+
}
|
|
7
22
|
|
|
8
23
|
// @enforced-by behavioral -- `.indexOf(x) !== -1` has no rename-proof form that separates a
|
|
9
24
|
function contains(list, value) {
|
|
@@ -34,6 +49,7 @@ function allMatch(list, predicate) {
|
|
|
34
49
|
}
|
|
35
50
|
|
|
36
51
|
module.exports = _freeze({
|
|
52
|
+
append: append,
|
|
37
53
|
contains: contains,
|
|
38
54
|
containsAll: containsAll,
|
|
39
55
|
anyMatches: anyMatches,
|
package/lib/guard-parsed.js
CHANGED
|
@@ -20,7 +20,7 @@ var _weakSet = require("./guard-intrinsic").weakSet;
|
|
|
20
20
|
var _weakHas = require("./guard-intrinsic").weakHas;
|
|
21
21
|
var _WeakMap = require("./guard-intrinsic").WeakMap;
|
|
22
22
|
var _defineProperty = require("./guard-intrinsic").defineProperty;
|
|
23
|
-
|
|
23
|
+
var _append = require("./guard-list").append;
|
|
24
24
|
|
|
25
25
|
function _isBytes(x) {
|
|
26
26
|
return bytes.isByteSource(x);
|
package/lib/guard-verdict.js
CHANGED
|
@@ -38,4 +38,10 @@ function carries(obj, key) {
|
|
|
38
38
|
return obj != null && _hasOwn(_Object(obj), key);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
// @enforced-by behavioral -- for a target that cannot be rebuilt, an Error carrying a field a
|
|
42
|
+
function set(target, key, value) {
|
|
43
|
+
_defineProperty(target, key, { value: value, enumerable: true, configurable: true, writable: true });
|
|
44
|
+
return target;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = _freeze({ of: of, carries: carries, set: set });
|
package/lib/ip-utils.js
CHANGED
|
@@ -15,7 +15,7 @@ var _bufferFrom = intrinsic.bufferFrom;
|
|
|
15
15
|
var _bufferAlloc = intrinsic.bufferAlloc;
|
|
16
16
|
var _defineProperty = intrinsic.defineProperty;
|
|
17
17
|
var _Number = intrinsic.Number;
|
|
18
|
-
|
|
18
|
+
var _push = require("./guard-list").append;
|
|
19
19
|
function _splitOn(str, sep) {
|
|
20
20
|
var out = [], from = 0, at;
|
|
21
21
|
while ((at = _indexOf(str, sep, from)) !== -1) { _push(out, _slice(str, from, at)); from = at + sep.length; }
|