@pithy-sh/auth 0.9.0 → 0.11.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 (188) hide show
  1. package/README.md +8 -2
  2. package/dist/admin/users.js +1 -1
  3. package/dist/audit/actions.d.ts +40 -0
  4. package/dist/audit/actions.d.ts.map +1 -1
  5. package/dist/audit/actions.js +41 -1
  6. package/dist/audit/emit.d.ts +2 -0
  7. package/dist/audit/emit.d.ts.map +1 -1
  8. package/dist/audit/emit.js +2 -2
  9. package/dist/capability.d.ts +45 -1
  10. package/dist/capability.d.ts.map +1 -1
  11. package/dist/capability.js +40 -5
  12. package/dist/client/lifecycle.d.ts +19 -0
  13. package/dist/client/lifecycle.d.ts.map +1 -0
  14. package/dist/client/lifecycle.js +25 -0
  15. package/dist/client/projection.d.ts +4 -0
  16. package/dist/client/projection.d.ts.map +1 -1
  17. package/dist/data/betterAuth.d.ts +4 -0
  18. package/dist/data/betterAuth.d.ts.map +1 -1
  19. package/dist/data/betterAuth.js +6 -2
  20. package/dist/data/kitFields.d.ts +20 -25
  21. package/dist/data/kitFields.d.ts.map +1 -1
  22. package/dist/data/kitFields.js +28 -32
  23. package/dist/data/tables.d.ts +29 -2
  24. package/dist/data/tables.d.ts.map +1 -1
  25. package/dist/data/tables.js +5 -3
  26. package/dist/data/userLifecycle.d.ts +62 -0
  27. package/dist/data/userLifecycle.d.ts.map +1 -0
  28. package/dist/data/userLifecycle.js +51 -0
  29. package/dist/http/adminRoutes.d.ts.map +1 -1
  30. package/dist/http/adminRoutes.js +270 -5
  31. package/dist/http/guards.d.ts +24 -1
  32. package/dist/http/guards.d.ts.map +1 -1
  33. package/dist/http/guards.js +59 -3
  34. package/dist/http/lifecycleGate.d.ts +18 -0
  35. package/dist/http/lifecycleGate.d.ts.map +1 -0
  36. package/dist/http/lifecycleGate.js +75 -0
  37. package/dist/http/middleware.d.ts +30 -1
  38. package/dist/http/middleware.d.ts.map +1 -1
  39. package/dist/http/middleware.js +89 -7
  40. package/dist/http/providerRefusal.d.ts.map +1 -1
  41. package/dist/http/providerRefusal.js +8 -0
  42. package/dist/http/resolve.d.ts.map +1 -1
  43. package/dist/http/resolve.js +7 -4
  44. package/dist/http/responses.d.ts +180 -0
  45. package/dist/http/responses.d.ts.map +1 -1
  46. package/dist/http/responses.js +142 -1
  47. package/dist/http/routes.d.ts +1 -0
  48. package/dist/http/routes.d.ts.map +1 -1
  49. package/dist/http/routes.js +65 -4
  50. package/dist/http/schemas.d.ts +57 -0
  51. package/dist/http/schemas.d.ts.map +1 -1
  52. package/dist/http/schemas.js +51 -1
  53. package/dist/http/views.d.ts +39 -2
  54. package/dist/http/views.d.ts.map +1 -1
  55. package/dist/http/views.js +105 -1
  56. package/dist/instance/auth.d.ts +55 -3
  57. package/dist/instance/auth.d.ts.map +1 -1
  58. package/dist/instance/auth.js +53 -2
  59. package/dist/instance/microsoftEmail.d.ts +70 -0
  60. package/dist/instance/microsoftEmail.d.ts.map +1 -0
  61. package/dist/instance/microsoftEmail.js +96 -0
  62. package/dist/instance/providerSignInGate.d.ts +7 -6
  63. package/dist/instance/providerSignInGate.d.ts.map +1 -1
  64. package/dist/instance/providerSignInGate.js +7 -6
  65. package/dist/instance/providers.d.ts +7 -5
  66. package/dist/instance/providers.d.ts.map +1 -1
  67. package/dist/instance/providers.js +5 -3
  68. package/dist/instance/secrets.d.ts +64 -3
  69. package/dist/instance/secrets.d.ts.map +1 -1
  70. package/dist/instance/secrets.js +44 -5
  71. package/dist/lifecycle/audited.d.ts +48 -0
  72. package/dist/lifecycle/audited.d.ts.map +1 -0
  73. package/dist/lifecycle/audited.js +65 -0
  74. package/dist/lifecycle/enforce.d.ts +75 -0
  75. package/dist/lifecycle/enforce.d.ts.map +1 -0
  76. package/dist/lifecycle/enforce.js +111 -0
  77. package/dist/lifecycle/hooks.d.ts +53 -0
  78. package/dist/lifecycle/hooks.d.ts.map +1 -0
  79. package/dist/lifecycle/hooks.js +2 -0
  80. package/dist/lifecycle/reason.d.ts +11 -0
  81. package/dist/lifecycle/reason.d.ts.map +1 -0
  82. package/dist/lifecycle/reason.js +13 -0
  83. package/dist/lifecycle/request.d.ts +18 -0
  84. package/dist/lifecycle/request.d.ts.map +1 -0
  85. package/dist/lifecycle/request.js +31 -0
  86. package/dist/lifecycle/state.d.ts +64 -0
  87. package/dist/lifecycle/state.d.ts.map +1 -0
  88. package/dist/lifecycle/state.js +90 -0
  89. package/dist/lifecycle/transitions.d.ts +272 -0
  90. package/dist/lifecycle/transitions.d.ts.map +1 -0
  91. package/dist/lifecycle/transitions.js +623 -0
  92. package/dist/migrations/0004_user_lifecycle.d.ts +28 -0
  93. package/dist/migrations/0004_user_lifecycle.d.ts.map +1 -0
  94. package/dist/migrations/0004_user_lifecycle.js +47 -0
  95. package/dist/migrations/0005_purge_once.d.ts +22 -0
  96. package/dist/migrations/0005_purge_once.d.ts.map +1 -0
  97. package/dist/migrations/0005_purge_once.js +35 -0
  98. package/dist/migrations/pluginTables.d.ts +8 -0
  99. package/dist/migrations/pluginTables.d.ts.map +1 -1
  100. package/dist/migrations/pluginTables.js +8 -1
  101. package/dist/migrations/set.d.ts +3 -1
  102. package/dist/migrations/set.d.ts.map +1 -1
  103. package/dist/migrations/set.js +6 -2
  104. package/dist/peer.d.ts +4 -0
  105. package/dist/peer.d.ts.map +1 -1
  106. package/dist/purge/contribution.d.ts +47 -0
  107. package/dist/purge/contribution.d.ts.map +1 -0
  108. package/dist/purge/contribution.js +141 -0
  109. package/dist/purge/retryPolicy.d.ts +22 -0
  110. package/dist/purge/retryPolicy.d.ts.map +1 -0
  111. package/dist/purge/retryPolicy.js +26 -0
  112. package/dist/purge/run.d.ts +88 -0
  113. package/dist/purge/run.d.ts.map +1 -0
  114. package/dist/purge/run.js +102 -0
  115. package/dist/purge/specs.d.ts +71 -0
  116. package/dist/purge/specs.d.ts.map +1 -0
  117. package/dist/purge/specs.js +72 -0
  118. package/dist/purge/start.d.ts +42 -0
  119. package/dist/purge/start.d.ts.map +1 -0
  120. package/dist/purge/start.js +37 -0
  121. package/dist/purge/workflow.d.ts +58 -0
  122. package/dist/purge/workflow.d.ts.map +1 -0
  123. package/dist/purge/workflow.js +96 -0
  124. package/dist/test-utils/accountFootprint.d.ts +10 -0
  125. package/dist/test-utils/accountFootprint.d.ts.map +1 -0
  126. package/dist/test-utils/accountFootprint.js +44 -0
  127. package/dist/test-utils/liveApp.d.ts +21 -0
  128. package/dist/test-utils/liveApp.d.ts.map +1 -1
  129. package/dist/test-utils/liveApp.js +1 -0
  130. package/dist/test-utils/scopedBackend.d.ts +21 -0
  131. package/dist/test-utils/scopedBackend.d.ts.map +1 -1
  132. package/dist/test-utils/scopedBackend.js +7 -1
  133. package/dist/version.generated.d.ts +1 -1
  134. package/dist/version.generated.d.ts.map +1 -1
  135. package/dist/version.generated.js +1 -1
  136. package/docs/account-lifecycle.md +217 -0
  137. package/docs/apple-signin.md +7 -1
  138. package/docs/facebook-oauth.md +7 -1
  139. package/docs/github-oauth.md +7 -1
  140. package/docs/google-oauth.md +7 -1
  141. package/docs/microsoft-oauth.md +177 -0
  142. package/package.json +5 -5
  143. package/pithy.manifest.json +17 -3
  144. package/src/audit/actions.ts +42 -0
  145. package/src/audit/emit.ts +4 -2
  146. package/src/capability.ts +170 -52
  147. package/src/client/lifecycle.ts +27 -0
  148. package/src/client/projection.ts +4 -0
  149. package/src/data/betterAuth.ts +21 -1
  150. package/src/data/kitFields.ts +27 -0
  151. package/src/data/tables.ts +4 -2
  152. package/src/data/userLifecycle.ts +83 -0
  153. package/src/http/adminRoutes.ts +398 -2
  154. package/src/http/guards.ts +61 -1
  155. package/src/http/lifecycleGate.ts +78 -0
  156. package/src/http/middleware.ts +104 -2
  157. package/src/http/providerRefusal.ts +10 -0
  158. package/src/http/resolve.ts +8 -3
  159. package/src/http/responses.ts +245 -0
  160. package/src/http/routes.ts +93 -4
  161. package/src/http/schemas.ts +110 -0
  162. package/src/http/views.ts +147 -2
  163. package/src/instance/auth.ts +74 -2
  164. package/src/instance/microsoftEmail.ts +111 -0
  165. package/src/instance/providerSignInGate.ts +7 -6
  166. package/src/instance/providers.ts +8 -4
  167. package/src/instance/secrets.ts +59 -5
  168. package/src/lifecycle/audited.ts +104 -0
  169. package/src/lifecycle/enforce.ts +139 -0
  170. package/src/lifecycle/hooks.ts +54 -0
  171. package/src/lifecycle/reason.ts +11 -0
  172. package/src/lifecycle/request.ts +39 -0
  173. package/src/lifecycle/state.ts +101 -0
  174. package/src/lifecycle/transitions.ts +872 -0
  175. package/src/migrations/0004_user_lifecycle.ts +68 -0
  176. package/src/migrations/0005_purge_once.ts +42 -0
  177. package/src/migrations/pluginTables.ts +19 -1
  178. package/src/migrations/set.ts +5 -1
  179. package/src/purge/contribution.ts +191 -0
  180. package/src/purge/retryPolicy.ts +26 -0
  181. package/src/purge/run.ts +185 -0
  182. package/src/purge/specs.ts +95 -0
  183. package/src/purge/start.ts +79 -0
  184. package/src/purge/workflow.ts +144 -0
  185. package/src/test-utils/accountFootprint.ts +95 -0
  186. package/src/test-utils/liveApp.ts +2 -1
  187. package/src/test-utils/scopedBackend.ts +2 -1
  188. package/src/version.generated.ts +1 -1
