lacewing 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.2.0] - 2026-09-26
6
+
7
+ ### Features
8
+
9
+ - Export parseJsonObject, the strict JSON reading tokens get
10
+
5
11
  ## [1.1.0] - 2026-09-26
6
12
 
7
13
  ### Bug Fixes
package/README.md CHANGED
@@ -433,14 +433,15 @@ aliases:
433
433
  ### Building on Lacewing: `lacewing/extension`
434
434
 
435
435
  For packages that add a check on top of a Lacewing profile and must agree with
436
- Lacewing about what a valid algorithm or duration is. It is covered by semver
437
- like the root export, and it is read-only:
436
+ Lacewing about what a valid algorithm, duration or JWS segment is. It is
437
+ covered by semver like the root export, and it is read-only:
438
438
 
439
439
  ```ts
440
- import { getAlgorithmProperties, parseDuration, readHeaderValue } from "lacewing/extension";
440
+ import { getAlgorithmProperties, parseDuration, parseJsonObject, readHeaderValue } from "lacewing/extension";
441
441
 
442
442
  getAlgorithmProperties("ES256"); // { name: "ES256", kty: "EC", crv: "P-256", minKeyBits: 256 }, frozen
443
443
  parseDuration("15m"); // 900, as DurationSeconds
444
+ parseJsonObject(text, "header"); // a plain object, or JWTInvalid; a member named twice is refused
444
445
  readHeaderValue(request, "dpop", "verifyProof"); // same source rules as parseBearer
445
446
  ```
446
447
 
@@ -9,8 +9,14 @@
9
9
  * it refuses an embedded `jwk`, which is right for a token and wrong for
10
10
  * any format that carries its own key, so each format owns its header
11
11
  * rules.
12
+ *
13
+ * `parseJsonObject` is the strict JSON reading a token's header and payload
14
+ * get: a plain object, and no member name twice at any depth. A format that
15
+ * reads JSON out of a JWS reads it the same way, so the two cannot disagree
16
+ * about which of two `alg` or `htu` members counts.
12
17
  */
13
18
  export { getAlgorithmProperties } from "./lib/algorithms.js";
19
+ export { parseJsonObject } from "./lib/json.js";
14
20
  export { parseDuration } from "./lib/duration.js";
15
21
  export { readHeaderValue } from "./http/source.js";
16
22
  //# sourceMappingURL=extension.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension.js","sourceRoot":"","sources":["../../src/extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,sBAAsB,EAAsB,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAqB,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"extension.js","sourceRoot":"","sources":["../../src/extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,sBAAsB,EAAsB,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAqB,MAAM,kBAAkB,CAAC"}
@@ -9,8 +9,14 @@
9
9
  * it refuses an embedded `jwk`, which is right for a token and wrong for
10
10
  * any format that carries its own key, so each format owns its header
11
11
  * rules.
12
+ *
13
+ * `parseJsonObject` is the strict JSON reading a token's header and payload
14
+ * get: a plain object, and no member name twice at any depth. A format that
15
+ * reads JSON out of a JWS reads it the same way, so the two cannot disagree
16
+ * about which of two `alg` or `htu` members counts.
12
17
  */
13
18
  export { getAlgorithmProperties, type AlgorithmInfo } from "./lib/algorithms.js";
19
+ export { parseJsonObject } from "./lib/json.js";
14
20
  export { parseDuration } from "./lib/duration.js";
15
21
  export { readHeaderValue, type HeaderSource } from "./http/source.js";
16
22
  //# sourceMappingURL=extension.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../src/extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,sBAAsB,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../src/extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,sBAAsB,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lacewing",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "An opinionated JWT library that makes RFC 8725 (JWT Best Current Practices) the default behavior, not an optional configuration.",
5
5
  "type": "module",
6
6
  "engines": {