You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* deps: bump lestrrat-go/jwx/v4 to v4.5.0
Update the foreign-JWS dependency and docs that pinned the previous floor.
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs: add foreign-JWS algorithm policy plan
Capture the agreed allowlist + infer-alg NewJWSVerifier design for v0.6.x so it is not lost before implementation.
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: foreign-JWS allowlist, infer-alg verify, registry-only algs
Break NewJWSVerifier into infer vs WithAlg with JWSAlgAllowlist policy,
require SignAlg(false) on NewJWSSigner, and resolve algs via the jwx
registry so handcrafted none/unknown names cannot bypass hardening.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: satisfy lint on JWK public-key export asserts
Use comma-ok type assertions for ML-DSA/Ed25519 Public() results and
avoid deprecated ecdsa.PublicKey X/Y fields in nil-curve tests.
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: add Fields.AddRequestComponent for ;req bindings
Convenience wrapper for required associated-request components, with
tests and a v0.6.1 release-notes mention.
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: locate signatures by tag via MessageDetails
Add MessageDetails.Label and Request/Response DetailsByTag (strict) and
DetailsListByTag (lenient) helpers with sentinel errors, example, and
v0.6.1 release notes.
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor: single-pass Signature-Input walk for DetailsByTag
Build all MessageDetails from headers once instead of listing labels
and re-parsing per name; share psiSignatureFromInnerList with parse path.
Co-authored-by: Cursor <cursoragent@cursor.com>
* test: broaden ByTag and signatureDetailsListFromHeaders coverage
Cover response ambiguity, multi-tag/combined headers, missing Signature
members, and nil/empty/malformed SFV edge cases.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: treat EdDSA and Ed25519 as equivalent for JWK infer
Map OKP crv Ed25519 to RFC 9864 EdDSAEd25519, and accept legacy JWK
alg "EdDSA" (and matching allowlist entries) as the same crypto.
Co-authored-by: Cursor <cursoragent@cursor.com>
* test: fuzz foreign JWS sign/verify, infer, and ML-DSA
Add dedicated fuzz targets for ES256 and ML-DSA-44 round-trips,
Signature-header panic hunting, JWK inference, and constructor alg checks.
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: add NewJWSSignerFromJWK for private JWK signing
Infer alg from a private jwk.Key (same rules as verify), export raw
private material, and construct a foreign JWS signer. Closes#24.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: disambiguate fuzz target names for CI -fuzz regexp
Rename FuzzVerifyRequestJWS to FuzzJWSVerifyRequest so it is not a
substring of FuzzVerifyRequest, and anchor CI/local -fuzz patterns.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,15 +44,16 @@ fields.go / digest.go ← Component field abstraction + Content-Digest head
44
44
### Key types
45
45
46
46
-**`Signer` / `Verifier`** (`crypto.go`) — hold algorithm, key, and signing config. Created via `NewXxxSigner` / `NewXxxVerifier` constructors (HMAC-SHA256, RSA, RSA-PSS, P-256, P-384, Ed25519, JWS).
47
-
- Foreign JWS key↔alg checks live in **`jwskey.go`** (explicit stdlib types; does not use deprecated `jws.AlgorithmsForKey`).
47
+
- Foreign JWS key↔alg checks live in **`jwskey.go`**/ **`jwsinfer.go`**(explicit stdlib types + JWK/ECDSA/ML-DSA alg inference; does not use deprecated `jws.AlgorithmsForKey`).
48
48
-**`SignConfig` / `VerifyConfig`** (`config.go`) — builder-style configuration for signature metadata (keyID, nonce, tag, expiry, clock tolerance). Constructed via `NewSignConfig()` / `NewVerifyConfig()` with method chaining.
49
+
-**`JWSAlgAllowlist`** (`jwsallow.go`) — foreign-verify alg policy for `NewJWSVerifier` / `NewJWSVerifierWithAlg` (`nil` = no policy).
49
50
-**`Fields`** (`fields.go`) — specifies which HTTP components (headers, derived components) to include in the signature. Use the `Fields("header1", "@method", ...)` helper or `NewFields()` for complex cases.
50
51
-**`Message` / `MessageDetails`** (`message.go`) — internal canonicalized request/response representation. `MessageDetails` is the public output of `RequestDetails` / `ResponseDetails`.
Optional foreign JWS uses `lestrrat-go/jwx/v4` via `NewJWSSigner` / `NewJWSVerifier` (including ML-DSA with `crypto/mldsa` on Go 1.27+). Requires Go 1.27+.
56
+
Optional foreign JWS uses `lestrrat-go/jwx/v4` via `NewJWSSigner` / `NewJWSSignerFromJWK` / `NewJWSVerifier` (infer) / `NewJWSVerifierWithAlg` (including ML-DSA with `crypto/mldsa` on Go 1.27+). Requires Go 1.27+.
Copy file name to clipboardExpand all lines: README.md
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,35 +27,37 @@ in the [API reference](https://pkg.go.dev/github.com/yaronf/httpsign).
27
27
_ = res.Body.Close()
28
28
```
29
29
30
-
### Upgrading from v0.5.x
30
+
### Upgrading
31
31
32
-
**v0.6.0**is a breaking release for foreign-JWS users and raises the Go floor to **1.27+**.
32
+
**v0.6.0**(shipped) raised the Go floor to **1.27+** and cut foreign JWS over to **jwx v4** + ML-DSA. See [internal-docs/RELEASE-v0.6.0.md](internal-docs/RELEASE-v0.6.0.md).
33
33
34
-
| Caller | Change |
35
-
|--------|--------|
36
-
| Native algorithms only (RSA, ECDSA, Ed25519, HMAC) | Upgrade Go to 1.27+; no API changes. |
37
-
|`NewJWSSignerV3` / `NewJWSVerifierV3`| Use `NewJWSSigner` / `NewJWSVerifier` with `github.com/lestrrat-go/jwx/v4/jwa`. |
38
-
|`NewJWSSigner` / `NewJWSVerifier` (jwx v2) | Same: v4 import path; algorithms are functions (`jwa.ES256()`, not string constants). |
34
+
**v0.6.1** breaks foreign-JWS **verify** again: prefer `NewJWSVerifier(allowed, key, …)` (infer alg); use `NewJWSVerifierWithAlg` when needed; pass a `JWSAlgAllowlist` (`nil` skips policy). `NewJWSSigner` defaults to / requires `SignAlg(false)`; use `NewJWSSignerFromJWK` when the private key is a JWK.
39
35
40
-
Foreign JWS signing must use `SignConfig.SignAlg(false)` — RFC 9421 does not define an HTTP `alg` value for arbitrary JWS algorithms. Verification policy `SetAllowedAlgs` applies to the optional HTTP `alg` signature parameter in the message, not to the JWS algorithm passed to `NewJWSVerifier`.
Full migration notes: [internal-docs/RELEASE-v0.6.0.md](internal-docs/RELEASE-v0.6.0.md) (maintainers: paste **Summary** into the GitHub release).
42
+
Pass a non-nil allowlist when `keyid` can select among keys. `SetAllowedAlgs` still only filters Signature-Input `alg`, not JWS `jwa`.
43
+
44
+
Full notes: [internal-docs/RELEASE-v0.6.1.md](internal-docs/RELEASE-v0.6.1.md).
43
45
44
46
### Foreign JWS and ML-DSA
45
47
46
-
Optional algorithms beyond the native set use [`lestrrat-go/jwx/v4`](https://github.com/lestrrat-go/jwx) (≥ v4.4.0) via `NewJWSSigner` / `NewJWSVerifier`. Requires **Go 1.27+** (stdlib `encoding/json/v2`; no `GOEXPERIMENT`).
48
+
Optional algorithms beyond the native set use [`lestrrat-go/jwx/v4`](https://github.com/lestrrat-go/jwx) (≥ v4.5.0) via `NewJWSSigner` / `NewJWSSignerFromJWK` / `NewJWSVerifier`.
47
49
48
-
**ML-DSA (FIPS 204)**is supported through the same constructors with `crypto/mldsa` keys and `jwa.MLDSA44()` / `MLDSA65()` / `MLDSA87()`. RFC 9421 does not assign HTTP Message Signatures algorithm identifiers for ML-DSA; treat it like other foreign JWS algorithms (`SignAlg(false)`, JWS `alg` in the JWS layer only if your profile requires it).
50
+
**ML-DSA (FIPS 204)**works through the same path with `crypto/mldsa` keys. Prefer inferring the alg from the public key:
0 commit comments