@@ -8,6 +8,16 @@ import { type GithubUserInfoResolver } from "./githubUserInfo";
8
8
  import { type ResolvedProviders, type SocialProviderId } from "./providers";
9
9
  import { type SessionSecretVersions } from "./sessionSecrets";
10
10
  export declare function socialProviders(deps: AuthInstanceDeps): Record<string, unknown> | undefined;
11
+ /**
12
+ * The providers whose email links into an existing account on the strength of their name alone.
13
+ *
14
+ * Google and Apple, and nobody else, permanently. Facebook's verified flag is asserted in its block with
15
+ * a reason; GitHub's comes from its emails API; Microsoft's is decided per sign-in by
16
+ * `./microsoftEmail.ts`, because Entra ID cannot vouch for an email it did not verify. Adding a provider
17
+ * here would skip the verified half of the linking gate for it — `./providerSignInGate.ts` reads the same
18
+ * list off the context.
19
+ */
20
+ export declare const TRUSTED_PROVIDERS: readonly string[];
11
21
  /**
12
22
  * The seeding guard: a new account may be created only for an email a provider has **verified**.
13
23
  *
@@ -21,7 +31,7 @@ export declare function socialProviders(deps: AuthInstanceDeps): Record<string,
21
31
  export declare function isUnverifiedSignup(user: {
22
32
  emailVerified?: boolean | null;
23
33
  }): boolean;
24
- /** The endpoint context a database hook is handed, narrowed to the two things attribution needs. */
34
+ /** The endpoint context a database hook is handed, narrowed to what attribution and refusal need. */
25
35
  interface HookContext {
26
36
  headers?: Headers;
27
37
  context?: {
@@ -31,6 +41,8 @@ interface HookContext {
31
41
  };
32
42
  } | null;
33
43
  };
