fix(session-key): name missing permissions in Synapse.create error#805
Merged
Conversation
Previously, Synapse.create threw a single generic "Session key does not have the required permissions" message, leaving the caller to guess which of the four FWSS permissions were missing or expired. The error now lists each missing permission by its EIP-712 type name, distinguishes "not authorized" (expiry === 0n) from "expired at <ISO timestamp>", points to @filoz/synapse-core as the escape hatch for narrower permission scopes, and links to the session keys docs. Also adds a "All-or-nothing in @filoz/synapse-sdk" subsection to the session keys guide documenting the philosophy: synapse-sdk requires all DefaultFwssPermissions; use synapse-core directly for selective scopes. Exports a new PermissionNames map from @filoz/synapse-core/session-key mapping each FWSS permission hash to its human-readable EIP-712 type name, for reuse in error messages and debug output. Closes #695. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
synapse-dev | 455d3d6 | Commit Preview URL Branch Preview URL |
May 28 2026, 01:32 PM |
rvagg
approved these changes
May 29, 2026
Collaborator
rvagg
left a comment
There was a problem hiding this comment.
that there's a verbose error message; but I suppose it's not bad in an AI world where agents read these things
Member
Author
|
Yeah, it might be a bit too nice for an error string, but that's also a good problem to have. Let's revisit if there's additional feedback |
This was referenced May 23, 2026
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
Closes #695. Implements the plan from BigLep's comment on that issue: update the docs to capture the session-key philosophy, and replace the generic error with a more informative one.
What changed
Informative error in
Synapse.create(packages/synapse-sdk/src/synapse.ts:61). The previous message was a single line that didn't tell the caller which permission was missing. The new message:CreateDataSet,AddPieces,SchedulePieceRemovals,TerminateService)expiry === 0n) from "expired at<ISO timestamp>"SessionKey.login+syncExpirationsto extend, or dropping to@filoz/synapse-corefor a narrower scopeNew
PermissionNamesexport (packages/synapse-core/src/session-key/permissions.ts). ARecord<Hex, string>mapping each FWSS permission hash to its human-readable EIP-712 type name, reusable in error messages and debug output.Docs: philosophy section (docs/src/content/docs/developer-guides/session-keys.mdx). New "All-or-nothing in
@filoz/synapse-sdk" subsection under "Use with the Synapse class" documenting thatSynapse.createrequires all four FWSS permissions by design, and pointing users who want a narrower scope at@filoz/synapse-core.Out of scope
SgtPooki's later comment proposes a
requiredPermissions?: Permission[]option onSynapseOptionsto let callers opt into a narrower required set without leavingSynapse.create. Not included here — happy to do that as a follow-up if you want to keep this PR focused on the agreed-upon error + docs change.Test plan
pnpm run buildcleanpnpm run lintclean@filoz/synapse-sdkpass, including two new tests in packages/synapse-sdk/src/test/session-keys.test.ts:Synapse.createsucceeds when all four permissions are valid🤖 Generated with Claude Code