Skip to content

fix(protocol): document unlockTokenHash in SessionState + clarify signed fields#45

Open
Relevant47 wants to merge 1 commit into
mainfrom
fix/issue-43-protocol-unlock-token-hash
Open

fix(protocol): document unlockTokenHash in SessionState + clarify signed fields#45
Relevant47 wants to merge 1 commit into
mainfrom
fix/issue-43-protocol-unlock-token-hash

Conversation

@Relevant47
Copy link
Copy Markdown
Owner

Summary

shared/protocol.ts's SessionState interface was missing unlockTokenHash, even though both daemons include it in the HMAC signature payload. The comment on signature also misleadingly implied pomodoroConfig was 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 — add unlockTokenHash?: string | null, annotate which fields are not signed, and replace the signature comment with the explicit field list (matches ARCHITECTURE.md §"Signature computation").

Verification against both daemons

  • Windows SessionService.cs:418-422 — payload concatenates …|allowlistedDomains|UnlockTokenHash.
  • macOS SessionService.swift:322-336 — same parts array including unlockTokenHash.
  • Both daemon models (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 | null to 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.json files continue to verify because the daemons already write/read unlockTokenHash. The only callers in ui/ re-export the type — no construction sites needed updating.

🤖 Generated with Claude Code


Generated by Claude Code

`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
@netlify
Copy link
Copy Markdown

netlify Bot commented May 31, 2026

Deploy Preview for focuslock-app ready!

Name Link
🔨 Latest commit 22ca039
🔍 Latest deploy log https://app.netlify.com/projects/focuslock-app/deploys/6a1b982d3e15410008a9ebbd
😎 Deploy Preview https://deploy-preview-45--focuslock-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
focus-lock Ready Ready Preview, Comment May 31, 2026 2:08am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

protocol.ts SessionState missing unlockTokenHash field — signature comment is misleading

2 participants