44
+ /** The endpoint path this write was reached from, e.g. `/callback/google`. Absent outside an endpoint. */
45
+ path?: string;
34
46
  }
35
47
  /**
36
48
  * What the instance hands to Pithy's email seam to deliver. The route never sends inline — the hook
@@ -420,6 +432,26 @@ export declare function makeAuth<const Plugins extends readonly BetterAuthPlugin
420
432
  user: {
421
433
  modelName: "pithyAuthUsers";
422
434
  additionalFields: {
435
+ readonly suspendedAt: {
436
+ readonly type: "number";
437
+ readonly required: false;
438
+ readonly input: false;
439
+ };
440
+ readonly suspendedUntil: {
441
+ readonly type: "number";
442
+ readonly required: false;
443
+ readonly input: false;
444
+ };
445
+ readonly deletedAt: {
446
+ readonly type: "number";
447
+ readonly required: false;
448
+ readonly input: false;
449
+ };
450
+ readonly purgeAfter: {
451
+ readonly type: "number";
452
+ readonly required: false;
453
+ readonly input: false;
454
+ };
423
455
  readonly locale: {
424
456
  readonly type: "string";
425
457
  readonly required: false;
@@ -470,7 +502,7 @@ export declare function makeAuth<const Plugins extends readonly BetterAuthPlugin
470
502
  modelName: "pithyAuthAccounts";
471
503
  accountLinking: {
472
504
  enabled: true;
473
- trustedProviders: ("apple" | "google")[];
505
+ trustedProviders: string[];
474
506
  /**
475
507
  * **A signed-in user may attach a provider whose email differs from their account's.**
476
508
  *
@@ -1631,6 +1663,26 @@ export declare function makeAuth<const Plugins extends readonly BetterAuthPlugin
1631
1663
  user: {
1632
1664
  modelName: "pithyAuthUsers";
1633
1665
  additionalFields: {
1666
+ readonly suspendedAt: {
1667
+ readonly type: "number";
1668
+ readonly required: false;
1669
+ readonly input: false;
1670
+ };
1671
+ readonly suspendedUntil: {
1672
+ readonly type: "number";
1673
+ readonly required: false;
1674
+ readonly input: false;
1675
+ };
1676
+ readonly deletedAt: {
1677
+ readonly type: "number";
1678
+ readonly required: false;
1679
+ readonly input: false;
1680
+ };
1681
+ readonly purgeAfter: {
1682
+ readonly type: "number";
1683
+ readonly required: false;
1684
+ readonly input: false;
1685
+ };
1634
1686
  readonly locale: {
1635
1687
  readonly type: "string";
1636
1688
  readonly required: false;
@@ -1681,7 +1733,7 @@ export declare function makeAuth<const Plugins extends readonly BetterAuthPlugin
1681
1733
  modelName: "pithyAuthAccounts";
1682
1734
  accountLinking: {
1683
1735
  enabled: true;
1684
- trustedProviders: ("apple" | "google")[];
1736
+ trustedProviders: string[];
1685
1737
  /**
1686
1738
  * **A signed-in user may attach a provider whose email differs from their account's.**
1687
1739
  *
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/instance/auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,KAAK,gBAAgB,EAAc,MAAM,aAAa,CAAC;AAGhE,OAAO,EACL,KAAK,iBAAiB,EAKvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD,OAAO,EAAyB,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAEtF,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AA6BjF,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAA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,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUtD"}
@@ -5,8 +5,10 @@ import { claimedDelete, markSessionEnded, messageDeliveryDuring, sessionEndedDur
5
5
  import { KIT_SESSION_FIELDS, KIT_USER_FIELDS } from "../data/kitFields.js";
6
6
  import { parseDeviceMeta, registerDevice } from "../device/registry.js";
7
7
  import "../http/providerFreshness.js";
8
+ import { admitsDeletionSignIn, lifecycleRefusalFor } from "../lifecycle/enforce.js";
8
9
  import { refuseUnsafeProfile, sanitizeProfile } from "../profile/profile.js";
9
10
  import { defaultGithubUserInfo } from "./githubUserInfo.js";
11
+ import { microsoftProfileToUser } from "./microsoftEmail.js";
10
12
  import { kitPlugins } from "./plugins.js";
11
13
  import { providerUnavailable, unavailableProviderFor } from "./providers.js";
12
14
  import { betterAuthSecrets } from "./sessionSecrets.js";
@@ -71,9 +73,30 @@ function socialProviders(deps) {
71
73
  getUserInfo: deps.resolveGithubUserInfo ?? defaultGithubUserInfo(),
72
74
  ...signUpOption(deps.providerSignUp.github)
73
75
  };
76
+ if (deps.microsoft.state === "ready") {
77
+ const microsoft = deps.microsoft.credentials;
78
+ providers.microsoft = {
79
+ clientId: microsoft.clientId,
80
+ clientSecret: microsoft.clientSecret,
81
+ tenantId: microsoft.tenantId,
82
+ disableProfilePhoto: true,
83
+ mapProfileToUser: microsoftProfileToUser,
84
+ ...signUpOption(deps.providerSignUp.microsoft)
85
+ };
86
+ }
74
87
  return Object.keys(providers).length > 0 ? providers : void 0;
75
88
  }
76
89
  /**
90
+ * The providers whose email links into an existing account on the strength of their name alone.
91
+ *
92
+ * Google and Apple, and nobody else, permanently. Facebook's verified flag is asserted in its block with
93
+ * a reason; GitHub's comes from its emails API; Microsoft's is decided per sign-in by
94
+ * `./microsoftEmail.ts`, because Entra ID cannot vouch for an email it did not verify. Adding a provider
95
+ * here would skip the verified half of the linking gate for it — `./providerSignInGate.ts` reads the same
96
+ * list off the context.
97
+ */
98
+ const TRUSTED_PROVIDERS = ["google", "apple"];
99
+ /**
77
100
  * The seeding guard: a new account may be created only for an email a provider has **verified**.
78
101
  *
79
102
  * Passwordless sign-up (magic link / OTP) always creates `emailVerified: true`; a social sign-up
@@ -104,6 +127,32 @@ function refuseUnsafeProfileFields(user) {
104
127
  });
105
128
  }
106
129
  /**
130
+ * Refuse a session for an account that may not act, in the shape the endpoint creating it can answer.
131
+ *
132
+ * **On the social callback, an `APIError` carrying the kit's code**, because that endpoint answers a refusal
133
+ * by redirecting to the caller's `errorCallbackURL` with `?error=<code>` — but only for an `APIError`
134
+ * (`callback.mjs:192`). A `PithyError` would escape it and leave a browser mid-OAuth on a bare 403 body
135
+ * instead of back on the adopter's screen. The code is the same string either way, and the reason travels as
136
+ * `error_description`, which is where Better Auth puts a refusal's message.
137
+ *
138
+ * **Everywhere else, the `PithyError` itself**, which `handleBetterAuth` renders through the one error
139
+ * envelope — or, on the magic-link verify redirect, turns into the same `?error=` redirect.
140
+ */
141
+ function refuseSession(refusal, ctx) {
142
+ if (ctx?.path?.startsWith("/callback/")) {
143
+ const message = refusal.payload.message;
144
+ if (refusal.payload.code === "auth/account_deleted") throw new APIError("FORBIDDEN", {
145
+ code: "auth/account_deleted",
146
+ message
147
+ });
148
+ throw new APIError("FORBIDDEN", {
149
+ code: "auth/account_suspended",
150
+ message
151
+ });
152
+ }
153
+ throw refusal;
154
+ }
155
+ /**
107
156
  * Who caused a row change, read from the endpoint context Better Auth hands a database hook.
108
157
  *
109
158
  * **The context is absent as often as it is present, and that absence is information.** A hook reached
@@ -240,6 +289,8 @@ function makeAuth(deps) {
240
289
  * `deviceId` by override for the same reason.
241
290
  */
