@tinytars/vault 0.1.15 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +24 -0
  2. package/package.json +8 -1
package/README.md CHANGED
@@ -120,6 +120,23 @@ against the D1 adapter passes against it, unmodified), and `adapters/pages-http`
120
120
  wrapper, not a rewrite, for Cloudflare Pages Functions' request shape). Full picture:
121
121
  [`ARCHITECTURE.md` § Adapters](ARCHITECTURE.md#adapters).
122
122
 
123
+ ### Reference client: auth flows wired to a real API
124
+
125
+ `auth-client.ts`, `auth-recovery.ts`, `auth-support.ts`, `auth-grants.ts`, and `org-recovery.ts`:
126
+ browser-side orchestration for signup, password/passkey login, Google SSO bootstrap, recovery-code
127
+ issuance and redemption, provider/support access grants, and account-settings method management —
128
+ built on `crypto.ts`'s primitives, calling a specific set of `/api/auth/*`, `/api/account/*`,
129
+ `/api/support/*`, and `/api/providers/*` routes. `vault-session.ts` holds the `VaultEntry`/
130
+ `VaultSession` types and `openVault()` these flows share to open a decrypted vault once a key is in
131
+ hand.
132
+
133
+ Unlike the four pieces above, this layer is a **reference implementation, not a portable
134
+ primitive** — it's wired to one server API shape (documented in
135
+ [`ARCHITECTURE.md` § Reference auth client](ARCHITECTURE.md#reference-auth-client-auth-clientts-and-friends)),
136
+ the same way `vault-sink.ts`'s `r2Sink`/`localSink` are wired to specific save-vault routes. Read
137
+ it as a worked example of composing `crypto.ts` into real signup/login/recovery/support flows, not
138
+ something you import and point at your own backend unless your routes happen to match.
139
+
123
140
  ## Install
124
141
 
125
142
  ```
@@ -248,6 +265,13 @@ is entirely your own auth middleware's job. See `THREAT_MODEL.md`'s "trust bound
248
265
  | `adapters/memory.ts` | In-memory implementations of all five `stores.ts` contracts — the reference adapter that proves the interfaces are actually storage-agnostic, not just Cloudflare-shaped |
249
266
  | `adapters/pages-http.ts` | `pagesHandler()` — wraps a portable `(request, deps) => Promise<Response>` handler into Cloudflare Pages Functions' `onRequestX({request, env, params})` shape |
250
267
  | `adapters/conformance.ts` | Shared vitest contract suites for each `stores.ts` interface, run against every adapter above so "storage-agnostic" is proven, not asserted |
268
+ | `auth-client.ts` | Password/passkey/Google signup, login, session resume, account-settings method management — the browser-side orchestration wiring `crypto.ts` to a specific `/api/auth/*`/`/api/account/*` API. Reference client, not a portable primitive |
269
+ | `auth-recovery.ts` | Recovery-code issuance/redemption (owner and provider-issued), DEK rotation, access-event log fetch — same reference-client caveat as `auth-client.ts` |
270
+ | `auth-support.ts` | Audited support-agent access: patient approves a pending request, support enters via an audited endpoint; support→provider roster access |
271
+ | `auth-grants.ts` | Provider/clinician grant CRUD from the patient side: lookup, grant, revoke |
272
+ | `org-recovery.ts` | Backfills the org-recovery envelope for accounts that predate or missed it at signup — best-effort, never blocks an unlock |
273
+ | `vault-session.ts` | `VaultEntry`/`VaultSession` types plus `openVault()` — the decrypt-and-open-session step every unlock path shares |
274
+ | `base64.ts` | Byte ↔ base64 codec used throughout the client layer |
251
275
 
252
276
  Full design, including the exact envelope byte layout and why extractable keys are a deliberate
253
277
  choice, is in `ARCHITECTURE.md` — see **What it does** above for the featureset summary and the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinytars/vault",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Runtime-agnostic key derivation, authenticated envelope encryption, and storage-agnostic access-control contracts for per-user encrypted data.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,6 +35,13 @@
35
35
  "./envelope-access": "./envelope-access.ts",
36
36
  "./break-glass": "./break-glass.ts",
37
37
  "./blob-store": "./blob-store.ts",
38
+ "./auth-client": "./auth-client.ts",
39
+ "./auth-recovery": "./auth-recovery.ts",
40
+ "./auth-support": "./auth-support.ts",
41
+ "./auth-grants": "./auth-grants.ts",
42
+ "./org-recovery": "./org-recovery.ts",
43
+ "./vault-session": "./vault-session.ts",
44
+ "./base64": "./base64.ts",
38
45
  "./adapters/d1": "./adapters/d1/index.ts",
39
46
  "./adapters/r2": "./adapters/r2.ts",
40
47
  "./adapters/memory": "./adapters/memory.ts",