Encrypted share links — destinations, sign-in waits, revoke and auto-revoke. A repository rule for apps/daemon/src/v1/shares/**; read it before editing a file there.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rule Shares?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/geniro-io-rule-shares)
---
name: rule-shares
description: "Encrypted share links — destinations, sign-in waits, revoke and auto-revoke. A repository rule for apps/daemon/src/v1/shares/**; read it before editing a file there."
---
<!-- GENERATED by scripts/sync-agent-rules.mjs from .claude/rules/shares.md. DO NOT EDIT: edit the source, then run `pnpm sync:agent-rules`. -->
# Shares
`v1/shares` — encrypted share links for artifacts (`ShareService`, `/v1/shares/*`, all behind `DesktopOnlyGuard`).
- The config is pushed by Electron main (`PUT /v1/shares/config`) on every daemon start, after a Settings restart and after each settings write that changed it; it is held in memory only. Until the first push nothing is shared (`configReceivedAt` null).
- A share reads the newest stored version (`ArtifactStoreService.latest`, in-process only), builds the saved-file document (`ArtifactPageService.document`, which carries no audio or video — those are served only to the framed page) with the pressed theme baked in (`portable-artifact.ts`; an agent's share reuses the last press's theme), encrypts it (`share-envelope.ts`: AES-256-GCM, fresh IV per upload, AAD `geniro-share-v1`) and uploads only the envelope from a 0600 temp file.
- One share per (run, artifact): sharing again re-uploads to the same object under the same key, so the link handed out keeps working. Operations on one page are serialized.
- Keys: `ShareKeychain` (`services/share-keychain.service.ts`) writes through `security -i` on stdin (never argv), confirms by reading back, and `registerSecret`s every key it mints or reads.
- Destination CLIs run through `runManagedCommand` (`v1/agents/utils/managed-command.ts`): argv only, ProcessRegistry, child journal, group kill at the deadline. Custom command tokens refuse shell characters and a shell program, on both sides of the settings twin.
- Signed out (`utils/share-auth.ts`): a destination's sign-in profile is gcloud's for `gcs`, aws's for `s3`, a custom command's own `signIn` (login argv + case-insensitive output patterns), or — without one — gcloud's or aws's when the upload program is named so. Before every upload the profile's credential check runs with stdout DISCARDED (`runManagedCommand`'s `discardStdout`: `gcloud auth print-access-token` prints a live token). A failure is a sign-in problem only by the profile's patterns, never a spawn error or a timeout, and never when the output says the network failed (gcloud wraps a DNS failure in its token-refresh error). Such a share is kept `awaiting-sign-in` with its key already minted (`sharedVersion` 0 = never uploaded; the column stays NOT NULL, because a nullability change rebuilds the table) and every asking agent recorded (`asker`, a list: each is woken). `ShareSignInService` runs the login on the user's press (one session per destination, Cancel, 5-minute deadline), re-checks, then `retryAwaiting` once at the newest version: `live`, still `awaiting-sign-in`, or `failed`. Every outcome wakes the askers through `HostWakeBus` — never with a link while agents may not share (a link not yet sent is withdrawn, a wake already waiting for its turn included; a note already owed is not recalled), and the boot sweep waits for the first settings push to know; each asker leaves the row as its wake settles, and `agentToldAt` is set once none is left — a turn opened on it, or its note owed to the conversation's next turn — and the boot sweep after listen re-sends only what never got that far. An agent's waiting share is dropped on any settings push with the switch off (the first after a restart too) and at retry time. A share never uploaded is dropped on its run's delete or archive, and one whose place was removed from Settings ends `failed` with its asker told; one holding an older upload goes back to `live`. Known limits (user decision): an owed note is in memory, so a quit before the conversation's next turn loses it (the card still shows the link) — each link reaches the agent at most once; and a finished team run has no waker after a daemon restart (one is installed per pass), so a share settled then reaches its node as an owed note, not a turn. Writes are broadcast as `shares_changed` (no link) to the Mac's own sockets only (the `desktop` room; a socket the LAN gateway stamped `x-geniro-via: remote` never joins it).
- Revoke: remote delete first, then the key, then the row. A failed remote delete keeps both and marks the row `revoke-failed`; an object already gone counts as revoked only where the CLI says so plainly — gcloud's "matched no objects", or `aws s3 rm`'s exit 0; a custom command is judged by its exit status alone, and a timeout never counts as gone. The remote delete is never run by run teardown or the archive sweep; only a share never uploaded is dropped with its run (above).
- Revoke all (`POST /v1/shares/revoke-all`, given the ids the user saw listed, never "everything now") and the auto-revoke sweep revoke one page at a time through `revoke`, carry on past a failure and report `{revoked, failed, detail}`. The sweep revokes pages whose `createdAt` (the first share; a re-share keeps it) is older than the pushed `autoRevokeAfterDays`, re-asking the setting before each page. It runs a minute after the daemon starts and every 6 h, never on a config push, so changing the setting revokes nothing in the same gesture.