242
291
  before: async (session, ctx) => {
292
+ const refusal = await lifecycleRefusalFor(deps.db, session.userId, null, /* @__PURE__ */ new Date());
293
+ if (refusal && !admitsDeletionSignIn(refusal, ctx?.headers)) refuseSession(refusal, ctx);
243
294
  const carried = session.authenticatedAt;
244
295
  const authenticatedAt = carried !== void 0 ? carried : /* @__PURE__ */ new Date();
245
296
  const meta = ctx?.headers ? parseDeviceMeta(ctx.headers) : void 0;
@@ -388,7 +439,7 @@ before: async (session, ctx) => {
388
439
  modelName: "pithyAuthAccounts",
389
440
  accountLinking: {
390
441
  enabled: true,
391
- trustedProviders: ["google", "apple"],
442
+ trustedProviders: [...TRUSTED_PROVIDERS],
392
443
  /**
393
444
  * **A signed-in user may attach a provider whose email differs from their account's.**
394
445
  *
@@ -432,4 +483,4 @@ before: async (session, ctx) => {
432
483
  });
433
484
  }
434
485
  //#endregion
435
- export { isUnverifiedSignup, makeAuth, socialProviders };
486
+ export { TRUSTED_PROVIDERS, isUnverifiedSignup, makeAuth, socialProviders };
@@ -0,0 +1,70 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ /**
4
+ * Whether a Microsoft sign-in's email is the signer's own — the one decision the Microsoft provider adds (#262).
5
+ *
6
+ * ## Why Microsoft needs a rule of its own
7
+ *
8
+ * Every other provider the kit serves can say which address it verified. Entra ID cannot. A work or
9
+ * school ID token carries no `email_verified` claim, and its `email` is read from the directory's `mail`
10
+ * attribute — which a tenant admin sets to any string, a stranger's address at a domain they do not own
11
+ * included. Sign in, and the token asserts you are somebody else. That is the nOAuth takeover class, and
12
+ * it is a property of Entra ID, not of an app's configuration. Microsoft's own claims reference says of
13
+ * `email`: "This value isn't guaranteed to be correct, and is mutable over time - never use it for
14
+ * authorization." So Microsoft stays out of `trustedProviders` permanently, and this decides the flag.
15
+ *
16
+ * ## The three ways an address is verified, and nothing else
17
+ *
18
+ * - **`xms_edov === true`** — "email domain owner verified", the optional claim Microsoft published as
19
+ * the nOAuth remediation. The tenant provably owns the address's domain, so it cannot be a stranger's.
20
+ * Off unless the app registration asks for it; `docs/microsoft-oauth.md` walks that step.
21
+ * - **`tid` is the personal-accounts tenant.** A personal Microsoft account is in no directory, has no
22
+ * admin, and its address is the account itself, confirmed by Microsoft at sign-up. It never carries
23
+ * `xms_edov`, so it needs its own clause.
24
+ * - **Linking from inside the account, to the account's own address.** The verify-to-link challenge's
25
+ * second half. Somebody refused above signs in by magic link — which proves the address — and connects
26
+ * Microsoft from inside. That Microsoft identity naming the very address the session holds is verified
27
+ * by the kit, not by Microsoft. A different address is not, and Better Auth's link branch refuses it.
28
+ *
29
+ * Anything else — the claim absent, `false`, `"true"`, `1` — is unverified. **Absence is never read as
30
+ * verification**, and only the boolean `true` is. `email_verified` and `verified_primary_email` are read
31
+ * by Better Auth's own default and deliberately not here: Entra does not issue the first for work
32
+ * accounts, and the second is sourced from directory attributes this rule does not get to vouch for.
33
+ *
34
+ * `oid` and `tid` are immutable, so once an identity is linked it signs in on `oid` forever
35
+ * (`./providerSignInGate.ts`, row 1) and none of this runs again for it.
36
+ */
37
+ /**
38
+ * The tenant id every personal Microsoft account signs in under.
39
+ *
40
+ * Source: https://learn.microsoft.com/en-us/entra/identity-platform/id-token-claims-reference — the `tid`
41
+ * row: "For sign-ins to the personal Microsoft account tenant (services like Xbox, Teams for Life, or
42
+ * Outlook), the value is `9188040d-6c67-4c5b-b112-36a304b66dad`." The `iss` row names the same GUID.
43
+ * Compared exactly: Microsoft issues it lowercase, and a token that spells it otherwise is not one of its.
44
+ */
45
+ export declare const MICROSOFT_PERSONAL_ACCOUNTS_TENANT_ID = "9188040d-6c67-4c5b-b112-36a304b66dad";
46
+ /** The part of a link-in-progress this rule reads: the signed-in account's own address. */
47
+ export interface LinkInProgress {
48
+ /** The address on the account the session belongs to, as Better Auth's `/link-social` stored it. */
49
+ readonly email: unknown;
50
+ }
51
+ /**
52
+ * Decide the flag from the decoded ID token and, on a link, the account it is being linked to.
53
+ *
54
+ * Pure, so every hostile shape can be driven without a request. `profile` is the whole decoded ID token —
55
+ * Better Auth hands `mapProfileToUser` the `decodeJwt` result itself (`@better-auth/core`
56
+ * `social-providers/microsoft-entra-id.mjs`), so `xms_edov` and `tid` are in reach as claims, not as
57
+ * fields somebody copied.
58
+ */
59
+ export declare function microsoftEmailVerified(profile: Readonly<Record<string, unknown>>, link: LinkInProgress | null): boolean;
60
+ /**
61
+ * The Microsoft block's `mapProfileToUser`: the rule, applied to this callback.
62
+ *
63
+ * **It always states the flag.** Better Auth computes its own default first and spreads this over it, so
64
+ * a mapper that omitted the key on the unverified path would leave that default — read off claims a
65
+ * tenant can influence — standing.
66
+ */
67
+ export declare function microsoftProfileToUser(profile: Readonly<Record<string, unknown>>): Promise<{
68
+ emailVerified: boolean;
69
+ }>;
70
+ //# sourceMappingURL=microsoftEmail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microsoftEmail.d.ts","sourceRoot":"","sources":["../../src/instance/microsoftEmail.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,qCAAqC,yCAAyC,CAAC;AAE5F,2FAA2F;AAC3F,MAAM,WAAW,cAAc;IAC7B,oGAAoG;IACpG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC1C,IAAI,EAAE,cAAc,GAAG,IAAI,GAC1B,OAAO,CAQT;AAwBD;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACzC,OAAO,CAAC;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAAC,CAErC"}
@@ -0,0 +1,96 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { getOAuthState } from "better-auth/api";
4
+ //#region src/instance/microsoftEmail.ts
5
+ /**
6
+ * Whether a Microsoft sign-in's email is the signer's own — the one decision the Microsoft provider adds (#262).
7
+ *
8
+ * ## Why Microsoft needs a rule of its own
9
+ *
10
+ * Every other provider the kit serves can say which address it verified. Entra ID cannot. A work or
11
+ * school ID token carries no `email_verified` claim, and its `email` is read from the directory's `mail`
12
+ * attribute — which a tenant admin sets to any string, a stranger's address at a domain they do not own
13
+ * included. Sign in, and the token asserts you are somebody else. That is the nOAuth takeover class, and
14
+ * it is a property of Entra ID, not of an app's configuration. Microsoft's own claims reference says of
15
+ * `email`: "This value isn't guaranteed to be correct, and is mutable over time - never use it for
16
+ * authorization." So Microsoft stays out of `trustedProviders` permanently, and this decides the flag.
17
+ *
18
+ * ## The three ways an address is verified, and nothing else
19
+ *
20
+ * - **`xms_edov === true`** — "email domain owner verified", the optional claim Microsoft published as
21
+ * the nOAuth remediation. The tenant provably owns the address's domain, so it cannot be a stranger's.
22
+ * Off unless the app registration asks for it; `docs/microsoft-oauth.md` walks that step.
23
+ * - **`tid` is the personal-accounts tenant.** A personal Microsoft account is in no directory, has no
24
+ * admin, and its address is the account itself, confirmed by Microsoft at sign-up. It never carries
25
+ * `xms_edov`, so it needs its own clause.
26
+ * - **Linking from inside the account, to the account's own address.** The verify-to-link challenge's
27
+ * second half. Somebody refused above signs in by magic link — which proves the address — and connects
28
+ * Microsoft from inside. That Microsoft identity naming the very address the session holds is verified
29
+ * by the kit, not by Microsoft. A different address is not, and Better Auth's link branch refuses it.
30
+ *
31
+ * Anything else — the claim absent, `false`, `"true"`, `1` — is unverified. **Absence is never read as
32
+ * verification**, and only the boolean `true` is. `email_verified` and `verified_primary_email` are read
33
+ * by Better Auth's own default and deliberately not here: Entra does not issue the first for work
34
+ * accounts, and the second is sourced from directory attributes this rule does not get to vouch for.
35
+ *
36
+ * `oid` and `tid` are immutable, so once an identity is linked it signs in on `oid` forever
37
+ * (`./providerSignInGate.ts`, row 1) and none of this runs again for it.
38
+ */
39
+ /**
40
+ * The tenant id every personal Microsoft account signs in under.
41
+ *
42
+ * Source: https://learn.microsoft.com/en-us/entra/identity-platform/id-token-claims-reference — the `tid`
43
+ * row: "For sign-ins to the personal Microsoft account tenant (services like Xbox, Teams for Life, or
44
+ * Outlook), the value is `9188040d-6c67-4c5b-b112-36a304b66dad`." The `iss` row names the same GUID.
45
+ * Compared exactly: Microsoft issues it lowercase, and a token that spells it otherwise is not one of its.
46
+ */
47
+ const MICROSOFT_PERSONAL_ACCOUNTS_TENANT_ID = "9188040d-6c67-4c5b-b112-36a304b66dad";
48
+ /**
49
+ * Decide the flag from the decoded ID token and, on a link, the account it is being linked to.
50
+ *
51
+ * Pure, so every hostile shape can be driven without a request. `profile` is the whole decoded ID token —
52
+ * Better Auth hands `mapProfileToUser` the `decodeJwt` result itself (`@better-auth/core`
53
+ * `social-providers/microsoft-entra-id.mjs`), so `xms_edov` and `tid` are in reach as claims, not as
54
+ * fields somebody copied.
55
+ */
56
+ function microsoftEmailVerified(profile, link) {
57
+ if (profile.xms_edov === true) return true;
58
+ if (profile.tid === "9188040d-6c67-4c5b-b112-36a304b66dad") return true;
59
+ if (link === null) return false;
60
+ const { email } = profile;
61
+ if (typeof email !== "string" || email.length === 0) return false;
62
+ if (typeof link.email !== "string" || link.email.length === 0) return false;
63
+ return email.toLowerCase() === link.email.toLowerCase();
64
+ }
65
+ /**
66
+ * The link this callback completes, or `null` when it is a sign-in.
67
+ *
68
+ * `link` is written by Better Auth's `/link-social` alone: `generateState` spreads the caller's
69
+ * `additionalData` first and assigns `link` last, so a sign-in overwrites any injected one
70
+ * (`./providerSignInGate.ts` records it, and plants against it).
71
+ *
72
+ * **`getOAuthState()` throws where no request state was established**, and here the throw is caught on
73
+ * purpose, unlike the gate's. The gate's safe direction is a loud failure; this one's is *unverified*,
74
+ * and that is exactly what a missing link means.
75
+ */
76
+ async function linkInProgress() {
77
+ try {
78
+ const link = (await getOAuthState())?.link;
79
+ if (typeof link !== "object" || link === null || !("email" in link)) return null;
80
+ return { email: link.email };
81
+ } catch {
82
+ return null;
83
+ }
84
+ }
85
+ /**
86
+ * The Microsoft block's `mapProfileToUser`: the rule, applied to this callback.
87
+ *
88
+ * **It always states the flag.** Better Auth computes its own default first and spreads this over it, so
89
+ * a mapper that omitted the key on the unverified path would leave that default — read off claims a
90
+ * tenant can influence — standing.
91
+ */
92
+ async function microsoftProfileToUser(profile) {
93
+ return { emailVerified: microsoftEmailVerified(profile, await linkInProgress()) };
94
+ }
95
+ //#endregion
96
+ export { MICROSOFT_PERSONAL_ACCOUNTS_TENANT_ID, microsoftEmailVerified, microsoftProfileToUser };
@@ -60,14 +60,15 @@ import type { BetterAuthPlugin } from "better-auth";
60
60
  * ## Why a wrapper, and not a `getUserInfo` supplied in the config block
61
61
  *
62
62
  * `options.getUserInfo` short-circuits each provider's own resolver on its first line
63
- * (`social-providers/google.mjs:118`, `facebook.mjs:93`, `apple.mjs:62`, `github.mjs:65`), so supplying
64
- * one means reimplementing the profile fetch it replaced — Google's id-token decode, Facebook's
65
- * access-token-owner check. `./githubUserInfo.ts` already records what that costs: replacing GitHub's
66
- * resolver silently dropped `name` and `image`, which had to be re-derived. Wrapping calls the
67
- * dependency's own resolver and reads its result, so nothing is reimplemented and nothing reconstructed.
63
+ * (`social-providers/google.mjs:118`, `facebook.mjs:93`, `apple.mjs:62`, `github.mjs:65`,
64
+ * `microsoft-entra-id.mjs:99`), so supplying one means reimplementing the profile fetch it replaced —
65
+ * Google's id-token decode, Facebook's access-token-owner check. `./githubUserInfo.ts` already records
66
+ * what that costs: replacing GitHub's resolver silently dropped `name` and `image`, which had to be
67
+ * re-derived. Wrapping calls the dependency's own resolver and reads its result, so nothing is
68
+ * reimplemented and nothing reconstructed.
68
69
  *
69
70
  * **And it is the wrapping that makes the predicate read the right flag.** `mapProfileToUser` is applied
70
- * *inside* each provider's own `getUserInfo` — every one of the four spreads `...userMap` over the
71
+ * *inside* each provider's own `getUserInfo` — every one of the five spreads `...userMap` over the
71
72
  * `emailVerified` it computed — so the value this module reads is by construction the **effective** flag.
72
73
  * Facebook is the trap that makes this load-bearing: it sits outside `trustedProviders` like GitHub, but
73
74
  * `./auth.ts` asserts its address as verified with a documented reason, and its OAuth response carries no
@@ -1 +1 @@
1
- {"version":3,"file":"providerSignInGate.d.ts","sourceRoot":"","sources":["../../src/instance/providerSignInGate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAe,gBAAgB,EAAiB,MA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KD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,gBAAgB,CAkBjF"}
@@ -62,14 +62,15 @@ import { APIError, getOAuthState } from "better-auth/api";
62
62
  * ## Why a wrapper, and not a `getUserInfo` supplied in the config block
63
63
  *
64
64
  * `options.getUserInfo` short-circuits each provider's own resolver on its first line
65
- * (`social-providers/google.mjs:118`, `facebook.mjs:93`, `apple.mjs:62`, `github.mjs:65`), so supplying
66
- * one means reimplementing the profile fetch it replaced — Google's id-token decode, Facebook's
67
- * access-token-owner check. `./githubUserInfo.ts` already records what that costs: replacing GitHub's
68
- * resolver silently dropped `name` and `image`, which had to be re-derived. Wrapping calls the
69
- * dependency's own resolver and reads its result, so nothing is reimplemented and nothing reconstructed.
65
+ * (`social-providers/google.mjs:118`, `facebook.mjs:93`, `apple.mjs:62`, `github.mjs:65`,
66
+ * `microsoft-entra-id.mjs:99`), so supplying one means reimplementing the profile fetch it replaced —
67
+ * Google's id-token decode, Facebook's access-token-owner check. `./githubUserInfo.ts` already records
68
+ * what that costs: replacing GitHub's resolver silently dropped `name` and `image`, which had to be
69
+ * re-derived. Wrapping calls the dependency's own resolver and reads its result, so nothing is
70
+ * reimplemented and nothing reconstructed.
70
71
  *
71
72
  * **And it is the wrapping that makes the predicate read the right flag.** `mapProfileToUser` is applied
72
- * *inside* each provider's own `getUserInfo` — every one of the four spreads `...userMap` over the
73
+ * *inside* each provider's own `getUserInfo` — every one of the five spreads `...userMap` over the
73
74
  * `emailVerified` it computed — so the value this module reads is by construction the **effective** flag.
74
75
  * Facebook is the trap that makes this load-bearing: it sits outside `trustedProviders` like GitHub, but
75
76
  * `./auth.ts` asserts its address as verified with a documented reason, and its OAuth response carries no
@@ -1,7 +1,7 @@
1
1
  // SPDX-FileCopyrightText: 2026 Pithy
2
2
  // SPDX-License-Identifier: MIT
3
3
  import { PithyError } from "@pithy-sh/core/src/error/pithyError";
4
- import type { AppleOAuthCredentials, FacebookOAuthCredentials, GithubOAuthCredentials, GoogleOAuthCredentials } from "./secrets";
4
+ import type { AppleOAuthCredentials, FacebookOAuthCredentials, GithubOAuthCredentials, GoogleOAuthCredentials, MicrosoftOAuthCredentials } from "./secrets";
5
5
  /**
6
6
  * What one social provider *is*, for one instance — three states, carried on the value (#381).
7
7
  *
@@ -51,15 +51,15 @@ export declare const PROVIDER_DISABLED: {
51
51
  readonly state: "disabled";
52
52
  };
53
53
  /** The social providers the kit composes. Ordered as they are declared in config. */
54
- export declare const SOCIAL_PROVIDER_IDS: readonly ["google", "apple", "facebook", "github"];
54
+ export declare const SOCIAL_PROVIDER_IDS: readonly ["google", "apple", "facebook", "github", "microsoft"];
55
55
  /** One of the kit's social providers. */
56
56
  export type SocialProviderId = (typeof SOCIAL_PROVIDER_IDS)[number];
57
57
  /**
58
58
  * Every provider's state for one instance.
59
59
  *
60
- * A record rather than four loose fields, because two things read it — the `socialProviders` block the
60
+ * A record rather than five loose fields, because two things read it — the `socialProviders` block the
61
61
  * instance is built from, and the refusal that answers a caller who asked for one that is not there —
62
- * and they must be reading the same four values or they will disagree about what is available.
62
+ * and they must be reading the same five values or they will disagree about what is available.
63
63
  */
64
64
  export interface ResolvedProviders {
65
65
  /** Google OAuth: disabled, ready with its credential pair, or declared and unreadable. */
@@ -70,10 +70,12 @@ export interface ResolvedProviders {
70
70
  facebook: ResolvedProvider<FacebookOAuthCredentials>;
71
71
  /** GitHub OAuth: disabled, ready with its credential pair, or declared and unreadable. */
72
72
  github: ResolvedProvider<GithubOAuthCredentials>;
73
+ /** Microsoft Entra ID: disabled, ready with its credential set and tenant, or declared and unreadable. */
74
+ microsoft: ResolvedProvider<MicrosoftOAuthCredentials>;
73
75
  }
74
76
  /**
75
77
  * Every provider disabled — what a composition that enables no social sign-in resolves to, and the
76
- * base a construction site spreads over rather than spelling four times.
78
+ * base a construction site spreads over rather than spelling five times.
77
79
  */
78
80
  export declare const NO_SOCIAL_PROVIDERS: Readonly<ResolvedProviders>;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U,CAAC;AAEnG,yCAAyC;AACzC,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,0FAA0F;IAC1F,MAAM,EAAE,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IACjD,0FAA0F;IAC1F,KAAK,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;IAC/C,4FAA4F;IAC5F,QAAQ,EAAE,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;IACrD,0FAA0F;IAC1F,MAAM,EAAE,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IACjD,0GAA0G;IAC1G,SAAS,EAAE,gBAAgB,CAAC,yBAAyB,CAAC,CAAC;CACxD;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,iBAAiB,CAM3D,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,WAAW,EAC/C,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,GAC/B,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAOxC;AAyBD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,iBAAiB,GAC3B,gBAAgB,GAAG,SAAS,CAO9B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU,CAQ1E"}
@@ -16,17 +16,19 @@ const SOCIAL_PROVIDER_IDS = [
16
16
  "google",
17
17
  "apple",
18
18
  "facebook",
19
- "github"
19
+ "github",
20
+ "microsoft"
20
21
  ];
21
22
  /**
22
23
  * Every provider disabled — what a composition that enables no social sign-in resolves to, and the
23
- * base a construction site spreads over rather than spelling four times.
24
+ * base a construction site spreads over rather than spelling five times.
24
25
  */
25
26
  const NO_SOCIAL_PROVIDERS = {
26
27
  google: PROVIDER_DISABLED,
27
28
  apple: PROVIDER_DISABLED,
28
29
  facebook: PROVIDER_DISABLED,
29
- github: PROVIDER_DISABLED
30
+ github: PROVIDER_DISABLED,
31
+ microsoft: PROVIDER_DISABLED
30
32
  };
31
33
  /**
32
34
  * Resolve one provider: `disabled` when the adopter did not enable it, `ready` with its credentials, or