@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.
- package/README.md +4 -0
- package/dist/attestation/appAttest/assertion.d.ts +32 -0
- package/dist/attestation/appAttest/assertion.d.ts.map +1 -0
- package/dist/attestation/appAttest/assertion.js +59 -0
- package/dist/attestation/appAttest/attestation.d.ts +49 -0
- package/dist/attestation/appAttest/attestation.d.ts.map +1 -0
- package/dist/attestation/appAttest/attestation.js +111 -0
- package/dist/attestation/appAttest/authData.d.ts +24 -0
- package/dist/attestation/appAttest/authData.d.ts.map +1 -0
- package/dist/attestation/appAttest/authData.js +32 -0
- package/dist/attestation/appAttest/base64.d.ts +8 -0
- package/dist/attestation/appAttest/base64.d.ts.map +1 -0
- package/dist/attestation/appAttest/base64.js +27 -0
- package/dist/attestation/appAttest/bytes.d.ts +7 -0
- package/dist/attestation/appAttest/bytes.d.ts.map +1 -0
- package/dist/attestation/appAttest/bytes.js +19 -0
- package/dist/attestation/appAttest/cbor.d.ts +20 -0
- package/dist/attestation/appAttest/cbor.d.ts.map +1 -0
- package/dist/attestation/appAttest/cbor.js +96 -0
- package/dist/attestation/appAttest/der.d.ts +38 -0
- package/dist/attestation/appAttest/der.d.ts.map +1 -0
- package/dist/attestation/appAttest/der.js +106 -0
- package/dist/attestation/appAttest/keys.d.ts +15 -0
- package/dist/attestation/appAttest/keys.d.ts.map +1 -0
- package/dist/attestation/appAttest/keys.js +37 -0
- package/dist/attestation/appAttest/root.d.ts +9 -0
- package/dist/attestation/appAttest/root.d.ts.map +1 -0
- package/dist/attestation/appAttest/root.js +12 -0
- package/dist/attestation/appAttest/verifier.d.ts +39 -0
- package/dist/attestation/appAttest/verifier.d.ts.map +1 -0
- package/dist/attestation/appAttest/verifier.js +121 -0
- package/dist/attestation/appAttest/x509.d.ts +50 -0
- package/dist/attestation/appAttest/x509.d.ts.map +1 -0
- package/dist/attestation/appAttest/x509.js +163 -0
- package/dist/attestation/challenge.d.ts +26 -0
- package/dist/attestation/challenge.d.ts.map +1 -0
- package/dist/attestation/challenge.js +47 -0
- package/dist/attestation/config.d.ts +72 -0
- package/dist/attestation/config.d.ts.map +1 -0
- package/dist/attestation/config.js +52 -0
- package/dist/attestation/errors.d.ts +30 -0
- package/dist/attestation/errors.d.ts.map +1 -0
- package/dist/attestation/errors.js +45 -0
- package/dist/attestation/gate.d.ts +27 -0
- package/dist/attestation/gate.d.ts.map +1 -0
- package/dist/attestation/gate.js +78 -0
- package/dist/attestation/playIntegrity/google.d.ts +47 -0
- package/dist/attestation/playIntegrity/google.d.ts.map +1 -0
- package/dist/attestation/playIntegrity/google.js +178 -0
- package/dist/attestation/playIntegrity/verdict.d.ts +40 -0
- package/dist/attestation/playIntegrity/verdict.d.ts.map +1 -0
- package/dist/attestation/playIntegrity/verdict.js +93 -0
- package/dist/attestation/playIntegrity/verifier.d.ts +22 -0
- package/dist/attestation/playIntegrity/verifier.d.ts.map +1 -0
- package/dist/attestation/playIntegrity/verifier.js +64 -0
- package/dist/attestation/verifier.d.ts +60 -0
- package/dist/attestation/verifier.d.ts.map +1 -0
- package/dist/attestation/verifier.js +46 -0
- package/dist/attestation/wire.d.ts +42 -0
- package/dist/attestation/wire.d.ts.map +1 -0
- package/dist/attestation/wire.js +72 -0
- package/dist/capability.d.ts +49 -6
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +42 -7
- package/dist/client/api.d.ts +37 -24
- package/dist/client/api.d.ts.map +1 -1
- package/dist/client/api.js +52 -41
- package/dist/client/attestation.d.ts +148 -0
- package/dist/client/attestation.d.ts.map +1 -0
- package/dist/client/attestation.js +321 -0
- package/dist/client/projection.d.ts +29 -4
- package/dist/client/projection.d.ts.map +1 -1
- package/dist/data/appAttestKey.d.ts +30 -0
- package/dist/data/appAttestKey.d.ts.map +1 -0
- package/dist/data/appAttestKey.js +25 -0
- package/dist/data/attestationChallenge.d.ts +17 -0
- package/dist/data/attestationChallenge.d.ts.map +1 -0
- package/dist/data/attestationChallenge.js +19 -0
- package/dist/data/tables.d.ts +19 -1
- package/dist/data/tables.d.ts.map +1 -1
- package/dist/data/tables.js +6 -2
- package/dist/data/userLifecycle.d.ts +1 -0
- package/dist/data/userLifecycle.d.ts.map +1 -1
- package/dist/data/userLifecycle.js +3 -2
- package/dist/hooks/runtime.d.ts +32 -0
- package/dist/hooks/runtime.d.ts.map +1 -0
- package/dist/hooks/runtime.js +25 -0
- package/dist/http/adminRoutes.d.ts.map +1 -1
- package/dist/http/adminRoutes.js +4 -2
- package/dist/http/devLoginRoute.js +3 -3
- package/dist/http/resolve.d.ts.map +1 -1
- package/dist/http/resolve.js +3 -2
- package/dist/http/responses.d.ts +15 -0
- package/dist/http/responses.d.ts.map +1 -1
- package/dist/http/responses.js +13 -2
- package/dist/http/routes.d.ts +5 -1
- package/dist/http/routes.d.ts.map +1 -1
- package/dist/http/routes.js +92 -25
- package/dist/http/schemas.d.ts +7 -0
- package/dist/http/schemas.d.ts.map +1 -1
- package/dist/http/schemas.js +7 -1
- package/dist/index.js +1 -1
- package/dist/instance/secrets.d.ts +86 -7
- package/dist/instance/secrets.d.ts.map +1 -1
- package/dist/instance/secrets.js +54 -8
- package/dist/lifecycle/erasure.d.ts.map +1 -1
- package/dist/lifecycle/erasure.js +2 -1
- package/dist/lifecycle/hooks.d.ts +18 -10
- package/dist/lifecycle/hooks.d.ts.map +1 -1
- package/dist/lifecycle/request.d.ts +2 -1
- package/dist/lifecycle/request.d.ts.map +1 -1
- package/dist/lifecycle/request.js +4 -1
- package/dist/lifecycle/transitions.d.ts +24 -16
- package/dist/lifecycle/transitions.d.ts.map +1 -1
- package/dist/lifecycle/transitions.js +27 -16
- package/dist/migrations/0009_attestation_challenges.d.ts +9 -0
- package/dist/migrations/0009_attestation_challenges.d.ts.map +1 -0
- package/dist/migrations/0009_attestation_challenges.js +21 -0
- package/dist/migrations/0010_app_attest_keys.d.ts +9 -0
- package/dist/migrations/0010_app_attest_keys.d.ts.map +1 -0
- package/dist/migrations/0010_app_attest_keys.js +17 -0
- package/dist/migrations/0011_retained_basis_key.d.ts +10 -0
- package/dist/migrations/0011_retained_basis_key.d.ts.map +1 -0
- package/dist/migrations/0011_retained_basis_key.js +18 -0
- package/dist/migrations/set.d.ts +4 -1
- package/dist/migrations/set.d.ts.map +1 -1
- package/dist/migrations/set.js +8 -2
- package/dist/purge/run.d.ts +11 -11
- package/dist/purge/run.d.ts.map +1 -1
- package/dist/purge/run.js +9 -8
- package/dist/purge/workflow.d.ts +7 -1
- package/dist/purge/workflow.d.ts.map +1 -1
- package/dist/purge/workflow.js +6 -2
- package/dist/seeds/devSession.js +1 -1
- package/dist/test-utils/appAttestDevice.d.ts +92 -0
- package/dist/test-utils/appAttestDevice.d.ts.map +1 -0
- package/dist/test-utils/appAttestDevice.js +282 -0
- package/dist/test-utils/appAttestSample.d.ts +22 -0
- package/dist/test-utils/appAttestSample.d.ts.map +1 -0
- package/dist/test-utils/appAttestSample.js +24 -0
- package/dist/test-utils/googlePlay.d.ts +47 -0
- package/dist/test-utils/googlePlay.d.ts.map +1 -0
- package/dist/test-utils/googlePlay.js +117 -0
- package/dist/test-utils/liveApp.d.ts +76 -36
- package/dist/test-utils/liveApp.d.ts.map +1 -1
- package/dist/test-utils/liveApp.js +16 -5
- package/dist/test-utils/rollbackThrough.d.ts +11 -0
- package/dist/test-utils/rollbackThrough.d.ts.map +1 -0
- package/dist/test-utils/rollbackThrough.js +16 -0
- package/dist/test-utils/scopedBackend.d.ts +25 -0
- package/dist/test-utils/scopedBackend.d.ts.map +1 -1
- package/dist/test-utils/scopedBackend.js +1 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/docs/account-lifecycle.md +46 -10
- package/docs/attestation.md +173 -0
- package/package.json +5 -5
- package/pithy.manifest.json +14 -0
- package/src/attestation/appAttest/assertion.ts +65 -0
- package/src/attestation/appAttest/attestation.ts +159 -0
- package/src/attestation/appAttest/authData.ts +45 -0
- package/src/attestation/appAttest/base64.ts +29 -0
- package/src/attestation/appAttest/bytes.ts +18 -0
- package/src/attestation/appAttest/cbor.ts +116 -0
- package/src/attestation/appAttest/der.ts +126 -0
- package/src/attestation/appAttest/keys.ts +57 -0
- package/src/attestation/appAttest/root.ts +13 -0
- package/src/attestation/appAttest/verifier.ts +113 -0
- package/src/attestation/appAttest/x509.ts +209 -0
- package/src/attestation/challenge.ts +56 -0
- package/src/attestation/config.ts +118 -0
- package/src/attestation/errors.ts +60 -0
- package/src/attestation/gate.ts +105 -0
- package/src/attestation/playIntegrity/google.ts +239 -0
- package/src/attestation/playIntegrity/verdict.ts +149 -0
- package/src/attestation/playIntegrity/verifier.ts +77 -0
- package/src/attestation/verifier.ts +87 -0
- package/src/attestation/wire.ts +79 -0
- package/src/capability.ts +85 -16
- package/src/client/api.ts +73 -40
- package/src/client/attestation.ts +404 -0
- package/src/client/projection.ts +29 -4
- package/src/data/appAttestKey.ts +45 -0
- package/src/data/attestationChallenge.ts +23 -0
- package/src/data/tables.ts +5 -1
- package/src/data/userLifecycle.ts +9 -2
- package/src/hooks/runtime.ts +41 -0
- package/src/http/adminRoutes.ts +14 -7
- package/src/http/resolve.ts +8 -4
- package/src/http/responses.ts +29 -1
- package/src/http/routes.ts +128 -38
- package/src/http/schemas.ts +24 -0
- package/src/instance/secrets.ts +88 -9
- package/src/lifecycle/erasure.ts +2 -1
- package/src/lifecycle/hooks.ts +22 -10
- package/src/lifecycle/request.ts +4 -1
- package/src/lifecycle/transitions.ts +47 -28
- package/src/migrations/0009_attestation_challenges.ts +28 -0
- package/src/migrations/0010_app_attest_keys.ts +27 -0
- package/src/migrations/0011_retained_basis_key.ts +19 -0
- package/src/migrations/set.ts +7 -1
- package/src/purge/run.ts +29 -17
- package/src/purge/workflow.ts +7 -3
- package/src/test-utils/appAttestDevice.ts +399 -0
- package/src/test-utils/appAttestSample.ts +20 -0
- package/src/test-utils/googlePlay.ts +144 -0
- package/src/test-utils/liveApp.ts +31 -5
- package/src/test-utils/rollbackThrough.ts +24 -0
- package/src/version.generated.ts +1 -1
|
@@ -24,6 +24,9 @@ import type { SessionSecretVersions } from "./sessionSecrets";
|
|
|
24
24
|
* - `auth-microsoft-credentials` — the Microsoft Entra ID app registration's client id, client secret,
|
|
25
25
|
* and tenant, as a typed JSON value. The tenant rides inside because it means nothing apart from the
|
|
26
26
|
* registration it belongs to. Rotatable: an Entra client secret expires (24 months at most).
|
|
27
|
+
* - `auth-play-integrity-service-account` — the Google Cloud service account JSON key the Worker decodes Play
|
|
28
|
+
* Integrity tokens with. Read only when an Android attestation arrives; rotated by adding a key in Google
|
|
29
|
+
* Cloud Console, not on our schedule.
|
|
27
30
|
*/
|
|
28
31
|
export declare const AUTH_SESSION_SECRET = "auth-session-secret";
|
|
29
32
|
export declare const AUTH_GOOGLE_CREDENTIALS = "auth-google-credentials";
|
|
@@ -31,8 +34,9 @@ export declare const AUTH_APPLE_CREDENTIALS = "auth-apple-credentials";
|
|
|
31
34
|
export declare const AUTH_FACEBOOK_CREDENTIALS = "auth-facebook-credentials";
|
|
32
35
|
export declare const AUTH_GITHUB_CREDENTIALS = "auth-github-credentials";
|
|
33
36
|
export declare const AUTH_MICROSOFT_CREDENTIALS = "auth-microsoft-credentials";
|
|
37
|
+
export declare const AUTH_PLAY_INTEGRITY_SERVICE_ACCOUNT = "auth-play-integrity-service-account";
|
|
34
38
|
/**
|
|
35
|
-
* The JWKS private keys, as `auth-session-secret`'s overlap names them
|
|
39
|
+
* The JWKS private keys, as `auth-session-secret`'s overlap names them.
|
|
36
40
|
*
|
|
37
41
|
* Better Auth encrypts every key in `pithy_auth_jwks` under the session secret, and a key never expires —
|
|
38
42
|
* so retiring the version one is sealed under would leave a signing key nothing can open. The session
|
|
@@ -96,6 +100,20 @@ export declare const MicrosoftOAuthCredentials: z.ZodObject<{
|
|
|
96
100
|
tenantId: z.ZodString;
|
|
97
101
|
}, z.core.$strip>;
|
|
98
102
|
export type MicrosoftOAuthCredentials = z.infer<typeof MicrosoftOAuthCredentials>;
|
|
103
|
+
/**
|
|
104
|
+
* The Google Cloud service account key Play Integrity tokens are decoded with: the JSON file Google Cloud
|
|
105
|
+
* Console downloads, pasted whole. Fields auth does not read are dropped on write.
|
|
106
|
+
*/
|
|
107
|
+
export declare const PlayIntegrityServiceAccount: z.ZodObject<{
|
|
108
|
+
type: z.ZodOptional<z.ZodLiteral<"service_account">>;
|
|
109
|
+
project_id: z.ZodOptional<z.ZodString>;
|
|
110
|
+
private_key_id: z.ZodOptional<z.ZodString>;
|
|
111
|
+
private_key: z.ZodString;
|
|
112
|
+
client_email: z.ZodString;
|
|
113
|
+
client_id: z.ZodOptional<z.ZodString>;
|
|
114
|
+
token_uri: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
export type PlayIntegrityServiceAccount = z.infer<typeof PlayIntegrityServiceAccount>;
|
|
99
117
|
export declare const authSecretsRegistry: {
|
|
100
118
|
readonly "auth-session-secret": {
|
|
101
119
|
readonly backend: "d1";
|
|
@@ -222,9 +240,34 @@ export declare const authSecretsRegistry: {
|
|
|
222
240
|
readonly documentation: "https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade";
|
|
223
241
|
};
|
|
224
242
|
};
|
|
243
|
+
readonly "auth-play-integrity-service-account": {
|
|
244
|
+
readonly backend: "d1";
|
|
245
|
+
readonly scope: "environment";
|
|
246
|
+
readonly rotatable: false;
|
|
247
|
+
readonly valueType: "json";
|
|
248
|
+
readonly schema: z.ZodObject<{
|
|
249
|
+
type: z.ZodOptional<z.ZodLiteral<"service_account">>;
|
|
250
|
+
project_id: z.ZodOptional<z.ZodString>;
|
|
251
|
+
private_key_id: z.ZodOptional<z.ZodString>;
|
|
252
|
+
private_key: z.ZodString;
|
|
253
|
+
client_email: z.ZodString;
|
|
254
|
+
client_id: z.ZodOptional<z.ZodString>;
|
|
255
|
+
token_uri: z.ZodOptional<z.ZodString>;
|
|
256
|
+
}, z.core.$strip>;
|
|
257
|
+
readonly origin: {
|
|
258
|
+
readonly kind: "obtained";
|
|
259
|
+
readonly issuer: "google";
|
|
260
|
+
readonly documentation: "https://console.cloud.google.com/iam-admin/serviceaccounts";
|
|
261
|
+
};
|
|
262
|
+
readonly rotation: {
|
|
263
|
+
readonly kind: "manual";
|
|
264
|
+
readonly issuer: "google";
|
|
265
|
+
readonly documentation: "https://console.cloud.google.com/iam-admin/serviceaccounts";
|
|
266
|
+
};
|
|
267
|
+
};
|
|
225
268
|
};
|
|
226
269
|
/**
|
|
227
|
-
* **The registry `auth()` contributes, from its own configuration
|
|
270
|
+
* **The registry `auth()` contributes, from its own configuration.**
|
|
228
271
|
*
|
|
229
272
|
* The session secret's overlap follows the configured session lifetime — {@link sessionSecretOverlapDays} —
|
|
230
273
|
* and it is both the overlap and its floor: an adopter who lengthens sessions lengthens the overlap with
|
|
@@ -347,6 +390,31 @@ export declare function authSecretsRegistryFor(config: {
|
|
|
347
390
|
readonly documentation: "https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade";
|
|
348
391
|
};
|
|
349
392
|
};
|
|
393
|
+
readonly "auth-play-integrity-service-account": {
|
|
394
|
+
readonly backend: "d1";
|
|
395
|
+
readonly scope: "environment";
|
|
396
|
+
readonly rotatable: false;
|
|
397
|
+
readonly valueType: "json";
|
|
398
|
+
readonly schema: z.ZodObject<{
|
|
399
|
+
type: z.ZodOptional<z.ZodLiteral<"service_account">>;
|
|
400
|
+
project_id: z.ZodOptional<z.ZodString>;
|
|
401
|
+
private_key_id: z.ZodOptional<z.ZodString>;
|
|
402
|
+
private_key: z.ZodString;
|
|
403
|
+
client_email: z.ZodString;
|
|
404
|
+
client_id: z.ZodOptional<z.ZodString>;
|
|
405
|
+
token_uri: z.ZodOptional<z.ZodString>;
|
|
406
|
+
}, z.core.$strip>;
|
|
407
|
+
readonly origin: {
|
|
408
|
+
readonly kind: "obtained";
|
|
409
|
+
readonly issuer: "google";
|
|
410
|
+
readonly documentation: "https://console.cloud.google.com/iam-admin/serviceaccounts";
|
|
411
|
+
};
|
|
412
|
+
readonly rotation: {
|
|
413
|
+
readonly kind: "manual";
|
|
414
|
+
readonly issuer: "google";
|
|
415
|
+
readonly documentation: "https://console.cloud.google.com/iam-admin/serviceaccounts";
|
|
416
|
+
};
|
|
417
|
+
};
|
|
350
418
|
readonly "auth-session-secret": {
|
|
351
419
|
readonly backend: "d1";
|
|
352
420
|
readonly scope: "environment";
|
|
@@ -373,7 +441,7 @@ export declare function authSecretsRegistryFor(config: {
|
|
|
373
441
|
};
|
|
374
442
|
};
|
|
375
443
|
/**
|
|
376
|
-
* Which provider a credential belongs to — the join the CLI must never make by spelling
|
|
444
|
+
* Which provider a credential belongs to — the join the CLI must never make by spelling.
|
|
377
445
|
*
|
|
378
446
|
* `auth-apple-credentials` and the `apple` config key look like each other and that is a coincidence:
|
|
379
447
|
* nothing makes a secret name and a config key the same thing, and a reporting command that matched
|
|
@@ -388,9 +456,9 @@ export type AuthProviderToggles = Record<(typeof PROVIDER_CREDENTIALS)[number][0
|
|
|
388
456
|
* **The provider credentials this composition cannot reach**, as the `inapplicableSecrets` contribution.
|
|
389
457
|
*
|
|
390
458
|
* Auth declares five credentials whether or not a project runs five providers, so a project on Google
|
|
391
|
-
* and GitHub carries two secrets nothing will ever read.
|
|
392
|
-
*
|
|
393
|
-
*
|
|
459
|
+
* and GitHub carries two secrets nothing will ever read. A disabled provider's credential is listed as not
|
|
460
|
+
* applicable rather than as outstanding work: "set it until you need it" is wrong about a provider the
|
|
461
|
+
* configuration has not enabled.
|
|
394
462
|
*
|
|
395
463
|
* **The session secret is never in here**, and that is the line this draws: it is read on every sign-in
|
|
396
464
|
* whatever the providers are, so it is outstanding work in every project that has not set it.
|
|
@@ -402,7 +470,7 @@ export declare function inapplicableProviderSecrets(providers: AuthProviderToggl
|
|
|
402
470
|
/** Resolve the Better Auth session secret for this invocation — the current version alone. */
|
|
403
471
|
export declare function resolveSessionSecret(env: SecretsStoreEnv): Promise<string>;
|
|
404
472
|
/**
|
|
405
|
-
* Resolve every retained version of the session secret
|
|
473
|
+
* Resolve every retained version of the session secret: what an instance needs to open values sealed
|
|
406
474
|
* under the previous version, and what a credential signed under it is verified against. One read through
|
|
407
475
|
* the same cached accessor as {@link resolveSessionSecret}.
|
|
408
476
|
*/
|
|
@@ -415,6 +483,17 @@ export declare function resolveAppleCredentials(env: SecretsStoreEnv): Promise<A
|
|
|
415
483
|
export declare function resolveFacebookCredentials(env: SecretsStoreEnv): Promise<FacebookOAuthCredentials>;
|
|
416
484
|
/** Resolve the GitHub OAuth credential pair for this invocation (only call when GitHub is enabled). */
|
|
417
485
|
export declare function resolveGithubCredentials(env: SecretsStoreEnv): Promise<GithubOAuthCredentials>;
|
|
486
|
+
/**
|
|
487
|
+
* The Play Integrity service account when no environment of this composition allows an Android app: nothing
|
|
488
|
+
* there reads it.
|
|
489
|
+
*/
|
|
490
|
+
export declare function inapplicablePlayIntegritySecret(attestation: {
|
|
491
|
+
environments: Record<string, {
|
|
492
|
+
android: readonly unknown[];
|
|
493
|
+
}>;
|
|
494
|
+
}): Record<string, string>;
|
|
495
|
+
/** Resolve the Play Integrity service account for this invocation (only call for an Android attestation). */
|
|
496
|
+
export declare function resolvePlayIntegrityServiceAccount(env: SecretsStoreEnv): Promise<PlayIntegrityServiceAccount>;
|
|
418
497
|
/** Resolve the Microsoft Entra ID credentials for this invocation (only call when Microsoft is enabled). */
|
|
419
498
|
export declare function resolveMicrosoftCredentials(env: SecretsStoreEnv): Promise<MicrosoftOAuthCredentials>;
|
|
420
499
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/instance/secrets.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAG1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE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BAAsB,2BAA2B,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAG1G"}
|
package/dist/instance/secrets.js
CHANGED
|
@@ -26,6 +26,9 @@ import { sharedSecretsStore } from "@pithy-sh/secrets/src/sharedSecretsStore";
|
|
|
26
26
|
* - `auth-microsoft-credentials` — the Microsoft Entra ID app registration's client id, client secret,
|
|
27
27
|
* and tenant, as a typed JSON value. The tenant rides inside because it means nothing apart from the
|
|
28
28
|
* registration it belongs to. Rotatable: an Entra client secret expires (24 months at most).
|
|
29
|
+
* - `auth-play-integrity-service-account` — the Google Cloud service account JSON key the Worker decodes Play
|
|
30
|
+
* Integrity tokens with. Read only when an Android attestation arrives; rotated by adding a key in Google
|
|
31
|
+
* Cloud Console, not on our schedule.
|
|
29
32
|
*/
|
|
30
33
|
const AUTH_SESSION_SECRET = "auth-session-secret";
|
|
31
34
|
const AUTH_GOOGLE_CREDENTIALS = "auth-google-credentials";
|
|
@@ -33,8 +36,9 @@ const AUTH_APPLE_CREDENTIALS = "auth-apple-credentials";
|
|
|
33
36
|
const AUTH_FACEBOOK_CREDENTIALS = "auth-facebook-credentials";
|
|
34
37
|
const AUTH_GITHUB_CREDENTIALS = "auth-github-credentials";
|
|
35
38
|
const AUTH_MICROSOFT_CREDENTIALS = "auth-microsoft-credentials";
|
|
39
|
+
const AUTH_PLAY_INTEGRITY_SERVICE_ACCOUNT = "auth-play-integrity-service-account";
|
|
36
40
|
/**
|
|
37
|
-
* The JWKS private keys, as `auth-session-secret`'s overlap names them
|
|
41
|
+
* The JWKS private keys, as `auth-session-secret`'s overlap names them.
|
|
38
42
|
*
|
|
39
43
|
* Better Auth encrypts every key in `pithy_auth_jwks` under the session secret, and a key never expires —
|
|
40
44
|
* so retiring the version one is sealed under would leave a signing key nothing can open. The session
|
|
@@ -98,6 +102,19 @@ const MicrosoftOAuthCredentials = z.object({
|
|
|
98
102
|
tenantId: z.string().min(1).meta({ multiline: false }).describe("Who may sign in: a directory (tenant) ID for one organization, `organizations` for any work or school account, `consumers` for personal accounts only, or `common` for both.")
|
|
99
103
|
}).describe("A Microsoft Entra ID credential set (`clientId` + `clientSecret` + `tenantId`) for one environment.");
|
|
100
104
|
/**
|
|
105
|
+
* The Google Cloud service account key Play Integrity tokens are decoded with: the JSON file Google Cloud
|
|
106
|
+
* Console downloads, pasted whole. Fields auth does not read are dropped on write.
|
|
107
|
+
*/
|
|
108
|
+
const PlayIntegrityServiceAccount = z.object({
|
|
109
|
+
type: z.literal("service_account").optional().meta({ multiline: false }).describe("The key file's kind. Google writes `service_account`."),
|
|
110
|
+
project_id: z.string().optional().meta({ multiline: false }).describe("The Google Cloud project the service account belongs to, linked to the app in Play Console."),
|
|
111
|
+
private_key_id: z.string().optional().meta({ multiline: false }).describe("The key's id, sent as the assertion's `kid` so Google picks the right public key."),
|
|
112
|
+
private_key: z.string().min(1).meta({ multiline: true }).describe("The RSA private key, a PKCS#8 PEM. It spans many lines, so paste the whole JSON file."),
|
|
113
|
+
client_email: z.string().min(1).meta({ multiline: false }).describe("The service account's address, such as `play-integrity@my-project.iam.gserviceaccount.com`."),
|
|
114
|
+
client_id: z.string().optional().meta({ multiline: false }).describe("The service account's numeric id. Not read; kept so the stored value matches the file."),
|
|
115
|
+
token_uri: z.string().regex(/^https:\/\//, "The token endpoint is an https URL.").optional().meta({ multiline: false }).describe("Google's OAuth token endpoint. Defaults to `https://oauth2.googleapis.com/token`.")
|
|
116
|
+
}).describe("A Google Cloud service account JSON key, for decoding Play Integrity tokens in one environment.");
|
|
117
|
+
/**
|
|
101
118
|
* Where a human goes for each OAuth credential pair, and where the same human rotates it.
|
|
102
119
|
*
|
|
103
120
|
* **The settings page, not the product homepage.** The point is to end a search, not to start one — and
|
|
@@ -110,6 +127,7 @@ const APPLE_KEYS_PAGE = "https://developer.apple.com/account/resources/authkeys/
|
|
|
110
127
|
const FACEBOOK_APPS_PAGE = "https://developers.facebook.com/apps/";
|
|
111
128
|
const GITHUB_OAUTH_APPS_PAGE = "https://github.com/settings/developers";
|
|
112
129
|
const MICROSOFT_APP_REGISTRATIONS_PAGE = "https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade";
|
|
130
|
+
const GOOGLE_SERVICE_ACCOUNTS_PAGE = "https://console.cloud.google.com/iam-admin/serviceaccounts";
|
|
113
131
|
const authSecretsRegistry = defineSecretRegistry({
|
|
114
132
|
[AUTH_SESSION_SECRET]: {
|
|
115
133
|
backend: "d1",
|
|
@@ -216,10 +234,27 @@ const authSecretsRegistry = defineSecretRegistry({
|
|
|
216
234
|
issuer: "microsoft",
|
|
217
235
|
documentation: MICROSOFT_APP_REGISTRATIONS_PAGE
|
|
218
236
|
}
|
|
237
|
+
},
|
|
238
|
+
[AUTH_PLAY_INTEGRITY_SERVICE_ACCOUNT]: {
|
|
239
|
+
backend: "d1",
|
|
240
|
+
scope: "environment",
|
|
241
|
+
rotatable: false,
|
|
242
|
+
valueType: "json",
|
|
243
|
+
schema: PlayIntegrityServiceAccount,
|
|
244
|
+
origin: {
|
|
245
|
+
kind: "obtained",
|
|
246
|
+
issuer: "google",
|
|
247
|
+
documentation: GOOGLE_SERVICE_ACCOUNTS_PAGE
|
|
248
|
+
},
|
|
249
|
+
rotation: {
|
|
250
|
+
kind: "manual",
|
|
251
|
+
issuer: "google",
|
|
252
|
+
documentation: GOOGLE_SERVICE_ACCOUNTS_PAGE
|
|
253
|
+
}
|
|
219
254
|
}
|
|
220
255
|
});
|
|
221
256
|
/**
|
|
222
|
-
* **The registry `auth()` contributes, from its own configuration
|
|
257
|
+
* **The registry `auth()` contributes, from its own configuration.**
|
|
223
258
|
*
|
|
224
259
|
* The session secret's overlap follows the configured session lifetime — {@link sessionSecretOverlapDays} —
|
|
225
260
|
* and it is both the overlap and its floor: an adopter who lengthens sessions lengthens the overlap with
|
|
@@ -257,7 +292,7 @@ function authSecretsRegistryFor(config) {
|
|
|
257
292
|
});
|
|
258
293
|
}
|
|
259
294
|
/**
|
|
260
|
-
* Which provider a credential belongs to — the join the CLI must never make by spelling
|
|
295
|
+
* Which provider a credential belongs to — the join the CLI must never make by spelling.
|
|
261
296
|
*
|
|
262
297
|
* `auth-apple-credentials` and the `apple` config key look like each other and that is a coincidence:
|
|
263
298
|
* nothing makes a secret name and a config key the same thing, and a reporting command that matched
|
|
@@ -274,9 +309,9 @@ const PROVIDER_CREDENTIALS = [
|
|
|
274
309
|
* **The provider credentials this composition cannot reach**, as the `inapplicableSecrets` contribution.
|
|
275
310
|
*
|
|
276
311
|
* Auth declares five credentials whether or not a project runs five providers, so a project on Google
|
|
277
|
-
* and GitHub carries two secrets nothing will ever read.
|
|
278
|
-
*
|
|
279
|
-
*
|
|
312
|
+
* and GitHub carries two secrets nothing will ever read. A disabled provider's credential is listed as not
|
|
313
|
+
* applicable rather than as outstanding work: "set it until you need it" is wrong about a provider the
|
|
314
|
+
* configuration has not enabled.
|
|
280
315
|
*
|
|
281
316
|
* **The session secret is never in here**, and that is the line this draws: it is read on every sign-in
|
|
282
317
|
* whatever the providers are, so it is outstanding work in every project that has not set it.
|
|
@@ -297,7 +332,7 @@ async function resolveSessionSecret(env) {
|
|
|
297
332
|
return (await sharedSecretsStore(env, authSecretsRegistry)).get(AUTH_SESSION_SECRET);
|
|
298
333
|
}
|
|
299
334
|
/**
|
|
300
|
-
* Resolve every retained version of the session secret
|
|
335
|
+
* Resolve every retained version of the session secret: what an instance needs to open values sealed
|
|
301
336
|
* under the previous version, and what a credential signed under it is verified against. One read through
|
|
302
337
|
* the same cached accessor as {@link resolveSessionSecret}.
|
|
303
338
|
*/
|
|
@@ -320,9 +355,20 @@ async function resolveFacebookCredentials(env) {
|
|
|
320
355
|
async function resolveGithubCredentials(env) {
|
|
321
356
|
return (await sharedSecretsStore(env, authSecretsRegistry)).get(AUTH_GITHUB_CREDENTIALS);
|
|
322
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* The Play Integrity service account when no environment of this composition allows an Android app: nothing
|
|
360
|
+
* there reads it.
|
|
361
|
+
*/
|
|
362
|
+
function inapplicablePlayIntegritySecret(attestation) {
|
|
363
|
+
return Object.values(attestation.environments).some((block) => block.android.length > 0) ? {} : { [AUTH_PLAY_INTEGRITY_SERVICE_ACCOUNT]: "auth() allows no Android app to attest in any environment" };
|
|
364
|
+
}
|
|
365
|
+
/** Resolve the Play Integrity service account for this invocation (only call for an Android attestation). */
|
|
366
|
+
async function resolvePlayIntegrityServiceAccount(env) {
|
|
367
|
+
return (await sharedSecretsStore(env, authSecretsRegistry)).get(AUTH_PLAY_INTEGRITY_SERVICE_ACCOUNT);
|
|
368
|
+
}
|
|
323
369
|
/** Resolve the Microsoft Entra ID credentials for this invocation (only call when Microsoft is enabled). */
|
|
324
370
|
async function resolveMicrosoftCredentials(env) {
|
|
325
371
|
return (await sharedSecretsStore(env, authSecretsRegistry)).get(AUTH_MICROSOFT_CREDENTIALS);
|
|
326
372
|
}
|
|
327
373
|
//#endregion
|
|
328
|
-
export { AUTH_APPLE_CREDENTIALS, AUTH_FACEBOOK_CREDENTIALS, AUTH_GITHUB_CREDENTIALS, AUTH_GOOGLE_CREDENTIALS, AUTH_JWKS_DEPENDENT, AUTH_MICROSOFT_CREDENTIALS, AUTH_SESSION_SECRET, AppleOAuthCredentials, FacebookOAuthCredentials, GithubOAuthCredentials, GoogleOAuthCredentials, MicrosoftOAuthCredentials, SESSION_SECRET_SEALING_PLUGINS, authSecretsRegistry, authSecretsRegistryFor, inapplicableProviderSecrets, resolveAppleCredentials, resolveFacebookCredentials, resolveGithubCredentials, resolveGoogleCredentials, resolveMicrosoftCredentials, resolveSessionSecret, resolveSessionSecrets, sessionSecretOverlapDays };
|
|
374
|
+
export { AUTH_APPLE_CREDENTIALS, AUTH_FACEBOOK_CREDENTIALS, AUTH_GITHUB_CREDENTIALS, AUTH_GOOGLE_CREDENTIALS, AUTH_JWKS_DEPENDENT, AUTH_MICROSOFT_CREDENTIALS, AUTH_PLAY_INTEGRITY_SERVICE_ACCOUNT, AUTH_SESSION_SECRET, AppleOAuthCredentials, FacebookOAuthCredentials, GithubOAuthCredentials, GoogleOAuthCredentials, MicrosoftOAuthCredentials, PlayIntegrityServiceAccount, SESSION_SECRET_SEALING_PLUGINS, authSecretsRegistry, authSecretsRegistryFor, inapplicablePlayIntegritySecret, inapplicableProviderSecrets, resolveAppleCredentials, resolveFacebookCredentials, resolveGithubCredentials, resolveGoogleCredentials, resolveMicrosoftCredentials, resolvePlayIntegrityServiceAccount, resolveSessionSecret, resolveSessionSecrets, sessionSecretOverlapDays };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erasure.d.ts","sourceRoot":"","sources":["../../src/lifecycle/erasure.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAqB,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAGrH,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAqBjE,0CAA0C;AAC1C,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,GAAG,oBAAoB,
|
|
1
|
+
{"version":3,"file":"erasure.d.ts","sourceRoot":"","sources":["../../src/lifecycle/erasure.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAqB,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAGrH,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAqBjE,0CAA0C;AAC1C,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,GAAG,oBAAoB,CAuExE;AAED,+GAA+G;AAC/G,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAgBnE"}
|
|
@@ -7,7 +7,7 @@ import { resolveDb } from "../http/resolve.js";
|
|
|
7
7
|
import { SQLiteDate } from "@pithy-sh/core/src/data/codecs";
|
|
8
8
|
//#region src/lifecycle/erasure.ts
|
|
9
9
|
/**
|
|
10
|
-
* **A user's erasure record, read back for the control plane's attestation
|
|
10
|
+
* **A user's erasure record, read back for the control plane's attestation.**
|
|
11
11
|
*
|
|
12
12
|
* `pithy_auth_user_lifecycle` is the one `pithy_auth_*` table a purge leaves behind, and it names the account by id
|
|
13
13
|
* and nothing else. This reads the rows an erasure is made of — the deletion, any restore, each step, a failure, the
|
|
@@ -44,6 +44,7 @@ function userErasureReader(db) {
|
|
|
44
44
|
actorType: row.actorType,
|
|
45
45
|
reason: row.reason,
|
|
46
46
|
step: row.step,
|
|
47
|
+
basisKey: row.basisKey,
|
|
47
48
|
mode: row.mode,
|
|
48
49
|
purgeAfter: row.purgeAfter,
|
|
49
50
|
at: row.createdAt
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import type { D1Database } from "@cloudflare/workers-types";
|
|
4
4
|
import type { UserLifecycleActorType } from "../data/userLifecycle";
|
|
5
|
+
import type { HookRuntime } from "../hooks/runtime";
|
|
5
6
|
/**
|
|
6
|
-
* The
|
|
7
|
+
* The five seams an adopter's own code follows the account lifecycle through, without polling.
|
|
7
8
|
*
|
|
8
9
|
* **On the transition, not on a route.** An account is suspended from the management surface today and may be
|
|
9
10
|
* from somewhere else tomorrow; a listener hung off one route would miss the others, which is the argument
|
|
@@ -35,19 +36,26 @@ export interface UserLifecycleHookEvent {
|
|
|
35
36
|
readonly purgeAfter?: Date | null;
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
|
-
* One hook. Handed the
|
|
39
|
-
*
|
|
39
|
+
* One hook. Handed the run's D1 binding, for the reason `SessionRevokedListener` is: the listener almost certainly
|
|
40
|
+
* writes to the same database under a different capability's view of it. And handed the Worker it runs in, so it
|
|
41
|
+
* can reach a secret or another binding — start a Workflow, send to a queue, call out. `runtime.waitUntil` is there
|
|
42
|
+
* in a request and absent in the purge Workflow. A hook that takes only `(event, d1)` is still one.
|
|
40
43
|
*/
|
|
41
|
-
export type UserLifecycleListener = (event: UserLifecycleHookEvent, d1: D1Database) => void | Promise<void>;
|
|
42
|
-
/** The
|
|
43
|
-
export interface UserLifecycleHooks {
|
|
44
|
+
export type UserLifecycleListener<Env = Record<string, unknown>> = (event: UserLifecycleHookEvent, d1: D1Database, runtime: HookRuntime<Env>) => void | Promise<void>;
|
|
45
|
+
/** The five hooks, each optional. Passed to `auth()` beside the config; `Env` is the adopter's Worker env. */
|
|
46
|
+
export interface UserLifecycleHooks<Env = Record<string, unknown>> {
|
|
44
47
|
/** An account was suspended. */
|
|
45
|
-
readonly onUserSuspended?: UserLifecycleListener
|
|
48
|
+
readonly onUserSuspended?: UserLifecycleListener<Env>;
|
|
46
49
|
/** A suspended account was reinstated. */
|
|
47
|
-
readonly onUserReinstated?: UserLifecycleListener
|
|
50
|
+
readonly onUserReinstated?: UserLifecycleListener<Env>;
|
|
48
51
|
/** An account was deleted — by an operator or by its owner — and its purge window began. */
|
|
49
|
-
readonly onUserDeleted?: UserLifecycleListener
|
|
52
|
+
readonly onUserDeleted?: UserLifecycleListener<Env>;
|
|
53
|
+
/**
|
|
54
|
+
* A deleted account was restored inside its purge window. The undo for whatever `onUserDeleted` did: the account
|
|
55
|
+
* is back, and a suspension it was under is still in force.
|
|
56
|
+
*/
|
|
57
|
+
readonly onUserRestored?: UserLifecycleListener<Env>;
|
|
50
58
|
/** A deleted account's data was erased. The last thing that happens to it. */
|
|
51
|
-
readonly onUserPurged?: UserLifecycleListener
|
|
59
|
+
readonly onUserPurged?: UserLifecycleListener<Env>;
|
|
52
60
|
}
|
|
53
61
|
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/lifecycle/hooks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/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CAAC,gBAAgB,CAAC,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACvD,4FAA4F;IAC5F,QAAQ,CAAC,aAAa,CAAC,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACpD;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACrD,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,CAAC,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC;CACpD"}
|
|
@@ -9,7 +9,8 @@ import type { LifecycleAuditContext, LifecycleDeps } from "./transitions";
|
|
|
9
9
|
*
|
|
10
10
|
* One function so every route resolves them the same way: this request's database, its audit seam and logger,
|
|
11
11
|
* the composed email capability's enqueue bound to this request's env, and the adopter's hooks as `auth()` was
|
|
12
|
-
* handed them. A route that assembled its own would be the second
|
|
12
|
+
* handed them, with this request's env and `waitUntil` to run in. A route that assembled its own would be the second
|
|
13
|
+
* place a hook could be forgotten.
|
|
13
14
|
*
|
|
14
15
|
* `context` is what the caller adds to each audit event: the request's correlation, and for a management call
|
|
15
16
|
* the connection it came through. The caller passes it because only the caller knows who it is.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/lifecycle/request.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAE7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/lifecycle/request.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAE7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhD,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE1E;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,EACxB,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,aAAa,CAcf"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { authDatabase } from "../data/tables.js";
|
|
4
|
+
import { requestRuntime } from "../hooks/runtime.js";
|
|
4
5
|
import { resolveDb } from "../http/resolve.js";
|
|
5
6
|
//#region src/lifecycle/request.ts
|
|
6
7
|
/**
|
|
@@ -8,7 +9,8 @@ import { resolveDb } from "../http/resolve.js";
|
|
|
8
9
|
*
|
|
9
10
|
* One function so every route resolves them the same way: this request's database, its audit seam and logger,
|
|
10
11
|
* the composed email capability's enqueue bound to this request's env, and the adopter's hooks as `auth()` was
|
|
11
|
-
* handed them. A route that assembled its own would be the second
|
|
12
|
+
* handed them, with this request's env and `waitUntil` to run in. A route that assembled its own would be the second
|
|
13
|
+
* place a hook could be forgotten.
|
|
12
14
|
*
|
|
13
15
|
* `context` is what the caller adds to each audit event: the request's correlation, and for a management call
|
|
14
16
|
* the connection it came through. The caller passes it because only the caller knows who it is.
|
|
@@ -22,6 +24,7 @@ function lifecycleDeps(c, wiring, context) {
|
|
|
22
24
|
emit: c.var.emit,
|
|
23
25
|
config: wiring.config,
|
|
24
26
|
hooks: wiring.lifecycleHooks ?? {},
|
|
27
|
+
runtime: requestRuntime(c),
|
|
25
28
|
enqueueEmail: enqueue ? (input) => enqueue(c.env, input) : void 0,
|
|
26
29
|
log: c.var.log?.child("auth"),
|
|
27
30
|
...context ? { context } : {}
|
|
@@ -7,11 +7,12 @@ import type { EnqueueInput } from "@pithy-sh/email/src/send/enqueue";
|
|
|
7
7
|
import type { AuthConfig } from "../capability";
|
|
8
8
|
import type { AuthDatabase } from "../data/tables";
|
|
9
9
|
import type { UserLifecycleActorType } from "../data/userLifecycle";
|
|
10
|
+
import type { HookRuntime } from "../hooks/runtime";
|
|
10
11
|
import type { UserLifecycleHooks } from "./hooks";
|
|
11
12
|
/**
|
|
12
|
-
* The account-lifecycle transitions — the one place an account's state is ever changed
|
|
13
|
+
* The account-lifecycle transitions — the one place an account's state is ever changed.
|
|
13
14
|
*
|
|
14
|
-
* The admin routes
|
|
15
|
+
* The admin routes, the self-service deletion, and the purge Workflow call these and write
|
|
15
16
|
* nothing themselves, so each transition happens the same way whoever asked for it:
|
|
16
17
|
*
|
|
17
18
|
* 1. **The columns move, conditionally, and the history row is written with them.** The `update` names the
|
|
@@ -52,6 +53,8 @@ export interface LifecycleDeps {
|
|
|
52
53
|
readonly config: Pick<AuthConfig, "retention" | "lifecycleEmails">;
|
|
53
54
|
/** The adopter's hooks. */
|
|
54
55
|
readonly hooks: UserLifecycleHooks;
|
|
56
|
+
/** The Worker the hooks run in: this run's env, and `waitUntil` inside a request. */
|
|
57
|
+
readonly runtime: HookRuntime;
|
|
55
58
|
/** The email capability's enqueue, bound to this run's env. Absent, nothing is mailed. */
|
|
56
59
|
readonly enqueueEmail?: ((input: EnqueueInput) => Promise<unknown>) | undefined;
|
|
57
60
|
/** Where a swallowed failure is reported. Absent, it is swallowed silently. */
|
|
@@ -85,7 +88,7 @@ export interface LifecycleTransition {
|
|
|
85
88
|
/** What a suspension did, and the suspension it left in force. */
|
|
86
89
|
export interface SuspendTransition extends LifecycleTransition {
|
|
87
90
|
/**
|
|
88
|
-
* True when the account was already suspended and this call restated the reason and the end instead
|
|
91
|
+
* True when the account was already suspended and this call restated the reason and the end instead.
|
|
89
92
|
* That is not a transition — `changed` is false and no hook fires — but it is written, audited and mailed.
|
|
90
93
|
*/
|
|
91
94
|
readonly updated: boolean;
|
|
@@ -101,7 +104,7 @@ export interface SuspendTransition extends LifecycleTransition {
|
|
|
101
104
|
* conflict rather than a no-op, and names `restoreRoute` when the caller gives one. A suspension whose end has
|
|
102
105
|
* passed is not in force, and a new one replaces it.
|
|
103
106
|
*
|
|
104
|
-
* **An account already suspended has its terms restated
|
|
107
|
+
* **An account already suspended has its terms restated.** The reason and the end are replaced, a
|
|
105
108
|
* `suspended` row records the new reason — the newest one is what the person is shown — and the audit event
|
|
106
109
|
* and the mail say so. The start is kept, and no hook fires: the account was suspended and still is, so
|
|
107
110
|
* nothing transitioned. A fresh suspension that loses the race to another suspension finds the account
|
|
@@ -163,7 +166,7 @@ export interface DeleteTransition extends LifecycleTransition {
|
|
|
163
166
|
* Restorable until then. The deletion-scheduled mail carries the purge date and, when the config names one,
|
|
164
167
|
* the restore path. A deleted account deleted softly again is no transition.
|
|
165
168
|
*
|
|
166
|
-
* **Hard
|
|
169
|
+
* **Hard**: `purgeAfter` is now, so the window is already closed — nothing can restore it — and the
|
|
167
170
|
* caller starts the purge. No deletion-scheduled mail, because nothing is scheduled; the purge sends the
|
|
168
171
|
* deletion-complete one. An account already deleted softly has its purge brought forward to now, which is
|
|
169
172
|
* written and audited but fires no hook: the account was deleted and still is. One already due is unchanged.
|
|
@@ -192,7 +195,8 @@ export interface RestoreTransition extends LifecycleTransition {
|
|
|
192
195
|
* 404 whose action says the data is gone — read off the history row the purge leaves behind, so it is told
|
|
193
196
|
* apart from an id that never existed.
|
|
194
197
|
*
|
|
195
|
-
* An account that is not deleted is no transition. A suspension it was under is still in force
|
|
198
|
+
* An account that is not deleted is no transition, and fires nothing. A suspension it was under is still in force
|
|
199
|
+
* after. `onUserRestored` fires once the restore is written, so an adopter can undo what it did on `onUserDeleted`.
|
|
196
200
|
*/
|
|
197
201
|
export declare function restoreUser(deps: LifecycleDeps, input: {
|
|
198
202
|
userId: string;
|
|
@@ -200,11 +204,13 @@ export declare function restoreUser(deps: LifecycleDeps, input: {
|
|
|
200
204
|
reason: string | null;
|
|
201
205
|
}): Promise<RestoreTransition>;
|
|
202
206
|
/**
|
|
203
|
-
* The account's
|
|
204
|
-
* purge erased it, and the plain one otherwise. For a route that reads an account outside a transition: the
|
|
205
|
-
* export.
|
|
207
|
+
* The account's stored locale, or the refusal for an account that is not there — the 404 that says the data is gone
|
|
208
|
+
* when the purge erased it, and the plain one otherwise. For a route that reads an account outside a transition: the
|
|
209
|
+
* export, which answers in the person's own language.
|
|
206
210
|
*/
|
|
207
|
-
export declare function requirePresent(db: AuthDatabase, userId: string): Promise<
|
|
211
|
+
export declare function requirePresent(db: AuthDatabase, userId: string): Promise<{
|
|
212
|
+
locale: string | null;
|
|
213
|
+
}>;
|
|
208
214
|
/** Who the purge's last mail goes to, captured before any step erases the address. */
|
|
209
215
|
export interface PurgeRecipient {
|
|
210
216
|
readonly email: string;
|
|
@@ -212,7 +218,7 @@ export interface PurgeRecipient {
|
|
|
212
218
|
readonly locale: string | null;
|
|
213
219
|
}
|
|
214
220
|
/**
|
|
215
|
-
* Whether one account is due for its purge, who its last mail goes to, and whether it goes
|
|
221
|
+
* Whether one account is due for its purge, who its last mail goes to, and whether it goes.
|
|
216
222
|
*
|
|
217
223
|
* `due` only for an account that is deleted and whose `purgeAfter` has passed — the cron and a hard deletion
|
|
218
224
|
* both start a purge, and this is the one check either passes through, so an account restored in between is
|
|
@@ -233,7 +239,7 @@ export declare function purgeSubject(deps: LifecycleDeps, userId: string): Promi
|
|
|
233
239
|
state: "gone";
|
|
234
240
|
}>;
|
|
235
241
|
/**
|
|
236
|
-
* The account's address, as a purge step reads it
|
|
242
|
+
* The account's address, as a purge step reads it — `null` when there is no account, or no address. Read
|
|
237
243
|
* inside the step that asks, so it is never carried in a Workflow's journal.
|
|
238
244
|
*/
|
|
239
245
|
export declare function purgeAddress(db: AuthDatabase, userId: string): Promise<string | null>;
|
|
@@ -243,7 +249,7 @@ export interface DuePurge {
|
|
|
243
249
|
readonly deletedAt: number;
|
|
244
250
|
}
|
|
245
251
|
/**
|
|
246
|
-
* The accounts whose purge is due — deleted, with `purgeAfter` passed — oldest first, at most `limit
|
|
252
|
+
* The accounts whose purge is due — deleted, with `purgeAfter` passed — oldest first, at most `limit`.
|
|
247
253
|
* What the daily cron starts a purge for. An account still inside its window is not here, and neither is one
|
|
248
254
|
* that was restored. Each carries its deletion's start, which names the purge's instance (`../purge/start.ts`).
|
|
249
255
|
*/
|
|
@@ -251,16 +257,18 @@ export declare function duePurges(deps: LifecycleDeps, limit: number): Promise<D
|
|
|
251
257
|
/**
|
|
252
258
|
* Record that one purge step — one capability's contribution — erased its rows. The contribution's summary is
|
|
253
259
|
* the row's reason, so the history says what the step erased and not only that it ran. With `retained`, the step
|
|
254
|
-
* kept its rows instead
|
|
260
|
+
* kept its rows instead: the row is `purge_retained`, its reason is the basis the capability gave, and its
|
|
261
|
+
* `basisKey` the catalog key that translates it, when the capability names one.
|
|
255
262
|
*/
|
|
256
263
|
export declare function recordPurgeStep(deps: LifecycleDeps, input: {
|
|
257
264
|
userId: string;
|
|
258
265
|
step: string;
|
|
259
266
|
summary?: string | null;
|
|
260
267
|
retained?: boolean;
|
|
268
|
+
basisKey?: string;
|
|
261
269
|
}): Promise<void>;
|
|
262
270
|
/**
|
|
263
|
-
* Record that a purge gave up
|
|
271
|
+
* Record that a purge gave up: the step it stopped at, in the history and in the trail. The daily pass starts
|
|
264
272
|
* the purge again tomorrow, so this is where it stands until then, not an end. The failure's message is never
|
|
265
273
|
* written: it is code the kit did not write, and it may name the person.
|
|
266
274
|
*/
|
|
@@ -269,7 +277,7 @@ export declare function recordPurgeFailure(deps: LifecycleDeps, input: {
|
|
|
269
277
|
step: string;
|
|
270
278
|
}): Promise<void>;
|
|
271
279
|
/**
|
|
272
|
-
* The deletion-complete mail, sent **before the address is erased
|
|
280
|
+
* The deletion-complete mail, sent **before the address is erased**. The purge calls this after every
|
|
273
281
|
* other capability's rows are gone and before auth's own, which holds the address, so the last mail is
|
|
274
282
|
* enqueued while there is still an account to have sent it to. The address is handed in, captured before the
|
|
275
283
|
* first step. `notify: false` sends nothing, whatever the config says.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transitions.d.ts","sourceRoot":"","sources":["../../src/lifecycle/transitions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAuB,MAAM,2BAA2B,CAAC;AAEjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAInE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAuB,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,KAAK,EAA0B,kBAAkB,EAAyB,MAAM,SAAS,CAAC;AAIjG;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,6BAA6B;AAC7B,MAAM,WAAW,cAAc;IAC7B,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,oGAAoG;IACpG,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,kFAAkF;AAClF,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;IAC1B,mFAAmF;IACnF,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,iBAAiB,CAAC,CAAC;IACnE,2BAA2B;IAC3B,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IACnC,0FAA0F;IAC1F,QAAQ,CAAC,YAAY,C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