fix(protocol): document unlockTokenHash in SessionState + clarify signed fields#45
Open
Relevant47 wants to merge 1 commit into
Open
fix(protocol): document unlockTokenHash in SessionState + clarify signed fields#45Relevant47 wants to merge 1 commit into
Relevant47 wants to merge 1 commit into
Conversation
`shared/protocol.ts`'s SessionState interface was missing the `unlockTokenHash` field that is part of the HMAC signature payload in both daemons (`SessionService.cs:418-422`, `SessionService.swift:322-336`), and the signature comment misleadingly implied pomodoroConfig was signed. Add `unlockTokenHash?: string | null`, annotate which fields are not signed, and replace the signature comment with the explicit field list from ARCHITECTURE.md so anyone porting the daemon to a third platform sees the exact payload composition without cross-referencing. No on-disk format change; both daemons already produce/consume this field. Optional in TS because the field is null when no friend-lock token is in use. Fixes #43
✅ Deploy Preview for focuslock-app ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
shared/protocol.ts'sSessionStateinterface was missingunlockTokenHash, even though both daemons include it in the HMAC signature payload. The comment onsignaturealso misleadingly impliedpomodoroConfigwas signed when it isn't. A developer porting the daemon to a third platform would have produced an incompatible signature.Files changed
shared/protocol.ts— addunlockTokenHash?: string | null, annotate which fields are not signed, and replace the signature comment with the explicit field list (matchesARCHITECTURE.md§"Signature computation").Verification against both daemons
SessionService.cs:418-422— payload concatenates…|allowlistedDomains|UnlockTokenHash.SessionService.swift:322-336— same parts array includingunlockTokenHash.SessionState.cs:25,Models.swift:23) already define the field, so no daemon-side change is needed to stay in sync. Made the TS field?: string | nullto match the Swift/C# nullable shape.Fixes #43
Risk tier
Trivial / single-file documentation + type addition → normal PR, ready for review.
No on-disk format change; existing
session.jsonfiles continue to verify because the daemons already write/readunlockTokenHash. The only callers inui/re-export the type — no construction sites needed updating.🤖 Generated with Claude Code
Generated by Claude Code