@blamejs/pki 0.6.53 → 0.6.55

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/lib/oid.js CHANGED
@@ -192,6 +192,13 @@ var FAMILIES = Object.assign(Object.create(null), {
192
192
  entrustAlg: { base: [1, 2, 840, 113533, 7, 66], of: {
193
193
  passwordBasedMac: 13, kemBasedMac: 16, dhBasedMac: 30 } },
194
194
 
195
+ /** @internal ANSI X9.42 (RFC 3279 sec. 2.3.3): the SubjectPublicKeyInfo algorithm an X.509
196
+ * Diffie-Hellman certificate names, whose parameters are DomainParameters rather than the PKCS#3
197
+ * DHParameter that pkcs3 below names. */
198
+ ansiX942: { base: [1, 2, 840, 10046, 2], of: { dhpublicnumber: 1 } },
199
+
200
+ pkcs3: { base: [1, 2, 840, 113549, 1, 3], of: { dhKeyAgreement: 1 } },
201
+
195
202
  pkcs12BagTypes: { base: [1, 2, 840, 113549, 1, 12, 10, 1], of: {
196
203
  keyBag: 1, pkcs8ShroudedKeyBag: 2, certBag: 3, crlBag: 4, secretBag: 5, safeContentsBag: 6 } },
197
204
 
@@ -226,6 +233,7 @@ var FAMILIES = Object.assign(Object.create(null), {
226
233
 
227
234
  pkixAlg: { base: [1, 3, 6, 1, 5, 5, 7, 6], of: {
228
235
  "id-alg-noSignature": 2,
236
+ "id-dhPop-static-HMAC-SHA1": 3, "id-alg-dhPOP": 4,
229
237
  "id-RSASSA-PSS-SHAKE128": 30, "id-RSASSA-PSS-SHAKE256": 31,
230
238
  "id-alg-xmss-hashsig": 34, "id-alg-xmssmt-hashsig": 35,
231
239
  "id-MLDSA44-RSA2048-PSS-SHA256": 37, "id-MLDSA44-RSA2048-PKCS15-SHA256": 38,
@@ -182,7 +182,22 @@ function pemDecodeLenient(text, label) {
182
182
  return _bufferFrom(_keepBase64(_strSlice(text, bodyStart, ei)), "base64");
183
183
  }
184
184
 
185
+ /** @internal Every refusal below is built from opts, so opts is checked before the first one can be
186
+ * reached. A caller that misspells a key otherwise gets a working accept path and a set of refusal
187
+ * paths that throw `undefined is not a constructor`: the input is still rejected, but as an untyped
188
+ * runtime error carrying no reason, and the label check silently passes everything. */
189
+ function _requireCoerceOpts(opts) {
190
+ if (!opts || typeof opts !== "object") throw new TypeError("coerceToDer requires an options object");
191
+ if (typeof opts.PemError !== "function") throw new TypeError("coerceToDer requires opts.PemError, an error constructor");
192
+ if (typeof opts.ErrorClass !== "function") throw new TypeError("coerceToDer requires opts.ErrorClass, an error constructor");
193
+ if (typeof opts.prefix !== "string" || opts.prefix === "") throw new TypeError("coerceToDer requires opts.prefix, a non-empty error-code prefix");
194
+ if (!(opts.pemLabel === null || typeof opts.pemLabel === "string")) {
195
+ throw new TypeError("coerceToDer requires opts.pemLabel, a PEM label to enforce or null to accept any");
196
+ }
197
+ }
198
+
185
199
  function coerceToDer(input, opts) {
200
+ _requireCoerceOpts(opts);
186
201
  if (typeof input === "string") return pemDecode(input, opts.pemLabel, opts.PemError);
187
202
  if (guard.bytes.isByteSource(input)) {
188
203
  var buf = guard.bytes.source(input, opts.ErrorClass, opts.prefix + "/bad-input", "parse");
package/lib/sigstore.js CHANGED
@@ -42,6 +42,15 @@ var C = constants;
42
42
  var SigstoreError = frameworkError.SigstoreError;
43
43
  function _err(code, message, cause) { return new SigstoreError(code, message, cause); }
44
44
 
45
+ /** @internal Whether a oneof arm is PRESENT, which is not the same as whether it is truthy. A bundle
46
+ * setting an arm to false or to an empty string has set it: reading presence as truthiness lets a
47
+ * second arm sit beside the one being read, which is the state the oneof rule exists to refuse. Own
48
+ * properties only, so a polluted prototype cannot conjure an arm the bundle does not carry. */
49
+ function _armPresent(obj, name) {
50
+ return !!obj && typeof obj === "object" &&
51
+ Object.prototype.hasOwnProperty.call(obj, name) && obj[name] !== undefined && obj[name] !== null;
52
+ }
53
+
45
54
  var JSON_MAX = C.LIMITS.JSON_MAX_BYTES;
46
55
  var SP = Buffer.from(" ", "ascii");
47
56
  var DSSEV1 = Buffer.from("DSSEv1", "ascii");
@@ -170,7 +179,24 @@ function parseBundle(input) {
170
179
  if (!obj.verificationMaterial || typeof obj.verificationMaterial !== "object") {
171
180
  throw _err("sigstore/bad-bundle", "bundle is missing verificationMaterial");
172
181
  }
173
- if (obj.messageSignature && !obj.dsseEnvelope) {
182
+ /** @internal The verification material's certificate is a oneof of the same kind. Both arms set
183
+ * draws the leaf from one and the chain from the other, so the certificate whose key is checked and
184
+ * the certificates it is checked through come from different statements about the same signer. */
185
+ var vmArms = 0;
186
+ if (_armPresent(obj.verificationMaterial, "certificate")) vmArms++;
187
+ if (_armPresent(obj.verificationMaterial, "x509CertificateChain")) vmArms++;
188
+ if (_armPresent(obj.verificationMaterial, "publicKey")) vmArms++;
189
+ if (vmArms > 1) {
190
+ throw _err("sigstore/bad-bundle", "verificationMaterial carries more than one of certificate, x509CertificateChain and publicKey; it is a oneof and exactly one arm may be present");
191
+ }
192
+ /** @internal The bundle's content is a protobuf oneof, so a bundle setting both arms is malformed
193
+ * and is refused rather than read as whichever arm this build happens to support: verifying the
194
+ * envelope and passing over the other arm reports a verdict that says nothing about content the
195
+ * bundle carries. The two refusals are separate because a caller can act on one and not the other. */
196
+ if (_armPresent(obj, "messageSignature") && _armPresent(obj, "dsseEnvelope")) {
197
+ throw _err("sigstore/bad-bundle", "bundle carries both dsse_envelope and message_signature; the bundle content is a oneof and exactly one arm may be present");
198
+ }
199
+ if (_armPresent(obj, "messageSignature")) {
174
200
  throw _err("sigstore/unsupported-content", "a message_signature bundle is not supported (only dsse_envelope)");
175
201
  }
176
202
  if (!obj.dsseEnvelope || typeof obj.dsseEnvelope !== "object") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blamejs/pki",
3
- "version": "0.6.53",
3
+ "version": "0.6.55",
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:258eb315-4dba-4e0f-8600-313c47a1a144",
5
+ "serialNumber": "urn:uuid:03ece622-aaca-4a54-b858-4ae7bbb58893",
6
6
  "version": 1,
7
7
  "metadata": {
8
- "timestamp": "2026-09-07T16:58:48.291Z",
8
+ "timestamp": "2026-09-08T07:28:55.626Z",
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.6.53",
22
+ "bom-ref": "@blamejs/pki@0.6.55",
23
23
  "type": "application",
24
24
  "name": "pki",
25
- "version": "0.6.53",
25
+ "version": "0.6.55",
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.6.53",
29
+ "purl": "pkg:npm/%40blamejs/pki@0.6.55",
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.6.53",
57
+ "ref": "@blamejs/pki@0.6.55",
58
58
  "dependsOn": []
59
59
  }
60
60
  ]