@pithy-sh/auth 0.15.3 → 0.17.0

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 (209) hide show
  1. package/README.md +4 -0
  2. package/dist/attestation/appAttest/assertion.d.ts +32 -0
  3. package/dist/attestation/appAttest/assertion.d.ts.map +1 -0
  4. package/dist/attestation/appAttest/assertion.js +59 -0
  5. package/dist/attestation/appAttest/attestation.d.ts +49 -0
  6. package/dist/attestation/appAttest/attestation.d.ts.map +1 -0
  7. package/dist/attestation/appAttest/attestation.js +111 -0
  8. package/dist/attestation/appAttest/authData.d.ts +24 -0
  9. package/dist/attestation/appAttest/authData.d.ts.map +1 -0
  10. package/dist/attestation/appAttest/authData.js +32 -0
  11. package/dist/attestation/appAttest/base64.d.ts +8 -0
  12. package/dist/attestation/appAttest/base64.d.ts.map +1 -0
  13. package/dist/attestation/appAttest/base64.js +27 -0
  14. package/dist/attestation/appAttest/bytes.d.ts +7 -0
  15. package/dist/attestation/appAttest/bytes.d.ts.map +1 -0
  16. package/dist/attestation/appAttest/bytes.js +19 -0
  17. package/dist/attestation/appAttest/cbor.d.ts +20 -0
  18. package/dist/attestation/appAttest/cbor.d.ts.map +1 -0
  19. package/dist/attestation/appAttest/cbor.js +96 -0
  20. package/dist/attestation/appAttest/der.d.ts +38 -0
  21. package/dist/attestation/appAttest/der.d.ts.map +1 -0
  22. package/dist/attestation/appAttest/der.js +106 -0
  23. package/dist/attestation/appAttest/keys.d.ts +15 -0
  24. package/dist/attestation/appAttest/keys.d.ts.map +1 -0
  25. package/dist/attestation/appAttest/keys.js +37 -0
  26. package/dist/attestation/appAttest/root.d.ts +9 -0
  27. package/dist/attestation/appAttest/root.d.ts.map +1 -0
  28. package/dist/attestation/appAttest/root.js +12 -0
  29. package/dist/attestation/appAttest/verifier.d.ts +39 -0
  30. package/dist/attestation/appAttest/verifier.d.ts.map +1 -0
  31. package/dist/attestation/appAttest/verifier.js +121 -0
  32. package/dist/attestation/appAttest/x509.d.ts +50 -0
  33. package/dist/attestation/appAttest/x509.d.ts.map +1 -0
  34. package/dist/attestation/appAttest/x509.js +163 -0
  35. package/dist/attestation/challenge.d.ts +26 -0
  36. package/dist/attestation/challenge.d.ts.map +1 -0
  37. package/dist/attestation/challenge.js +47 -0
  38. package/dist/attestation/config.d.ts +72 -0
  39. package/dist/attestation/config.d.ts.map +1 -0
  40. package/dist/attestation/config.js +52 -0
  41. package/dist/attestation/errors.d.ts +30 -0
  42. package/dist/attestation/errors.d.ts.map +1 -0
  43. package/dist/attestation/errors.js +45 -0
  44. package/dist/attestation/gate.d.ts +27 -0
  45. package/dist/attestation/gate.d.ts.map +1 -0
  46. package/dist/attestation/gate.js +78 -0
  47. package/dist/attestation/playIntegrity/google.d.ts +47 -0
  48. package/dist/attestation/playIntegrity/google.d.ts.map +1 -0
  49. package/dist/attestation/playIntegrity/google.js +178 -0
  50. package/dist/attestation/playIntegrity/verdict.d.ts +40 -0
  51. package/dist/attestation/playIntegrity/verdict.d.ts.map +1 -0
  52. package/dist/attestation/playIntegrity/verdict.js +93 -0
  53. package/dist/attestation/playIntegrity/verifier.d.ts +22 -0
  54. package/dist/attestation/playIntegrity/verifier.d.ts.map +1 -0
  55. package/dist/attestation/playIntegrity/verifier.js +64 -0
  56. package/dist/attestation/verifier.d.ts +60 -0
  57. package/dist/attestation/verifier.d.ts.map +1 -0
  58. package/dist/attestation/verifier.js +46 -0
  59. package/dist/attestation/wire.d.ts +42 -0
  60. package/dist/attestation/wire.d.ts.map +1 -0
  61. package/dist/attestation/wire.js +72 -0
  62. package/dist/capability.d.ts +49 -6
  63. package/dist/capability.d.ts.map +1 -1
  64. package/dist/capability.js +42 -7
  65. package/dist/client/api.d.ts +37 -24
  66. package/dist/client/api.d.ts.map +1 -1
  67. package/dist/client/api.js +52 -41
  68. package/dist/client/attestation.d.ts +148 -0
  69. package/dist/client/attestation.d.ts.map +1 -0
  70. package/dist/client/attestation.js +321 -0
  71. package/dist/client/projection.d.ts +29 -4
  72. package/dist/client/projection.d.ts.map +1 -1
  73. package/dist/data/appAttestKey.d.ts +30 -0
  74. package/dist/data/appAttestKey.d.ts.map +1 -0
  75. package/dist/data/appAttestKey.js +25 -0
  76. package/dist/data/attestationChallenge.d.ts +17 -0
  77. package/dist/data/attestationChallenge.d.ts.map +1 -0
  78. package/dist/data/attestationChallenge.js +19 -0
  79. package/dist/data/tables.d.ts +19 -1
  80. package/dist/data/tables.d.ts.map +1 -1
  81. package/dist/data/tables.js +6 -2
  82. package/dist/data/userLifecycle.d.ts +1 -0
  83. package/dist/data/userLifecycle.d.ts.map +1 -1
  84. package/dist/data/userLifecycle.js +3 -2
  85. package/dist/hooks/runtime.d.ts +32 -0
  86. package/dist/hooks/runtime.d.ts.map +1 -0
  87. package/dist/hooks/runtime.js +25 -0
  88. package/dist/http/adminRoutes.d.ts.map +1 -1
  89. package/dist/http/adminRoutes.js +4 -2
  90. package/dist/http/devLoginRoute.js +3 -3
  91. package/dist/http/resolve.d.ts.map +1 -1
  92. package/dist/http/resolve.js +3 -2
  93. package/dist/http/responses.d.ts +15 -0
  94. package/dist/http/responses.d.ts.map +1 -1
  95. package/dist/http/responses.js +13 -2
  96. package/dist/http/routes.d.ts +5 -1
  97. package/dist/http/routes.d.ts.map +1 -1
  98. package/dist/http/routes.js +92 -25
  99. package/dist/http/schemas.d.ts +7 -0
  100. package/dist/http/schemas.d.ts.map +1 -1
  101. package/dist/http/schemas.js +7 -1
  102. package/dist/index.js +1 -1
  103. package/dist/instance/secrets.d.ts +86 -7
  104. package/dist/instance/secrets.d.ts.map +1 -1
  105. package/dist/instance/secrets.js +54 -8
  106. package/dist/lifecycle/erasure.d.ts.map +1 -1
  107. package/dist/lifecycle/erasure.js +2 -1
  108. package/dist/lifecycle/hooks.d.ts +18 -10
  109. package/dist/lifecycle/hooks.d.ts.map +1 -1
  110. package/dist/lifecycle/request.d.ts +2 -1
  111. package/dist/lifecycle/request.d.ts.map +1 -1
  112. package/dist/lifecycle/request.js +4 -1
  113. package/dist/lifecycle/transitions.d.ts +24 -16
  114. package/dist/lifecycle/transitions.d.ts.map +1 -1
  115. package/dist/lifecycle/transitions.js +27 -16
  116. package/dist/migrations/0009_attestation_challenges.d.ts +9 -0
  117. package/dist/migrations/0009_attestation_challenges.d.ts.map +1 -0
  118. package/dist/migrations/0009_attestation_challenges.js +21 -0
  119. package/dist/migrations/0010_app_attest_keys.d.ts +9 -0
  120. package/dist/migrations/0010_app_attest_keys.d.ts.map +1 -0
  121. package/dist/migrations/0010_app_attest_keys.js +17 -0
  122. package/dist/migrations/0011_retained_basis_key.d.ts +10 -0
  123. package/dist/migrations/0011_retained_basis_key.d.ts.map +1 -0
  124. package/dist/migrations/0011_retained_basis_key.js +18 -0
  125. package/dist/migrations/set.d.ts +4 -1
  126. package/dist/migrations/set.d.ts.map +1 -1
  127. package/dist/migrations/set.js +8 -2
  128. package/dist/purge/run.d.ts +11 -11
  129. package/dist/purge/run.d.ts.map +1 -1
  130. package/dist/purge/run.js +9 -8
  131. package/dist/purge/workflow.d.ts +7 -1
  132. package/dist/purge/workflow.d.ts.map +1 -1
  133. package/dist/purge/workflow.js +6 -2
  134. package/dist/seeds/devSession.js +1 -1
  135. package/dist/test-utils/appAttestDevice.d.ts +92 -0
  136. package/dist/test-utils/appAttestDevice.d.ts.map +1 -0
  137. package/dist/test-utils/appAttestDevice.js +282 -0
  138. package/dist/test-utils/appAttestSample.d.ts +22 -0
  139. package/dist/test-utils/appAttestSample.d.ts.map +1 -0
  140. package/dist/test-utils/appAttestSample.js +24 -0
  141. package/dist/test-utils/googlePlay.d.ts +47 -0
  142. package/dist/test-utils/googlePlay.d.ts.map +1 -0
  143. package/dist/test-utils/googlePlay.js +117 -0
  144. package/dist/test-utils/liveApp.d.ts +76 -36
  145. package/dist/test-utils/liveApp.d.ts.map +1 -1
  146. package/dist/test-utils/liveApp.js +16 -5
  147. package/dist/test-utils/rollbackThrough.d.ts +11 -0
  148. package/dist/test-utils/rollbackThrough.d.ts.map +1 -0
  149. package/dist/test-utils/rollbackThrough.js +16 -0
  150. package/dist/test-utils/scopedBackend.d.ts +25 -0
  151. package/dist/test-utils/scopedBackend.d.ts.map +1 -1
  152. package/dist/test-utils/scopedBackend.js +1 -1
  153. package/dist/version.generated.d.ts +1 -1
  154. package/dist/version.generated.js +1 -1
  155. package/docs/account-lifecycle.md +46 -10
  156. package/docs/attestation.md +173 -0
  157. package/package.json +5 -5
  158. package/pithy.manifest.json +14 -0
  159. package/src/attestation/appAttest/assertion.ts +65 -0
  160. package/src/attestation/appAttest/attestation.ts +159 -0
  161. package/src/attestation/appAttest/authData.ts +45 -0
  162. package/src/attestation/appAttest/base64.ts +29 -0
  163. package/src/attestation/appAttest/bytes.ts +18 -0
  164. package/src/attestation/appAttest/cbor.ts +116 -0
  165. package/src/attestation/appAttest/der.ts +126 -0
  166. package/src/attestation/appAttest/keys.ts +57 -0
  167. package/src/attestation/appAttest/root.ts +13 -0
  168. package/src/attestation/appAttest/verifier.ts +113 -0
  169. package/src/attestation/appAttest/x509.ts +209 -0
  170. package/src/attestation/challenge.ts +56 -0
  171. package/src/attestation/config.ts +118 -0
  172. package/src/attestation/errors.ts +60 -0
  173. package/src/attestation/gate.ts +105 -0
  174. package/src/attestation/playIntegrity/google.ts +239 -0
  175. package/src/attestation/playIntegrity/verdict.ts +149 -0
  176. package/src/attestation/playIntegrity/verifier.ts +77 -0
  177. package/src/attestation/verifier.ts +87 -0
  178. package/src/attestation/wire.ts +79 -0
  179. package/src/capability.ts +85 -16
  180. package/src/client/api.ts +73 -40
  181. package/src/client/attestation.ts +404 -0
  182. package/src/client/projection.ts +29 -4
  183. package/src/data/appAttestKey.ts +45 -0
  184. package/src/data/attestationChallenge.ts +23 -0
  185. package/src/data/tables.ts +5 -1
  186. package/src/data/userLifecycle.ts +9 -2
  187. package/src/hooks/runtime.ts +41 -0
  188. package/src/http/adminRoutes.ts +14 -7
  189. package/src/http/resolve.ts +8 -4
  190. package/src/http/responses.ts +29 -1
  191. package/src/http/routes.ts +128 -38
  192. package/src/http/schemas.ts +24 -0
  193. package/src/instance/secrets.ts +88 -9
  194. package/src/lifecycle/erasure.ts +2 -1
  195. package/src/lifecycle/hooks.ts +22 -10
  196. package/src/lifecycle/request.ts +4 -1
  197. package/src/lifecycle/transitions.ts +47 -28
  198. package/src/migrations/0009_attestation_challenges.ts +28 -0
  199. package/src/migrations/0010_app_attest_keys.ts +27 -0
  200. package/src/migrations/0011_retained_basis_key.ts +19 -0
  201. package/src/migrations/set.ts +7 -1
  202. package/src/purge/run.ts +29 -17
  203. package/src/purge/workflow.ts +7 -3
  204. package/src/test-utils/appAttestDevice.ts +399 -0
  205. package/src/test-utils/appAttestSample.ts +20 -0
  206. package/src/test-utils/googlePlay.ts +144 -0
  207. package/src/test-utils/liveApp.ts +31 -5
  208. package/src/test-utils/rollbackThrough.ts +24 -0
  209. package/src/version.generated.ts +1 -1
