Cogneris
Environmental Compliance & Inspection

Intent · Every environmental obligation current and evidenced — zero reportable exceedances at Woodbine (UTS).

Operating tolerance: issues closed in ≤ 5 days · no repeat findings · every permit condition met.

← Documentsdocs/PLAN-secrets-secauth-sovereignty.md1,617 words

Plan — secrets management, SecAuth, sovereignty, and notifications

Status: PLAN, for direction. Written 2026-08-04 by Claude Opus 5 (Claude Code). Companion to PLAN-repos-and-sites.md.

Four things were asked for together because they are one thing: who is allowed to know what, where that knowledge physically sits, and how a person is told.

This is not greenfield. Two assets already exist and should be the substrate rather than being rebuilt:

  • VEP — Verifiable Event Protocol (draft RFC set, RFC-0000..0004) already states the model: identity is cryptographic keys · actions are signed events over commodity relays · durable state lives in portable data pods · decisions are replayable with cryptographic evidence. That is self-sovereign identity, already specified.
  • Rivetly/Cogneris-Identity (incl. voice-identity-prototype) and Rivetly/infra/services/voice-auth — existing prototypes.

Part 1 — secrets management

1.1 Layer 0 is done (2026-08-04)

Implemented today by scripts/relocate-env.sh:

~/.Projects/<same path as the repo>/.env     real values · mode 600 · store 700
   ▲ symlink from the repo, so tooling works unchanged
<repo>/.env.example                          SAME KEYS, no values · committed

Six real .env files relocated (17 secret values). No real .env was ever tracked by git, so this is prevention, not cleanup.

~/foreman/.env stays where it is — it is the runner's own environment, not a project's.

1.2 The problem layer 0 does not solve

GapConsequence
One machineCoreArivant is a single point of loss. The laptop had no copy of these
No rotationNothing records when a secret was issued, by whom, or when it expires
No auditNobody can answer "what read this key, and when"
No per-environment separationdev / staging / prod share a namespace
Human-readable at restDisk encryption is the only control

1.3 Proposed layers

LayerWhatRecommendation
L0 · local~/.Projects + symlinks + .env.exampledone
L1 · encrypted at restage/SOPS-encrypted files committed encrypted into the repo, decrypted by a key held outside itRecommended next. Survives machine loss, restores the "everything in git" property, no server to run
L2 · runtimeCloudflare Worker secrets / D1 for deployed servicesalready the pattern esg-web uses
L3 · managedA secrets service with rotation, lease and auditonly once L1 is not enough. See §3 — jurisdiction decides the vendor

Recommendation: L1 with SOPS + age. It is a file format, not a service; it works offline; the encrypted file is safe to commit, which restores the property that made this problem — a repo that contains everything it needs.


Part 2 — SecAuth

2.1 What it is for

Central to Rivetly, and the same primitive the ESG portal is blocked on: S1 identity and S2 an approval that names a person and their grounds. Every governance feature in this estate is waiting on it.

2.2 Build it on VEP, not beside it

VEP already saysSecAuth consequence
identity is cryptographic keysno password database exists to breach; enrolment is key generation, not account creation
actions are signed eventsan approval is a signed event — exactly the S2 vocabulary the ESG portal needs
state lives in portable data podsthe subject holds their data; the platform holds a reference
decisions are replayable with evidenceaudit is a replay, not a log nobody reads

A second identity model would be the same failure the ESG role model warns about: a portal enum that disagrees with the read plane produces someone who can approve what they cannot see. One vocabulary.

2.3 Capabilities, in build order

  1. Enrolment & key custody — device-bound keys (Secure Enclave / StrongBox; the ESG field app already targets both)
  2. Authentication — passkeys/WebAuthn as the default human factor
  3. Authorisation — band × scope × grants, the model already written in PORTAL-ROLES.md
  4. Signed approval — approve/reject with a reason, appended, naming the actor
  5. Delegation & revocation — the part every prototype omits and every audit asks for
  6. Recovery — the hardest problem in self-sovereignty. Social/threshold recovery, decided before launch, not after the first lost device

2.4 The recovery warning

Self-sovereignty makes recovery hard on purpose. If the platform can recover a user's key, the platform can impersonate the user, and the sovereignty claim is marketing. If it cannot, a lost device is a lost identity. There is no third option — only a deliberate choice of threshold scheme and guardians. Decide this before enrolment ships, because it cannot be retrofitted onto issued keys.


