Skip to content

fix(react): gate reads and decrypts on permit validity, not existence - #305

Open
alexshchur wants to merge 2 commits into
masterfrom
fix/permit-validity-gate
Open

fix(react): gate reads and decrypts on permit validity, not existence#305
alexshchur wants to merge 2 commits into
masterfrom
fix/permit-validity-gate

Conversation

@alexshchur

Copy link
Copy Markdown
Contributor

useCofheReadContract enabled its query whenever an active permit merely existed, while its own disabledDueToMissingValidPermit flag checks isValid — so an expired active permit passed the gate, fired the ciphertext read + decrypt pipeline, and produced guaranteed Permit is expired failures in the error surface.

useCofheDecrypt had no permit gate at all; since ciphertext reads are cached, an input fetched while the permit was valid kept re-firing doomed decrypts after expiry.

Both gates now require a currently valid active permit, matching the flag the hook already reports (the exported helper's param is renamed hasActivePermithasValidActivePermit accordingly). No behavior change for valid permits; consumers keyed on disabledDueToMissingValidPermit see consistent semantics.

Tests: existing suite passes (8/8) after building the workspace deps.

useCofheReadContract enabled its query whenever an active permit merely
existed, while its own disabledDueToMissingValidPermit flag checks
isValid — so an expired active permit passed the gate, fired the
ciphertext read + decrypt pipeline, and produced guaranteed
'Permit is expired' failures. useCofheDecrypt had no permit gate at
all, so a ciphertext cached while the permit was valid kept re-firing
doomed decrypts after expiry.

Both gates now require a currently valid active permit, matching the
reported flag.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8dfc877

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
cofhesdk-docs-gh-action Ready Ready Preview Aug 7, 2026 9:46am
cofhesdk-react Ready Ready Preview Aug 7, 2026 9:46am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cofhesdk-docs Ignored Ignored Aug 7, 2026 9:46am

Request Review

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.

1 participant