@@ -64,6 +64,7 @@ function encoded(row) {
64
64
  notify: row.notify === void 0 || row.notify === null ? null : SQLiteBoolean.encode(row.notify),
65
65
  mode: row.mode ?? null,
66
66
  purgeAfter: row.purgeAfter ? SQLiteDate.encode(row.purgeAfter) : null,
67
+ basisKey: row.basisKey ?? null,
67
68
  createdAt: SQLiteDate.encode(row.at)
68
69
  };
69
70
  }
@@ -156,7 +157,7 @@ async function mail(deps, enabled, to, locale, template, payload) {
156
157
  async function fire(deps, name, hook, event) {
157
158
  if (!hook) return;
158
159
  try {
159
- await hook(event, deps.d1);
160
+ await hook(event, deps.d1, deps.runtime);
160
161
  } catch (error) {
161
162
  deps.log?.warn(`${name} threw; the transition stands`, {
162
163
  userId: event.userId,
@@ -186,7 +187,7 @@ function raced(userId) {
186
187
  });
187
188
  }
188
189
  /**
189
- * The instant a purge-window guard compares against, **read when the statement runs**, as ms-epoch (#622).
190
+ * The instant a purge-window guard compares against, **read when the statement runs**, as ms-epoch.
190
191
  *
191
192
  * A restore and a purge's `due` check race for one account, and each has to see the window the other saw. A
192
193
  * timestamp the restore took before its statement went out is stale by the time D1 runs it: the window can
@@ -213,7 +214,7 @@ function windowClosed(userId, closes) {
213
214
  * conflict rather than a no-op, and names `restoreRoute` when the caller gives one. A suspension whose end has
214
215
  * passed is not in force, and a new one replaces it.
215
216
  *
216
- * **An account already suspended has its terms restated (#621).** The reason and the end are replaced, a
217
+ * **An account already suspended has its terms restated.** The reason and the end are replaced, a
217
218
  * `suspended` row records the new reason — the newest one is what the person is shown — and the audit event
218
219
  * and the mail say so. The start is kept, and no hook fires: the account was suspended and still is, so
219
220
  * nothing transitioned. A fresh suspension that loses the race to another suspension finds the account
@@ -342,7 +343,7 @@ function userPurgeWindowDays(config) {
342
343
  * Restorable until then. The deletion-scheduled mail carries the purge date and, when the config names one,
343
344
  * the restore path. A deleted account deleted softly again is no transition.
344
345
  *
345
- * **Hard** (#622): `purgeAfter` is now, so the window is already closed — nothing can restore it — and the
346
+ * **Hard**: `purgeAfter` is now, so the window is already closed — nothing can restore it — and the
346
347
  * caller starts the purge. No deletion-scheduled mail, because nothing is scheduled; the purge sends the
347
348
  * deletion-complete one. An account already deleted softly has its purge brought forward to now, which is
348
349
  * written and audited but fires no hook: the account was deleted and still is. One already due is unchanged.
@@ -441,7 +442,8 @@ async function deleteUser(deps, input) {
441
442
  * 404 whose action says the data is gone — read off the history row the purge leaves behind, so it is told
442
443
  * apart from an id that never existed.
443
444
  *
444
- * An account that is not deleted is no transition. A suspension it was under is still in force after.
445
+ * An account that is not deleted is no transition, and fires nothing. A suspension it was under is still in force
446
+ * after. `onUserRestored` fires once the restore is written, so an adopter can undo what it did on `onUserDeleted`.
445
447
  */
446
448
  async function restoreUser(deps, input) {
447
449
  const at = (deps.now ?? (() => /* @__PURE__ */ new Date()))();
@@ -485,6 +487,12 @@ async function restoreUser(deps, input) {
485
487
  throw raced(input.userId);
486
488
  }
487
489
  await audit(deps, AuthAuditActions.adminUserRestored, input.userId, input.actor, { reason });
490
+ await fire(deps, "onUserRestored", deps.hooks.onUserRestored, {
491
+ userId: input.userId,
492
+ actor: input.actor,
493
+ reason,
494
+ at
495
+ });
488
496
  return {
489
497
  changed: true,
490
498
  mailed: false,
@@ -506,12 +514,13 @@ async function purgedRefusal(db, userId) {
506
514
  });
507
515
  }
508
516
  /**
509
- * The account's row, or the refusal for one that is not there — the 404 that says the data is gone when the
510
- * purge erased it, and the plain one otherwise. For a route that reads an account outside a transition: the
511
- * export.
517
+ * The account's stored locale, or the refusal for an account that is not there — the 404 that says the data is gone
518
+ * when the purge erased it, and the plain one otherwise. For a route that reads an account outside a transition: the
519
+ * export, which answers in the person's own language.
512
520
  */
513
521
  async function requirePresent(db, userId) {
514
- if (await db.selectFrom("pithyAuthUsers").select("id").where("id", "=", userId).executeTakeFirst()) return;
522
+ const row = await db.selectFrom("pithyAuthUsers").select(["id", "locale"]).where("id", "=", userId).executeTakeFirst();
523
+ if (row) return { locale: row.locale ?? null };
515
524
  throw await purgedRefusal(db, userId) ?? new NotFoundError({
516
525
  message: "No such user.",
517
526
  detail: `no pithy_auth_users row for ${userId}`
@@ -523,7 +532,7 @@ const PURGE = {
523
532
  id: null
524
533
  };
525
534
  /**
526
- * Whether one account is due for its purge, who its last mail goes to, and whether it goes (#622).
535
+ * Whether one account is due for its purge, who its last mail goes to, and whether it goes.
527
536
  *
528
537
  * `due` only for an account that is deleted and whose `purgeAfter` has passed — the cron and a hard deletion
529
538
  * both start a purge, and this is the one check either passes through, so an account restored in between is
@@ -560,14 +569,14 @@ async function purgeSubject(deps, userId) {
560
569
  };
561
570
  }
562
571
  /**
563
- * The account's address, as a purge step reads it (#814) — `null` when there is no account, or no address. Read
572
+ * The account's address, as a purge step reads it — `null` when there is no account, or no address. Read
564
573
  * inside the step that asks, so it is never carried in a Workflow's journal.
565
574
  */
566
575
  async function purgeAddress(db, userId) {
567
576
  return (await db.selectFrom("pithyAuthUsers").select("email").where("id", "=", userId).executeTakeFirst())?.email ?? null;
568
577
  }
569
578
  /**
570
- * The accounts whose purge is due — deleted, with `purgeAfter` passed — oldest first, at most `limit` (#622).
579
+ * The accounts whose purge is due — deleted, with `purgeAfter` passed — oldest first, at most `limit`.
571
580
  * What the daily cron starts a purge for. An account still inside its window is not here, and neither is one
572
581
  * that was restored. Each carries its deletion's start, which names the purge's instance (`../purge/start.ts`).
573
582
  */
@@ -581,7 +590,8 @@ async function duePurges(deps, limit) {
581
590
  /**
582
591
  * Record that one purge step — one capability's contribution — erased its rows. The contribution's summary is
583
592
  * the row's reason, so the history says what the step erased and not only that it ran. With `retained`, the step
584
- * kept its rows instead (#814): the row is `purge_retained`, and its reason is the basis the capability gave.
593
+ * kept its rows instead: the row is `purge_retained`, its reason is the basis the capability gave, and its
594
+ * `basisKey` the catalog key that translates it, when the capability names one.
585
595
  */
586
596
  async function recordPurgeStep(deps, input) {
587
597
  const at = (deps.now ?? (() => /* @__PURE__ */ new Date()))();
@@ -591,7 +601,8 @@ async function recordPurgeStep(deps, input) {
591
601
  actor: PURGE,
592
602
  reason: input.summary?.trim() ? input.summary.trim().slice(0, 500) : null,
593
603
  at,
594
- step: input.step
604
+ step: input.step,
605
+ basisKey: input.retained ? input.basisKey ?? null : null
595
606
  });
596
607
  await audit(deps, AuthAuditActions.adminUserPurgeStep, input.userId, PURGE, {
597
608
  step: input.step,
@@ -599,7 +610,7 @@ async function recordPurgeStep(deps, input) {
599
610
  });
600
611
  }
601
612
  /**
602
- * Record that a purge gave up (#823): the step it stopped at, in the history and in the trail. The daily pass starts
613
+ * Record that a purge gave up: the step it stopped at, in the history and in the trail. The daily pass starts
603
614
  * the purge again tomorrow, so this is where it stands until then, not an end. The failure's message is never
604
615
  * written: it is code the kit did not write, and it may name the person.
605
616
  */
@@ -616,7 +627,7 @@ async function recordPurgeFailure(deps, input) {
616
627
  await audit(deps, AuthAuditActions.adminUserPurgeFailed, input.userId, PURGE, { step: input.step });
617
628
  }
618
629
  /**
619
- * The deletion-complete mail, sent **before the address is erased** (#622). The purge calls this after every
630
+ * The deletion-complete mail, sent **before the address is erased**. The purge calls this after every
620
631
  * other capability's rows are gone and before auth's own, which holds the address, so the last mail is
621
632
  * enqueued while there is still an account to have sent it to. The address is handed in, captured before the
622
633
  * first step. `notify: false` sends nothing, whatever the config says.
@@ -0,0 +1,9 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import type { Migration } from "kysely/migration";
4
+ /**
5
+ * `pithy_auth_attestation_challenges`: one row per challenge the attestation challenge route issued and nobody
6
+ * has presented yet. See `../attestation/challenge.ts`. Every date is `integer`, ms-epoch.
7
+ */
8
+ export declare const auth_0009_attestation_challenges: Migration;
9
+ //# sourceMappingURL=0009_attestation_challenges.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"0009_attestation_challenges.d.ts","sourceRoot":"","sources":["../../src/migrations/0009_attestation_challenges.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKlD;;;GAGG;AACH,eAAO,MAAM,gCAAgC,EAAE,SAc9C,CAAC"}
@@ -0,0 +1,21 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ //#region src/migrations/0009_attestation_challenges.ts
4
+ /** How the issue path finds the challenges that have run out. */
5
+ const EXPIRES_INDEX = "pithyAuthAttestationChallengesExpiresAtIdx";
6
+ /**
7
+ * `pithy_auth_attestation_challenges`: one row per challenge the attestation challenge route issued and nobody
8
+ * has presented yet. See `../attestation/challenge.ts`. Every date is `integer`, ms-epoch.
9
+ */
10
+ const auth_0009_attestation_challenges = {
11
+ async up(db) {
12
+ await db.schema.createTable("pithyAuthAttestationChallenges").addColumn("id", "text", (c) => c.primaryKey()).addColumn("issuedAt", "integer", (c) => c.notNull()).addColumn("expiresAt", "integer", (c) => c.notNull()).execute();
13
+ await db.schema.createIndex(EXPIRES_INDEX).on("pithyAuthAttestationChallenges").column("expiresAt").execute();
14
+ },
15
+ async down(db) {
16
+ await db.schema.dropIndex(EXPIRES_INDEX).execute();
17
+ await db.schema.dropTable("pithyAuthAttestationChallenges").execute();
18
+ }
19
+ };
20
+ //#endregion
21
+ export { auth_0009_attestation_challenges };
@@ -0,0 +1,9 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import type { Migration } from "kysely/migration";
4
+ /**
5
+ * `pithy_auth_app_attest_keys`: one row per App Attest key an iOS app registered. See `../data/appAttestKey.ts`.
6
+ * Every date is `integer`, ms-epoch.
7
+ */
8
+ export declare const auth_0010_app_attest_keys: Migration;
9
+ //# sourceMappingURL=0010_app_attest_keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"0010_app_attest_keys.d.ts","sourceRoot":"","sources":["../../src/migrations/0010_app_attest_keys.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAgBvC,CAAC"}
@@ -0,0 +1,17 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ //#region src/migrations/0010_app_attest_keys.ts
4
+ /**
5
+ * `pithy_auth_app_attest_keys`: one row per App Attest key an iOS app registered. See `../data/appAttestKey.ts`.
6
+ * Every date is `integer`, ms-epoch.
7
+ */
8
+ const auth_0010_app_attest_keys = {
9
+ async up(db) {
10
+ await db.schema.createTable("pithyAuthAppAttestKeys").addColumn("id", "text", (c) => c.primaryKey()).addColumn("publicKey", "text", (c) => c.notNull()).addColumn("appId", "text", (c) => c.notNull()).addColumn("environment", "text", (c) => c.notNull()).addColumn("counter", "integer", (c) => c.notNull()).addColumn("createdAt", "integer", (c) => c.notNull()).addColumn("lastUsedAt", "integer").execute();
11
+ },
12
+ async down(db) {
13
+ await db.schema.dropTable("pithyAuthAppAttestKeys").execute();
14
+ }
15
+ };
16
+ //#endregion
17
+ export { auth_0010_app_attest_keys };
@@ -0,0 +1,10 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import type { Migration } from "kysely/migration";
4
+ /**
5
+ * `basis_key` on `pithy_auth_user_lifecycle`: the catalog key a retained step's basis translates through, beside the
6
+ * English basis in `reason`. Null on every other row, on a retained step that names no key, and on one recorded
7
+ * before this ran. Appended: the chain is released history.
8
+ */
9
+ export declare const auth_0011_retained_basis_key: Migration;
10
+ //# sourceMappingURL=0011_retained_basis_key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"0011_retained_basis_key.d.ts","sourceRoot":"","sources":["../../src/migrations/0011_retained_basis_key.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,SAO1C,CAAC"}
@@ -0,0 +1,18 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ //#region src/migrations/0011_retained_basis_key.ts
4
+ /**
5
+ * `basis_key` on `pithy_auth_user_lifecycle`: the catalog key a retained step's basis translates through, beside the
6
+ * English basis in `reason`. Null on every other row, on a retained step that names no key, and on one recorded
7
+ * before this ran. Appended: the chain is released history.
8
+ */
9
+ const auth_0011_retained_basis_key = {
10
+ async up(db) {
11
+ await db.schema.alterTable("pithyAuthUserLifecycle").addColumn("basisKey", "text").execute();
12
+ },
13
+ async down(db) {
14
+ await db.schema.alterTable("pithyAuthUserLifecycle").dropColumn("basisKey").execute();
15
+ }
16
+ };
17
+ //#endregion
18
+ export { auth_0011_retained_basis_key };
@@ -10,7 +10,7 @@
10
10
  * migration. Adding a `0002` turned all five into a schema one column short of the code, and the symptom
11
11
  * was `table pithy_auth_sessions has no column named authenticated_at` in thirteen unrelated tests.
12
12
  *
13
- * `0003` through `0007` appended here and reached every reader, which is the point. `0001_init.workers.test.ts` is deliberately not a reader:
13
+ * Every later migration is appended here and reaches every reader, which is the point. `0001_init.workers.test.ts` is deliberately not a reader:
14
14
  * its subject is that one migration's own `up` and `down`, so it names it directly.
15
15
  */
16
16
  export declare const AUTH_MIGRATIONS: {
@@ -22,5 +22,8 @@ export declare const AUTH_MIGRATIONS: {
22
22
  readonly "0006_verification_outcomes": import("kysely/migration").Migration;
23
23
  readonly "0007_erasure_record": import("kysely/migration").Migration;
24
24
  readonly "0008_last_active": import("kysely/migration").Migration;
25
+ readonly "0009_attestation_challenges": import("kysely/migration").Migration;
26
+ readonly "0010_app_attest_keys": import("kysely/migration").Migration;
27
+ readonly "0011_retained_basis_key": import("kysely/migration").Migration;
25
28
  };
26
29
  //# sourceMappingURL=set.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/migrations/set.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe;aAC1B,WAAW;aACX,+BAA+B;aAC/B,8BAA8B;aAC9B,qBAAqB;aACrB,iBAAiB;aACjB,4BAA4B;aAC5B,qBAAqB;aACrB,kBAAkB;CACV,CAAC"}
1
+ {"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/migrations/set.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe;aAC1B,WAAW;aACX,+BAA+B;aAC/B,8BAA8B;aAC9B,qBAAqB;aACrB,iBAAiB;aACjB,4BAA4B;aAC5B,qBAAqB;aACrB,kBAAkB;aAClB,6BAA6B;aAC7B,sBAAsB;aACtB,yBAAyB;CACjB,CAAC"}
@@ -8,6 +8,9 @@ import { auth_0005_purge_once } from "./0005_purge_once.js";
8
8
  import { auth_0006_verification_outcomes } from "./0006_verification_outcomes.js";
9
9
  import { auth_0007_erasure_record } from "./0007_erasure_record.js";
10
10
  import { auth_0008_last_active } from "./0008_last_active.js";
11
+ import { auth_0009_attestation_challenges } from "./0009_attestation_challenges.js";
12
+ import { auth_0010_app_attest_keys } from "./0010_app_attest_keys.js";
13
+ import { auth_0011_retained_basis_key } from "./0011_retained_basis_key.js";
11
14
  //#region src/migrations/set.ts
12
15
  /**
13
16
  * Every migration `@pithy-sh/auth` ships, keyed as `pithy migrate` composes them.
@@ -19,7 +22,7 @@ import { auth_0008_last_active } from "./0008_last_active.js";
19
22
  * migration. Adding a `0002` turned all five into a schema one column short of the code, and the symptom
20
23
  * was `table pithy_auth_sessions has no column named authenticated_at` in thirteen unrelated tests.
21
24
  *
22
- * `0003` through `0007` appended here and reached every reader, which is the point. `0001_init.workers.test.ts` is deliberately not a reader:
25
+ * Every later migration is appended here and reaches every reader, which is the point. `0001_init.workers.test.ts` is deliberately not a reader:
23
26
  * its subject is that one migration's own `up` and `down`, so it names it directly.
24
27
  */
25
28
  const AUTH_MIGRATIONS = {
@@ -30,7 +33,10 @@ const AUTH_MIGRATIONS = {
30
33
  "0005_purge_once": auth_0005_purge_once,
31
34
  "0006_verification_outcomes": auth_0006_verification_outcomes,
32
35
  "0007_erasure_record": auth_0007_erasure_record,
33
- "0008_last_active": auth_0008_last_active
36
+ "0008_last_active": auth_0008_last_active,
37
+ "0009_attestation_challenges": auth_0009_attestation_challenges,
38
+ "0010_app_attest_keys": auth_0010_app_attest_keys,
39
+ "0011_retained_basis_key": auth_0011_retained_basis_key
34
40
  };
35
41
  //#endregion
36
42
  export { AUTH_MIGRATIONS };
@@ -1,12 +1,12 @@
1
1
  // SPDX-FileCopyrightText: 2026 Pithy
2
2
  // SPDX-License-Identifier: MIT
3
- import { type PurgeStep } from "@pithy-sh/core/src/capability/purge";
3
+ import { type PurgeStep, type RetainingPurgeContribution } from "@pithy-sh/core/src/capability/purge";
4
4
  import type { LegalHolds } from "@pithy-sh/core/src/retention/holds";
5
5
  import { type TerminalErrorConstructor, type WorkflowStepLike } from "@pithy-sh/core/src/workflow/faults";
6
6
  import { type DuePurge, type LifecycleDeps } from "../lifecycle/transitions";
7
7
  import { type AuthPurgeDueParams, type AuthPurgeParams } from "./specs";
8
8
  /**
9
- * The purge, as steps (#622) — the bodies `./workflow.ts` hands a Workflow's step runner to.
9
+ * The purge, as steps — the bodies `./workflow.ts` hands a Workflow's step runner to.
10
10
  *
11
11
  * ## One step per contribution, and the order they run in
12
12
  *
@@ -14,7 +14,7 @@ import { type AuthPurgeDueParams, type AuthPurgeParams } from "./specs";
14
14
  * and one already erased all end the run here, having erased nothing. This is the one check a cron-started
15
15
  * purge and a hard deletion's both pass through, so re-running a purge for the same subject exits cleanly.
16
16
  * 2. **`erase <capability>`** — one step per composed contribution, in composition order, each recording that it
17
- * ran in `pithy_auth_user_lifecycle`. A contribution that **retains** its rows (#814) is a `retain <capability>`
17
+ * ran in `pithy_auth_user_lifecycle`. A contribution that **retains** its rows is a `retain <capability>`
18
18
  * step instead: it erases nothing, and records `purge_retained` with the basis it gave. Handed to the platform's retry unclassified: an `erase` is idempotent by
19
19
  * contract and runs code the kit did not write, so any fault in it is worth another attempt (`./retryPolicy.ts`).
20
20
  * A failing contribution retries alone, and the ones that finished are served from the journal.
@@ -24,7 +24,7 @@ import { type AuthPurgeDueParams, type AuthPurgeParams } from "./specs";
24
24
  * 4. **`erase auth`** — auth's own contribution, last for that reason.
25
25
  * 5. **`complete`** — the `purged` record, the audit event, `onUserPurged`. Once.
26
26
  *
27
- * Every step from 2 on records an audit event as well as its row (#823), which the erasure attestation cites.
27
+ * Every step from 2 on records an audit event as well as its row, which the erasure attestation cites.
28
28
  *
29
29
  * ## A legal hold stops it
30
30
  *
@@ -35,7 +35,7 @@ import { type AuthPurgeDueParams, type AuthPurgeParams } from "./specs";
35
35
  * erase where the first one did and carry on from there. A hold that cannot be read fails its step, which retries:
36
36
  * a purge never erases past a hold it could not see.
37
37
  *
38
- * ## A purge that gives up says where (#823)
38
+ * ## A purge that gives up says where
39
39
  *
40
40
  * A step that exhausts its retries fails the instance, and the daily pass starts a fresh one tomorrow. Until then the
41
41
  * record would read as a purge still running. So the failure is caught once, recorded in its own `fail` step —
@@ -48,10 +48,10 @@ export interface PurgeOps {
48
48
  due(userId: string): Promise<"due" | "not_due" | "gone">;
49
49
  /** Record that one capability's step erased its rows. */
50
50
  recordStep(userId: string, step: string, summary: string): Promise<void>;
51
- /** Record that one capability's step kept its rows, and why (#814). */
52
- recordRetained(userId: string, step: string, basis: string): Promise<void>;
51
+ /** Record that one capability's step kept its rows, and why: its basis, and the catalog key that translates it. */
52
+ recordRetained(userId: string, step: string, retain: RetainingPurgeContribution["retain"]): Promise<void>;
53
53
  /**
54
- * The account's address, read now, or `null` once it is gone (#814). Handed to each step as
54
+ * The account's address, read now, or `null` once it is gone. Handed to each step as
55
55
  * `PurgeContext.address`, so a capability holding rows by address reads it inside its own step.
56
56
  */
57
57
  address(userId: string): Promise<string | null>;
@@ -62,7 +62,7 @@ export interface PurgeOps {
62
62
  mailComplete(userId: string, notify: boolean | undefined): Promise<boolean>;
63
63
  /** Write the `purged` record, the audit event and the hook. Says whether this call wrote them. */
64
64
  complete(userId: string): Promise<boolean>;
65
- /** Record that the purge gave up at `step`, in the history and the trail (#823). */
65
+ /** Record that the purge gave up at `step`, in the history and the trail. */
66
66
  fail(userId: string, step: string): Promise<void>;
67
67
  /** Whether a legal hold stands on the account. Throws when it cannot say. */
68
68
  held(userId: string): Promise<boolean>;
@@ -80,7 +80,7 @@ export interface PurgeOutcome {
80
80
  readonly state: "purged" | "not_due" | "gone" | "held";
81
81
  /** Every step that erased its rows, in the order it ran. Empty when nothing was erased. */
82
82
  readonly erased: readonly string[];
83
- /** Every step that kept its rows under a stated basis (#814), in the order it ran. */
83
+ /** Every step that kept its rows under a stated basis, in the order it ran. */
84
84
  readonly retained: readonly string[];
85
85
  /** Whether the deletion-complete mail was enqueued. */
86
86
  readonly mailed: boolean;
@@ -117,7 +117,7 @@ export interface PurgeDueRun {
117
117
  held?(userId: string): Promise<boolean>;
118
118
  }
119
119
  /**
120
- * The daily pass (#622): list every account past its window, and start a purge for each — in pages, one step
120
+ * The daily pass: list every account past its window, and start a purge for each — in pages, one step
121
121
  * each, so a pass that dies part-way resumes after the page it finished rather than starting every purge
122
122
  * again. An account still inside its window is not listed, so it is not started.
123
123
  */
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/purge/run.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEL,KAAK,QAAQ,EAEb,KAAK,aAAa,EAMnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAmB,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,wGAAwG;AACxG,MAAM,WAAW,QAAQ;IACvB,oGAAoG;IACpG,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC,CAAC;IACzD,yDAAyD;IACzD,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,uEAAuE;IACvE,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAChD;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAA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AM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,mHAAmH;IACnH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,WAAW;IACX,GAAG,IAAI,IAAI,CAAC;CACb;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,gBAAgB,EACtB,aAAa,EAAE,wBAAwB,EACvC,KAAK,SAAyB,GAC7B,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAmB9B"}
package/dist/purge/run.js CHANGED
@@ -15,11 +15,12 @@ function purgeOps(deps, holds) {
15
15
  step,
16
16
  summary
17
17
  }),
18
- recordRetained: (userId, step, basis) => recordPurgeStep(deps, {
18
+ recordRetained: (userId, step, retain) => recordPurgeStep(deps, {
19
19
  userId,
20
20
  step,
21
- summary: basis,
22
- retained: true
21
+ summary: retain.basis,
22
+ retained: true,
23
+ ...retain.basisKey === void 0 ? {} : { basisKey: retain.basisKey }
23
24
  }),
24
25
  address: (userId) => purgeAddress(deps.db, userId),
25
26
  mailComplete: async (userId, notify) => {
@@ -75,7 +76,7 @@ async function purgeUser(run, step, terminalError, params) {
75
76
  const runStep = async (each) => {
76
77
  const { contribution } = each;
77
78
  current = each.step;
78
- if (isRetained(contribution)) retained.push(await retainStep(step, run.ops, each.step, contribution.retain.basis, userId));
79
+ if (isRetained(contribution)) retained.push(await retainStep(step, run.ops, each.step, contribution.retain, userId));
79
80
  else erased.push(await eraseStep(step, run.ops, each, context));
80
81
  };
81
82
  try {
@@ -132,12 +133,12 @@ function eraseStep(step, ops, each, context) {
132
133
  });
133
134
  }
134
135
  /**
135
- * One capability's retained step (#814): nothing is erased, and the record says the rows were kept and why. Its own
136
+ * One capability's retained step: nothing is erased, and the record says the rows were kept and why. Its own
136
137
  * step, so the trail names it in the order it would have run, and a replay serves it from the journal.
137
138
  */
138
- function retainStep(step, ops, name, basis, userId) {
139
+ function retainStep(step, ops, name, retain, userId) {
139
140
  return step.do(`retain ${name}`, async () => {
140
- await ops.recordRetained(userId, name, basis);
141
+ await ops.recordRetained(userId, name, retain);
141
142
  return name;
142
143
  });
143
144
  }
@@ -146,7 +147,7 @@ const PURGE_START_PAGE = 50;
146
147
  /** The default size of one daily pass. */
147
148
  const PURGE_DUE_DEFAULT_LIMIT = 500;
148
149
  /**
149
- * The daily pass (#622): list every account past its window, and start a purge for each — in pages, one step
150
+ * The daily pass: list every account past its window, and start a purge for each — in pages, one step
150
151
  * each, so a pass that dies part-way resumes after the page it finished rather than starting every purge
151
152
  * again. An account still inside its window is not listed, so it is not started.
152
153
  */
@@ -3,10 +3,11 @@
3
3
  import type { Logger } from "@pithy-sh/core/src/logger/logger";
4
4
  import { type LegalHolds } from "@pithy-sh/core/src/retention/holds";
5
5
  import type { TerminalErrorConstructor, WorkflowStepLike } from "@pithy-sh/core/src/workflow/faults";
6
+ import { type AuthCapability } from "../capability";
6
7
  import { type LifecycleDeps } from "../lifecycle/transitions";
7
8
  import { type InactivityRun, type PurgeDueRun, type PurgeOutcome } from "./run";
8
9
  /**
9
- * The purge's two Workflow bodies (#622) — run by classes **the adopter's own Worker** exports, beside the
10
+ * The purge's two Workflow bodies — run by classes **the adopter's own Worker** exports, beside the
10
11
  * `createEntrypoint` it already exports, because a purge runs every composed capability's contribution and
11
12
  * those exist nowhere else:
12
13
  *
@@ -40,6 +41,11 @@ interface PurgeEvent {
40
41
  readonly workflowName?: string;
41
42
  readonly instanceId?: string;
42
43
  }
44
+ /**
45
+ * The lifecycle transitions' dependencies, for a run with no request: this env, and the composition's seams. The
46
+ * hooks run in this env with no `waitUntil`, since a Workflow has no `ExecutionContext`.
47
+ */
48
+ export declare function lifecycleFor(auth: AuthCapability, env: Record<string, unknown>, log: Logger): LifecycleDeps;
43
49
  /** Purge one account: every composed contribution, one step each, auth's last. See `./run.ts`. */
44
50
  export declare function runAuthPurge(env: Record<string, unknown>, event: PurgeEvent, step: WorkflowStepLike, terminalError: TerminalErrorConstructor): Promise<PurgeOutcome>;
45
51
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/purge/workflow.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG/D,OAAO,EAAE,KAAK,UAAU,EAAc,MAAM,oCAAoC,CAAC;AAGjF,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAOrG,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EAIlB,MAAM,OAAO,CAAC;AAIf;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,0CAA0C;AAC1C,UAAU,UAAU;IAClB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAyBD,kGAAkG;AAClG,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,gBAAgB,EACtB,aAAa,EAAE,wBAAwB,GACtC,OAAO,CAAC,YAAY,CAAC,CAWvB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,gBAAgB,EACtB,aAAa,EAAE,wBAAwB,GACtC,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,C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AC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa,CAY3G;AAWD,kGAAkG;AAClG,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,gBAAgB,EACtB,aAAa,EAAE,wBAAwB,GACtC,OAAO,CAAC,YAAY,CAAC,CAWvB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,gBAAgB,EACtB,aAAa,EAAE,wBAAwB,GACtC,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAchD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,aAAa,CAKxF;AAED,iHAAiH;AACjH,wBAAgB,aAAa,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,aAAa,CAenH;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,GAAG,EAAE,MAAM,EACX,GAAG,GAAE,MAAM,IAAuB,GACjC,WAAW,CAAC,OAAO,CAAC,CAuBtB"}
@@ -17,7 +17,10 @@ import { composedCapabilities, composedCapability } from "@pithy-sh/core/src/cap
17
17
  import { legalHolds } from "@pithy-sh/core/src/retention/holds";
18
18
  import { enqueueFromEnv } from "@pithy-sh/email/src/send/fromComposition";
19
19
  //#region src/purge/workflow.ts
20
- /** The lifecycle transitions' dependencies, for a run with no request: this env, and the composition's seams. */
20
+ /**
21
+ * The lifecycle transitions' dependencies, for a run with no request: this env, and the composition's seams. The
22
+ * hooks run in this env with no `waitUntil`, since a Workflow has no `ExecutionContext`.
23
+ */
21
24
  function lifecycleFor(auth, env, log) {
22
25
  const d1 = resolveDb(env, auth.authConfig.database);
23
26
  return {
@@ -26,6 +29,7 @@ function lifecycleFor(auth, env, log) {
26
29
  emit: auth.auditFor(env),
27
30
  config: auth.authConfig,
28
31
  hooks: auth.lifecycleHooks,
32
+ runtime: { env },
29
33
  enqueueEmail: (input) => enqueueFromEnv(env, input),
30
34
  log
31
35
  };
@@ -137,4 +141,4 @@ function purgeStarter(env, log, now = () => /* @__PURE__ */ new Date()) {
137
141
  };
138
142
  }
139
143
  //#endregion
140
- export { inactivityOps, inactivityRun, purgeStarter, runAuthPurge, runAuthPurgeDue };
144
+ export { inactivityOps, inactivityRun, lifecycleFor, purgeStarter, runAuthPurge, runAuthPurgeDue };
@@ -1,7 +1,7 @@
1
1
  // SPDX-FileCopyrightText: 2026 Pithy
2
2
  // SPDX-License-Identifier: MIT
3
- import { DEV_PROTOCOL, sessionCookieName } from "../http/baseUrl.js";
4
3
  import { AUTH_SESSION_SECRET } from "../instance/secrets.js";
4
+ import { DEV_PROTOCOL, sessionCookieName } from "../http/baseUrl.js";
5
5
  import { ValidationError, fromZodError } from "@pithy-sh/core/src/error/pithyError";
6
6
  import { z } from "zod";
7
7
  import { commandName } from "@pithy-sh/core/src/cli/command";
@@ -0,0 +1,92 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ /**
4
+ * A stand-in for Apple's App Attest service and a device's Secure Enclave, built on WebCrypto.
5
+ *
6
+ * It mints a root and an intermediate in the shape Apple's are (P-384, ECDSA with SHA-384), and per key a P-256
7
+ * leaf signed with SHA-256 that carries the nonce extension `1.2.840.113635.100.8.2`, then the attestation object
8
+ * and assertions exactly as `DCAppAttestService` returns them. A test trusts {@link AppAttestAuthority.root} in
9
+ * place of Apple's, which is the only difference from a real device: every byte goes through the same reader.
10
+ */
11
+ type Bytes = Uint8Array;
12
+ /** What to put in one attestation. Each override breaks the one field a refusal test is about. */
13
+ export interface AttestOptions {
14
+ /** `<TeamID>.<bundleId>`, hashed into the authenticator data's `rpIdHash`. */
15
+ appId: string;
16
+ /** What the app passed to `attestKey`. */
17
+ clientDataHash: Bytes;
18
+ environment?: "production" | "development";
19
+ /** The authenticator data's counter. Apple's is always 0. */
20
+ counter?: number;
21
+ /** A nonce to write into the leaf in place of the right one. */
22
+ nonce?: Bytes;
23
+ /** A credential id to write in place of the key id. */
24
+ credentialId?: Bytes;
25
+ /** Leaf validity, defaulting to an hour either side of the authority's `now`. */
26
+ notBefore?: Date;
27
+ notAfter?: Date;
28
+ }
29
+ /** One attested key. */
30
+ export interface AttestedKey {
31
+ /** The key id as `generateKey` hands it over: standard base64 of SHA-256 over the public point. */
32
+ keyId: string;
33
+ /** The attestation object as `attestKey` hands it over: standard base64. */
34
+ attestation: string;
35
+ /** The raw public point. */
36
+ publicKey: Bytes;
37
+ /** An assertion over `clientDataHash`, as `generateAssertion` hands it over: standard base64. */
38
+ assert(options: {
39
+ appId: string;
40
+ clientDataHash: Bytes;
41
+ counter: number;
42
+ }): Promise<string>;
43
+ }
44
+ /** A key generated in the fake Secure Enclave and not yet attested, as `generateKey` leaves it. */
45
+ export interface GeneratedKey {
46
+ /** The key id as `generateKey` hands it over: standard base64 of SHA-256 over the public point. */
47
+ keyId: string;
48
+ /** The raw public point. */
49
+ publicKey: Bytes;
50
+ /** Apple's attestation of this key, as `attestKey` hands it over: standard base64. */
51
+ attest(options: AttestOptions): Promise<string>;
52
+ /** An assertion over `clientDataHash`, as `generateAssertion` hands it over: standard base64. */
53
+ assert(options: {
54
+ appId: string;
55
+ clientDataHash: Bytes;
56
+ counter: number;
57
+ }): Promise<string>;
58
+ }
59
+ /** A fake App Attest service. */
60
+ export interface AppAttestAuthority {
61
+ /** The root to trust in place of Apple's, DER. */
62
+ root: Bytes;
63
+ /** Generate a key and attest to it. */
64
+ attest(options: AttestOptions): Promise<AttestedKey>;
65
+ /** Generate a key, to attest later: the two steps a device takes, `generateKey` then `attestKey`. */
66
+ generate(): Promise<GeneratedKey>;
67
+ }
68
+ /** Stand up a fake App Attest service whose certificates are valid around `now`. */
69
+ export declare function appAttestAuthority(options?: {
70
+ now?: Date;
71
+ }): Promise<AppAttestAuthority>;
72
+ /** A key id as auth stores it: base64url of the 32 bytes. */
73
+ export declare function storedKeyId(keyId: string): string;
74
+ /** A fake device's `@expo/app-integrity`: the shape `appAttestAttester` takes, over `authority`'s keys. */
75
+ export interface AppAttestDeviceModule {
76
+ readonly isSupported: boolean;
77
+ generateKeyAsync(): Promise<string>;
78
+ attestKeyAsync(keyId: string, challenge: string): Promise<string>;
79
+ generateAssertionAsync(keyId: string, challenge: string): Promise<string>;
80
+ /** Forget every key, as a reinstall or a restore to a new phone does: asserting with one then throws. */
81
+ wipe(): void;
82
+ /** Each call in order, with the string it was handed. */
83
+ readonly calls: string[];
84
+ }
85
+ /**
86
+ * `@expo/app-integrity`'s App Attest half on a fake device: the key lives in `authority`'s Secure Enclave stand-in,
87
+ * and each call hashes the string it is handed with SHA-256 over its UTF-8 into `clientDataHash`, as the native
88
+ * module does. Each key's counter rises by one per assertion, as the Secure Enclave's does.
89
+ */
90
+ export declare function appAttestDeviceModule(authority: AppAttestAuthority, appId: string): AppAttestDeviceModule;
91
+ export {};
92
+ //# sourceMappingURL=appAttestDevice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appAttestDevice.d.ts","sourceRoot":"","sources":["../../src/test-utils/appAttestDevice.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AAEH,KAAK,KAAK,GAAG,UAAU,CAAC;AAqKxB,kGAAkG;AAClG,MAAM,WAAW,aAAa;IAC5B,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,cAAc,EAAE,KAAK,CAAC;IACtB,WAAW,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;IAC3C,6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