feat(pq-jws/ts): phase 3 - signing verification orchestration (ENG-1642)#20
feat(pq-jws/ts): phase 3 - signing verification orchestration (ENG-1642)#20eacet wants to merge 1 commit intofeature/eng-1641from
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ebdeecaa8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| assertSupportedAlgorithm(input.protectedHeader.alg); | ||
|
|
||
| const payloadBytes = | ||
| typeof input.payload === 'string' ? textEncoder.encode(input.payload) : input.payload; | ||
| const encodedProtectedHeader = encodeProtectedHeader(input.protectedHeader); |
There was a problem hiding this comment.
Validate full protected header before signing
signJwsCompact only checks alg and then serializes input.protectedHeader directly, so it can emit tokens with headers that this same package later rejects during parse/verify (for example b64: false, malformed crit, or runtime-invalid field types like non-string kid). That creates a round-trip break where signing succeeds but verification fails for the generated token, which is avoidable by running the same protected-header validation rules on the signing path.
Useful? React with 👍 / 👎.
Greptile SummaryCompletes phase 3 of the post-quantum JWS implementation by implementing the core signing and verification orchestration logic. The PR transforms four stub functions ( Key changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant signJwsCompact
participant assertSupportedAlgorithm
participant Signer
participant assertSignatureBytes
participant serializeJwsCompact
Note over Caller,serializeJwsCompact: Signing Flow
Caller->>signJwsCompact: input {protectedHeader, payload, signer}
signJwsCompact->>assertSupportedAlgorithm: validate alg
assertSupportedAlgorithm-->>signJwsCompact: validated
signJwsCompact->>signJwsCompact: encode payload & header
signJwsCompact->>signJwsCompact: create signing input
signJwsCompact->>Signer: call with signing input & context
Signer-->>signJwsCompact: signature bytes
signJwsCompact->>assertSignatureBytes: validate Uint8Array
assertSignatureBytes-->>signJwsCompact: validated signature
signJwsCompact->>serializeJwsCompact: serialize segments
serializeJwsCompact-->>Caller: compact JWS string
participant Caller2 as Caller
participant verifyJwsCompact
participant parseJwsCompact
participant Verifier
participant assertVerificationResult
Note over Caller2,assertVerificationResult: Verification Flow
Caller2->>verifyJwsCompact: compact, verifier, options
verifyJwsCompact->>parseJwsCompact: parse with options
parseJwsCompact-->>verifyJwsCompact: parsed {signingInput, signature, ...}
verifyJwsCompact->>assertSupportedAlgorithm: validate alg
assertSupportedAlgorithm-->>verifyJwsCompact: validated
verifyJwsCompact->>Verifier: call with signingInput, signature, context
Verifier-->>verifyJwsCompact: boolean result
verifyJwsCompact->>assertVerificationResult: validate boolean
assertVerificationResult-->>Caller2: true/false
Last reviewed commit: 4ebdeec |

Summary
Package(s)
Languages
Checklist
biome check,cargo fmt)Related Issues