Part 3 — sovereignty, and a contradiction to resolve

3.1 Two different claims

  • Self-sovereignty — the subject controls their identity and data. VEP already specifies this. Achievable.
  • Data sovereignty from the US and other countries — data is not subject to a given jurisdiction's legal reach. This is a jurisdiction problem, not an encryption problem, and it is where the plan currently contradicts itself.

3.2 The contradiction, stated plainly

**Everything in this estate deploys to Cloudflare. Cloudflare is a US company. Under the CLOUD Act, a US provider can be compelled to produce data it controls *regardless of where that data is physically stored.*** Choosing an EU or Canadian region reduces latency and satisfies some regulators; it does not by itself remove US legal reach over a US provider.

Data-localisation controls constrain where bytes sit. They do not change *who can be served an order*. Any claim of "sovereignty from the US" that runs on a US provider needs to be either narrowed or engineered around.

3.3 The three honest options

OptionWhat it buysWhat it costs
A · Localisation only — Cloudflare regional services, EU/CA data residencyregulatory alignment (GDPR, PIPEDA), latency, easydoes not defeat CLOUD Act reach. Cannot honestly be sold as sovereignty from the US
B · Zero-knowledge on top of any host — the provider only ever holds ciphertext; keys live with the subject (VEP pods)a compelled provider can produce nothing readable. Sovereignty becomes a cryptographic property, not a jurisdictional promiseserver-side search, aggregation and analytics get much harder. Recovery gets harder (§2.4)
C · Non-US hosting for the sovereign tierremoves the US provider from the control patha second operational estate; cost, and the same question recurs for whichever country hosts it

Recommendation: B, with A as a complement. It is the only option whose guarantee does not depend on a government's restraint, and it is the natural extension of what VEP already says — the subject holds the keys. Use A for regulatory alignment. Reserve C for a tier that genuinely needs it.

The design consequence to accept early: if the host only holds ciphertext, the platform cannot do server-side analytics over that data. That constraint has to be designed in from the start, not discovered when the first dashboard is requested.


Part 4 — notifications, in-app and SMS

4.1 What is needed

The ESG portal already names the gap: *"Notifications — absent: nothing can reach this device."* Approvals, assignments and due dates are all inert without a channel. This is shared infrastructure, not a Rivetly-only feature.

ChannelUse
In-app / pushthe default — assignment, approval requested, due/overdue
Emailanything that must be retrievable later
SMSreach when nothing else will — outages, field crews, statutory clocks
Voiceescalation of last resort

4.2 The rule that keeps it honest

**A notification is a pointer, never the payload.** "An approval is waiting" — not the finding, the site or the name. In a zero-knowledge design (§3.3 B) the notification service sits outside the trust boundary, so anything in the message body has left it.

4.3 SMS deserves a warning

SMS is fine for notification and wrong for authentication.

  • SS7 interception and SIM-swap are practical, not theoretical
  • Messages traverse carriers and aggregators — commonly US-routed, which directly contradicts §3
  • NIST deprecated SMS as an out-of-band authenticator years ago

Use SMS to tell someone something is waiting. Never to prove who they are. Passkeys are the factor (§2.3). Using SMS OTP on a platform whose thesis is sovereignty would undermine the thesis in the most visible place.


Decisions needed

IDQuestionBlocks
SEC-1Adopt SOPS + age for L1 encrypted-at-rest secrets? (recommended)secrets beyond one machine
SEC-2Is SecAuth built on VEP, or does VEP stay a published protocol while SecAuth is separate? (recommend on VEP)all of Part 2
SEC-3Recovery model — threshold/social guardians, or accepted key loss? Must be decided before enrolment shipsPart 2 launch
SEC-4Sovereignty option A, B or C (recommend B + A)hosting, and every analytics feature
SEC-5Does "sovereignty from the US" have to survive a compelled US provider? If yes, A alone is not enough and Cloudflare cannot be the only hostSEC-4
SEC-6Notification provider — and does it sit inside or outside the trust boundary?Part 4
SEC-7Which estate owns notifications: Rivetly, Cogneris platform, or shared? ESG needs it toosequencing