Skip to content

B1: keep usage counts, consent-link state and the audit log outside the container #50

Closed

Description

@jerryfane

Part of #46. Owner decision 2026-10-14 (via Jarvis, recorded on #46): per-person keyrings run on Cloudflare Containers (B1): keyring's Go binary unchanged, one container per person, controlled by one Durable Object (DO) per person. File mode for the owner's Mac stays the default and unchanged; everything here is opt-in. No Cloudflare account changes or spending without the owner's approval.

Depends on #45 (instance mode: encrypted state, admin API).

Problem

Today daily-limit counts and open consent links (#44) live in memory, and the audit log is a file. In a container that sleeps after 10 minutes, the counts reset (daily limits stop working), open links die, and the audit log is lost.

Change

  • Daily counts: part of the state the DO keeps (or the DO enforces them), so a sleep or restart does not reset a limit.
  • Consent links and sign-ins in progress: kept in the DO, or the container kept awake while a link is open (sleepAfter longer than the link lifetime). Pick one and say why.
  • Audit: written to stdout (Workers logs) or posted to the DO, one JSON line per event, never a key value, as today.

Acceptance

  • A daily limit still holds after the instance restarts in the middle of the day (test).
  • A link created before a restart either still works or is refused cleanly; never half-works.
  • Audit lines survive the container being stopped.

Activity

  1. added a commit that references this issue on Oct 14, 2026
  2. jerryfane commented on Oct 14, 2026

    @jerryfane
    ContributorAuthor

    Keyring side merged in #56: GET /usage and usage on unlock. The Durable Object side (keeping usage, keeping the container up while links are open, audit to stdout) comes with the Cloudflare template under deploy/cloudflare.

  3. added a commit that references this issue on Oct 14, 2026
  4. jerryfane commented on Oct 14, 2026

    @jerryfane
    ContributorAuthor

    Done: keyring side in #56, Durable Object side in #57.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions