@softistx/janus 0.78.0 → 0.79.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 +35 -13
- package/dist/auth/config/index.d.ts +1 -1
- package/dist/auth/config/index.d.ts.map +1 -1
- package/dist/auth/config/resolve-social.d.ts +1 -1
- package/dist/auth/config/resolve-social.d.ts.map +1 -1
- package/dist/auth/config/resolved-config.d.ts +3 -1
- package/dist/auth/config/resolved-config.d.ts.map +1 -1
- package/dist/auth/config/social-config.d.ts +31 -0
- package/dist/auth/config/social-config.d.ts.map +1 -1
- package/dist/auth/events.d.ts +3 -2
- package/dist/auth/events.d.ts.map +1 -1
- package/dist/auth/first-proof.d.ts +10 -2
- package/dist/auth/first-proof.d.ts.map +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/shared-api.d.ts.map +1 -1
- package/dist/auth/social/complete-link.d.ts +9 -1
- package/dist/auth/social/complete-link.d.ts.map +1 -1
- package/dist/auth/social/complete.d.ts +1 -0
- package/dist/auth/social/complete.d.ts.map +1 -1
- package/dist/auth/social/finish.d.ts +3 -0
- package/dist/auth/social/finish.d.ts.map +1 -1
- package/dist/auth/social/link-holder.d.ts +10 -1
- package/dist/auth/social/link-holder.d.ts.map +1 -1
- package/dist/auth/social/redeem.d.ts +2 -0
- package/dist/auth/social/redeem.d.ts.map +1 -1
- package/dist/auth/social/replace-holder.d.ts +37 -0
- package/dist/auth/social/replace-holder.d.ts.map +1 -0
- package/dist/auth/social/sign-in.d.ts +4 -1
- package/dist/auth/social/sign-in.d.ts.map +1 -1
- package/dist/auth/social/sign-up.d.ts +1 -0
- package/dist/auth/social/sign-up.d.ts.map +1 -1
- package/dist/auth/types/social.d.ts +4 -1
- package/dist/auth/types/social.d.ts.map +1 -1
- package/dist/index.js +91 -19
- package/dist/index.js.map +14 -13
- package/docs/guide/email-flows.md +6 -1
- package/docs/guide/errors.md +3 -3
- package/docs/guide/events.md +7 -7
- package/docs/guide/magic-link.md +1 -1
- package/docs/guide/social.md +102 -5
- package/docs/roadmap.md +1 -0
- package/docs/troubleshooting.md +21 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -219,7 +219,7 @@ if (error instanceof JanusError) {
|
|
|
219
219
|
| `PASSKEY_INVALID` | 400 — a passkey registration's response does not verify (`reason` is for your logs) or its name is refused (`field: 'name'`) |
|
|
220
220
|
| `PASSKEY_TAKEN` | 409 — the credential is already registered |
|
|
221
221
|
| `PASSKEY_LIMIT` | 409 — the user holds `passkeys.maxPerUser` passkeys; `maxActive` carries the cap |
|
|
222
|
-
| `FLOW_EXPIRED`, `FLOW_MISMATCH`, `FLOW_PURPOSE_MISMATCH`, `RETURN_TO_INVALID` | 400 — a social flow that lapsed or was spent; a callback that is not the cookie's flow (also an older instance reading the six-part cookie of a flow started with `stepUp` during a rolling deploy); a flow of the other kind than the `purpose` (`'signIn'` or `'link'`) passed to `social.complete`; a `returnTo` that leaves the site. Start again |
|
|
222
|
+
| `FLOW_EXPIRED`, `FLOW_MISMATCH`, `FLOW_PURPOSE_MISMATCH`, `RETURN_TO_INVALID` | 400 — a social flow that lapsed or was spent; a callback that is not the cookie's flow, or a link flow started before the user's e-mail was proved (also an older instance reading the six-part cookie of a flow started with `stepUp` during a rolling deploy); a flow of the other kind than the `purpose` (`'signIn'` or `'link'`) passed to `social.complete`; a `returnTo` that leaves the site. Start again |
|
|
223
223
|
| `PROVIDER_ERROR` | 502 — the social provider failed, refused or was unreachable; `reason` (`denied`, `refused`, `unreachable`) is for your logs, never a body |
|
|
224
224
|
| `MAGIC_LINK_DISABLED` | 404 — `magicLink.request`, `prepare` or `confirm` with `magicLink: { enabled: false }`; refused before any store access |
|
|
225
225
|
| `SOCIAL_PROVIDER_UNKNOWN` | 404 — a provider the user type does not configure; `provider` |
|
|
@@ -1283,8 +1283,9 @@ type with an e-mail; `signInProven` alone proves nothing.
|
|
|
1283
1283
|
- **On an e-mail never proved, in one write**: marks it verified and drops
|
|
1284
1284
|
the password and the second factor — active or waiting, with its recovery
|
|
1285
1285
|
codes — and the avatar (`user.avatarRemoved` carries its `formerAvatarId`,
|
|
1286
|
-
so delete the image). It revokes every session and every API key and spends the reset links
|
|
1287
|
-
second-factor challenges
|
|
1286
|
+
so delete the image). It revokes every session and every API key and spends the reset links,
|
|
1287
|
+
second-factor challenges and what a session left waiting (an e-mail
|
|
1288
|
+
change, a link flow, a passkey registration, a step-up), before the write and after it, and sends
|
|
1288
1289
|
`user.emailVerified`, then `user.passwordChanged` when a password was
|
|
1289
1290
|
dropped and `user.secondFactorDisabled` when an active factor was.
|
|
1290
1291
|
Answers `{ user, proved: true }`.
|
|
@@ -1678,7 +1679,7 @@ core keeps, so the provider only checks them.
|
|
|
1678
1679
|
```ts
|
|
1679
1680
|
interface SocialFlowStart { readonly url: string; readonly flow: string; readonly expiresAt: Date; readonly setCookie: string }
|
|
1680
1681
|
type SocialCompleted<U, Challenge extends SecondFactorRequired = SecondFactorRequired> =
|
|
1681
|
-
| (SignedIn<U> & { provider: string; created: boolean; linked: boolean; returnTo: string | null; stepUp: SocialStepUpProof | null })
|
|
1682
|
+
| (SignedIn<U> & { provider: string; created: boolean; linked: boolean; replaced: boolean; returnTo: string | null; stepUp: SocialStepUpProof | null })
|
|
1682
1683
|
| (Challenge & { provider: string; returnTo: string | null; stepUp: SocialStepUpProof | null })
|
|
1683
1684
|
| SocialLinked<U>;
|
|
1684
1685
|
interface SocialLinked<U> { status: 'linked'; user: U; link: SocialLink; returnTo: string | null; stepUp: SocialStepUpProof | null }
|
|
@@ -1686,7 +1687,7 @@ interface SocialStepUpProof { acrValues: readonly string[] | null; maxAge: numbe
|
|
|
1686
1687
|
interface SocialLink { provider: string; accountId: string; email: string | null; linkedAt: Date }
|
|
1687
1688
|
```
|
|
1688
1689
|
|
|
1689
|
-
- **`social: { providers?, resolveProvider?, signUp?, freshWithin? }`** (one of `providers` and `resolveProvider` required) on a user type
|
|
1690
|
+
- **`social: { providers?, resolveProvider?, signUp?, unverifiedHolder?, freshWithin? }`** (one of `providers` and `resolveProvider` required) on a user type
|
|
1690
1691
|
(`users: { patient: { schema, social } }` for several). `providers` maps the
|
|
1691
1692
|
application's name for each provider (lowercase letters, digits and `-`,
|
|
1692
1693
|
starting with a letter, at most 32) to its `SocialProvider`. `resolveProvider(name)` (`SocialProviderResolver`, answering `Promise<SocialProvider | null>`)
|
|
@@ -1695,7 +1696,11 @@ interface SocialLink { provider: string; accountId: string; email: string | null
|
|
|
1695
1696
|
reaches it, `null` is `SOCIAL_PROVIDER_UNKNOWN`, a throw propagates untouched
|
|
1696
1697
|
(see the social guide). `providers` may then be left out. `signUp(profile)`
|
|
1697
1698
|
answers the fields of a new user, whose e-mail must be the provider's; absent or
|
|
1698
|
-
`false`, a stranger is refused. `
|
|
1699
|
+
`false`, a stranger is refused. `unverifiedHolder` (`'refuse'`, `'replace'`
|
|
1700
|
+
or a `SocialUnverifiedHolder`, `(holder, profile) => 'refuse' | 'replace'`;
|
|
1701
|
+
`'refuse'` when absent) decides
|
|
1702
|
+
what a provider-verified sign-in does with a user who holds the e-mail and
|
|
1703
|
+
never proved it: see the trap below. `freshWithin` (`'10m'`) is how recent the
|
|
1699
1704
|
session must be to `link`. `tokens: { socialFlow }` (`'10m'`) is how long a
|
|
1700
1705
|
flow waits for its callback. The store needs the `socialLinks` slot.
|
|
1701
1706
|
- **`social.start`** answers `{ url, flow, expiresAt, setCookie }`; `type` is
|
|
@@ -1721,7 +1726,8 @@ interface SocialLink { provider: string; accountId: string; email: string | null
|
|
|
1721
1726
|
`'link'`, the kind of flow the endpoint accepts, else `FLOW_PURPOSE_MISMATCH`;
|
|
1722
1727
|
see [social sign-in](docs/guide/social.md)), and answers
|
|
1723
1728
|
`signedIn` (`created`: a user was made; `linked`: this call linked the
|
|
1724
|
-
account
|
|
1729
|
+
account; `replaced`: an unverified holder of the e-mail was taken over,
|
|
1730
|
+
`social.unverifiedHolder`), `secondFactor` (a challenge; same as `signIn`) or `linked`. It takes
|
|
1725
1731
|
the `SignInOptions` of every sign-in (`device`).
|
|
1726
1732
|
- **Refusals**: `FLOW_EXPIRED`, `FLOW_MISMATCH`, `FLOW_PURPOSE_MISMATCH`,
|
|
1727
1733
|
`RETURN_TO_INVALID`, `PROVIDER_ERROR`, `SOCIAL_PROVIDER_UNKNOWN`, `SOCIAL_STEP_UP_UNMET`, `SIGN_UP_DISABLED`,
|
|
@@ -1762,19 +1768,19 @@ await auth.signUp({ email, password }); // the listener has the event before thi
|
|
|
1762
1768
|
| `type` | Sent by |
|
|
1763
1769
|
| --- | --- |
|
|
1764
1770
|
| `user.created` | `create`, `signUp` |
|
|
1765
|
-
| `user.emailVerified` | `verifyEmail.confirm` (with `{ firstProof: true }` it also drops a squatter's password and factor, like the next), `verifyEmail.proveFirst` and `setEmailVerified` (turning the flag on); `changeEmail.confirm`, `resetPassword.confirm`, `magicLink.confirm` and `signInCode.confirm`, whose link or code proves the e-mail too — never for an e-mail already verified |
|
|
1771
|
+
| `user.emailVerified` | `verifyEmail.confirm` (with `{ firstProof: true }` it also drops a squatter's password and factor, like the next), `verifyEmail.proveFirst` and `setEmailVerified` (turning the flag on); `changeEmail.confirm`, `resetPassword.confirm`, `magicLink.confirm` and `signInCode.confirm`, whose link or code proves the e-mail too; `social.complete` replacing an unverified holder (`social.unverifiedHolder`), whose provider does — never for an e-mail already verified |
|
|
1766
1772
|
| `user.passwordReset` | `resetPassword.confirm` |
|
|
1767
|
-
| `user.passwordChanged` | `changePassword`, `setPassword` (`first: true` when the user had no password before — skip the "changed" notice); `signInCode.confirm`, `magicLink.confirm` and `
|
|
1773
|
+
| `user.passwordChanged` | `changePassword`, `setPassword` (`first: true` when the user had no password before — skip the "changed" notice); `signInCode.confirm`, `magicLink.confirm`, `verifyEmail.proveFirst` and `social.complete` replacing an unverified holder (`social.unverifiedHolder`) when their first proof of the e-mail dropped a password — never a reset, which is `user.passwordReset` alone |
|
|
1768
1774
|
| `user.emailChanged` | `update` and `changeEmail.confirm`, when they changed the e-mail — carrying `formerEmail`, the address before (`null` for none) |
|
|
1769
1775
|
| `user.secondFactorEnabled` | `secondFactor.activate`, once the factor is active — not `enroll`, which leaves it waiting |
|
|
1770
|
-
| `user.secondFactorDisabled` | `secondFactor.disable`, when it removed an active factor; `signInCode.confirm`, `magicLink.confirm` and `
|
|
1776
|
+
| `user.secondFactorDisabled` | `secondFactor.disable`, when it removed an active factor; `signInCode.confirm`, `magicLink.confirm`, `verifyEmail.proveFirst` and `social.complete` replacing an unverified holder (`social.unverifiedHolder`) when their first proof of the e-mail removed one, after `user.emailVerified` and any `user.passwordChanged` — never for a user who had none, or one still waiting |
|
|
1771
1777
|
| `user.recoveryCodesRegenerated` | `secondFactor.regenerateRecoveryCodes` — not `activate`, whose codes come with `user.secondFactorEnabled` |
|
|
1772
1778
|
| `user.recoveryCodeUsed` | `secondFactor.recover`, once the recovery code is spent: a sign-in without the user's phone |
|
|
1773
1779
|
| `user.newDeviceSignedIn` | `signIn`, `secondFactor.confirm`, `secondFactor.recover`, `signInCode.confirm` and `magicLink.confirm`, given a `device` its token did not prove, once the sign-in is complete — carrying `sessionId`, the new session's. Never `signUp`, nor a call given no device |
|
|
1774
1780
|
| `user.avatarChanged` | `avatar.set`, when it wrote a different id — carrying `formerAvatarId`, the id replaced (`null` for a first avatar) |
|
|
1775
1781
|
| `user.avatarRemoved` | `avatar.remove`, when the user had one — carrying `formerAvatarId` |
|
|
1776
1782
|
| `user.socialLinked` | `social.complete`, when it linked an account: a link flow, a user matched by a verified e-mail, or the user a social sign-up created — carrying `provider`. Not for an account already linked to that user |
|
|
1777
|
-
| `user.socialUnlinked` | `social.unlink`, when it deleted a link — carrying `provider` |
|
|
1783
|
+
| `user.socialUnlinked` | `social.unlink`, when it deleted a link; `social.complete` replacing an unverified holder (`social.unverifiedHolder`), once per link it deleted — carrying `provider` |
|
|
1778
1784
|
| `user.passkeyAdded` | `passkeys.register`, once the passkey is stored — carrying `passkey: { credentialId, name }` |
|
|
1779
1785
|
| `user.passkeyRemoved` | `passkeys.remove`, when it deleted a passkey; `secondFactor.disable`, once per passkey it removed with the factor — carrying `passkey` |
|
|
1780
1786
|
| `user.passkeyCloneSuspected` | `secondFactor.confirmPasskey` or `stepUp.confirmPasskey`, when an assertion's counter did not move forward (both counters non-zero) — carrying `passkey`; the call is refused and the passkey stays active |
|
|
@@ -2831,6 +2837,22 @@ provider. The real owner recovers with `resetPassword`, or `verifyEmail` with
|
|
|
2831
2837
|
`{ firstProof: true }`, which prove the address and drop the squatter's
|
|
2832
2838
|
password; the next social sign-in then links.
|
|
2833
2839
|
|
|
2840
|
+
**`social.unverifiedHolder: 'replace'` lets the provider's proof be that first
|
|
2841
|
+
proof.** Where anyone can create an unverified account for an address (open
|
|
2842
|
+
sign-up, a sign-in code that creates the user), the refusal above locks the
|
|
2843
|
+
real owner out of a provider sign-in for as long as the account stays
|
|
2844
|
+
unverified. With `'replace'`, a sign-in whose provider vouches for the e-mail
|
|
2845
|
+
takes the account over: the social accounts linked to it are deleted, then the
|
|
2846
|
+
first proof of an e-mail runs (the password, the avatar, the second factor,
|
|
2847
|
+
the passkeys, the API keys and every session go; the e-mail is verified), then
|
|
2848
|
+
the account is linked and signed in, with `replaced: true` on the answer.
|
|
2849
|
+
**Only for providers whose `emailVerified` you trust for that address**: a
|
|
2850
|
+
provider that vouches wrongly hands the unverified account over. A function
|
|
2851
|
+
`(holder, profile) => 'refuse' | 'replace'` decides per provider and address
|
|
2852
|
+
(`profile.provider`, `profile.email`); anything but `'replace'` refuses. A
|
|
2853
|
+
verified holder is never replaced, and a provider that does not vouch never
|
|
2854
|
+
replaces.
|
|
2855
|
+
|
|
2834
2856
|
**One provider account links to one user per instance**, whatever the type:
|
|
2835
2857
|
the second is `SOCIAL_ACCOUNT_TAKEN`. One Google account cannot be both a
|
|
2836
2858
|
patient and a staff member.
|
|
@@ -2914,7 +2936,7 @@ subdomain) and `https`, except `http://localhost`, `http://<name>.localhost` (su
|
|
|
2914
2936
|
|
|
2915
2937
|
## Type safety, counted
|
|
2916
2938
|
|
|
2917
|
-
**Three hundred and sixty-
|
|
2939
|
+
**Three hundred and sixty-three plausible mistakes, three hundred and sixty-three refused at compile time — and
|
|
2918
2940
|
two gaps, named.**
|
|
2919
2941
|
|
|
2920
2942
|
The lists are typechecked and never run, with one `@ts-expect-error` per
|
|
@@ -2925,7 +2947,7 @@ the identity stores' port, from the point of view of the person implementing
|
|
|
2925
2947
|
it), `test/types/auth/` (two hundred and nine, on `janus()`, from the point of view of
|
|
2926
2948
|
the application — thirteen of them on the second factor, three on sign-in codes,
|
|
2927
2949
|
five on user events, four on step-ups, six on the sign-in throttle, five on the mail throttle, three on the second-factor throttle, four on
|
|
2928
|
-
sign-in links, six on devices, seven on reading and writing users (two of them on `findMany`), five on requests in two steps, three on signing in on the application's proof, three on finding a user by e-mail, three on proving an e-mail on the application's proof, six on changing an e-mail, sixteen on confirming a link at the root of several types and binding it to a user, twelve on the wiring of `janus()` (reserved type names included), six on signing up and in, four on `findOrCreate`, five on avatars, five on verified sign-up, two on the cut-off of `signOutEverywhere`, nine on API keys (five on scopes, bound objects and expiry notices), thirty-two on invitations — a `beforeAccept` that answers an object, a user type with no e-mail, a login that is not the e-mail, several types and no `type`, a `type` that is none of them, `accept` without the block, a `get` without its `scope`, a numeric `id`, an `issue` that leaves `invitedBy` out, a `ref`, `order`, `status`, `role` or `lapsed` of the wrong type, a `by` that is no string on `revoke` or `resend`, a list of types with an unknown name, a login that is not the e-mail or no e-mail, an empty list, a name listed twice, and an `issue` whose `type` is not a string, is none of the listed types or is missing with several types, and an `importHistory` record that is accepted without `acceptedAt`, revoked without `revokedAt`, of an unknown status, with no `key`, with a `type` that is not listed or a `createdAt` that is a string, and a `dryRun` that is no boolean — twenty on passkeys and four on the magic-link switch) `test/types/social/` (twenty-
|
|
2950
|
+
sign-in links, six on devices, seven on reading and writing users (two of them on `findMany`), five on requests in two steps, three on signing in on the application's proof, three on finding a user by e-mail, three on proving an e-mail on the application's proof, six on changing an e-mail, sixteen on confirming a link at the root of several types and binding it to a user, twelve on the wiring of `janus()` (reserved type names included), six on signing up and in, four on `findOrCreate`, five on avatars, five on verified sign-up, two on the cut-off of `signOutEverywhere`, nine on API keys (five on scopes, bound objects and expiry notices), thirty-two on invitations — a `beforeAccept` that answers an object, a user type with no e-mail, a login that is not the e-mail, several types and no `type`, a `type` that is none of them, `accept` without the block, a `get` without its `scope`, a numeric `id`, an `issue` that leaves `invitedBy` out, a `ref`, `order`, `status`, `role` or `lapsed` of the wrong type, a `by` that is no string on `revoke` or `resend`, a list of types with an unknown name, a login that is not the e-mail or no e-mail, an empty list, a name listed twice, and an `issue` whose `type` is not a string, is none of the listed types or is missing with several types, and an `importHistory` record that is accepted without `acceptedAt`, revoked without `revokedAt`, of an unknown status, with no `key`, with a `type` that is not listed or a `createdAt` that is a string, and a `dryRun` that is no boolean — twenty on passkeys and four on the magic-link switch) `test/types/social/` (twenty-three, on `auth.social`: a `social` block with neither providers nor a resolver, an `unverifiedHolder` that is an unknown word or a function answering a boolean, a `resolveProvider` that answers a name or undefined, or is not async, a step-up whose `acrValues` is a string, whose `maxAge` is no number, that asks for nothing or that has a third key, a misspelled provider, a type without social, social without an e-mail, a `signUp` on the wrong login or answering the wrong fields, a link given a bare user and a result switch missing a status and a `linked` result read for a session token) and `test/types/permissions/` (sixty, on the
|
|
2929
2951
|
permission model and the questions asked of it). The rule comes from
|
|
2930
2952
|
`nxgt-data`, and so does the reason to distrust the claim without the files:
|
|
2931
2953
|
when it was last measured on `@softistx/mongo`, *seven of twelve plausible
|
|
@@ -19,6 +19,6 @@ export type { PasswordConfig } from './password-config';
|
|
|
19
19
|
export { RESERVED_FIELDS, RESERVED_TYPES, SINGLE_TYPE } from './reserved';
|
|
20
20
|
export { resolveConfig } from './resolve-config';
|
|
21
21
|
export type { ResolvedConfig, ResolvedSocial, ResolvedType, } from './resolved-config';
|
|
22
|
-
export type { FederatedAmr, SocialConfig, SocialIdentity, SocialProfile, SocialProvider, SocialProviderResolver, SocialStepUpRequest, } from './social-config';
|
|
22
|
+
export type { FederatedAmr, SocialConfig, SocialIdentity, SocialProfile, SocialProvider, SocialProviderResolver, SocialStepUpRequest, SocialUnverifiedHolder, } from './social-config';
|
|
23
23
|
export type { FieldsJson, SessionConfig, UserSchema, UserTypeConfig, } from './user-type';
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,YAAY,EACX,YAAY,EACZ,aAAa,EACb,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EACX,cAAc,EACd,cAAc,EACd,YAAY,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,YAAY,EACX,YAAY,EACZ,aAAa,EACb,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EACX,cAAc,EACd,cAAc,EACd,YAAY,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACX,UAAU,EACV,aAAa,EACb,UAAU,EACV,cAAc,GACd,MAAM,aAAa,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Resolves a user type's `social` block: the providers, the resolver, `signUp` and the freshness link demands. */
|
|
1
|
+
/** Resolves a user type's `social` block: the providers, the resolver, `signUp`, `unverifiedHolder` and the freshness link demands. */
|
|
2
2
|
import type { ResolvedSocial } from './resolved-config';
|
|
3
3
|
import type { SocialConfig, SocialProvider } from './social-config';
|
|
4
4
|
/** A provider's name: what a URL, a link record and an event carry. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-social.d.ts","sourceRoot":"","sources":["../../../src/auth/config/resolve-social.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"resolve-social.d.ts","sourceRoot":"","sources":["../../../src/auth/config/resolve-social.ts"],"names":[],"mappings":"AAAA,uIAAuI;AAIvI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEpE,uEAAuE;AACvE,eAAO,MAAM,aAAa,QAA2B,CAAC;AAEtD;;;;GAIG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,YAAY,GAAG,SAAS,EAChC,IAAI,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAC/D,EAAE,EAAE,MAAM,GACR,cAAc,GAAG,IAAI,CAkEvB;AAED,2GAA2G;AAC3G,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAMxE"}
|
|
@@ -7,7 +7,7 @@ import type { PasskeyRelyingParty, PasskeyVerifier } from '../passkeys/verifier'
|
|
|
7
7
|
import type { Sealer } from '../sealing';
|
|
8
8
|
import type { ApiKeysConfig } from './api-keys-config';
|
|
9
9
|
import type { InvitationsConfig } from './invitations-config';
|
|
10
|
-
import type { SocialProfile, SocialProvider, SocialProviderResolver } from './social-config';
|
|
10
|
+
import type { SocialProfile, SocialProvider, SocialProviderResolver, SocialUnverifiedHolder } from './social-config';
|
|
11
11
|
import type { UserSchema } from './user-type';
|
|
12
12
|
/** A user type's `social` block, resolved. */
|
|
13
13
|
export interface ResolvedSocial {
|
|
@@ -17,6 +17,8 @@ export interface ResolvedSocial {
|
|
|
17
17
|
readonly resolveProvider: SocialProviderResolver | null;
|
|
18
18
|
/** `false` when a stranger may not sign up. */
|
|
19
19
|
readonly signUp: false | ((profile: SocialProfile) => unknown);
|
|
20
|
+
/** `'refuse'` when the configuration names none. */
|
|
21
|
+
readonly unverifiedHolder: 'refuse' | 'replace' | SocialUnverifiedHolder;
|
|
20
22
|
readonly freshWithinMs: number;
|
|
21
23
|
}
|
|
22
24
|
/** One user type, with every default applied and every duration in milliseconds. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolved-config.d.ts","sourceRoot":"","sources":["../../../src/auth/config/resolved-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EACX,mBAAmB,EACnB,eAAe,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EACX,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACxD,wCAAwC;IACxC,QAAQ,CAAC,eAAe,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACxD,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,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U,EAAE,MAAM,CAAC;QAC5B,2BAA2B;QAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QACnC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC7C,QAAQ,CAAC,YAAY,EAAE,WAAW,CACjC,iBAAiB,CAAC,cAAc,CAAC,CACjC,GAAG,IAAI,CAAC;QACT,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;QACrD,QAAQ,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC;KAChD,GAAG,IAAI,CAAC;IACT,QAAQ,CAAC,MAAM,EAAE;QAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;QAC7C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;KACzB,CAAC;CACF"}
|
|
@@ -132,6 +132,17 @@ export interface SocialProvider {
|
|
|
132
132
|
* its database). `null` for a name it does not know.
|
|
133
133
|
*/
|
|
134
134
|
export type SocialProviderResolver = (name: string) => Promise<SocialProvider | null>;
|
|
135
|
+
/**
|
|
136
|
+
* Decides what a provider-verified sign-in does with a user who holds the
|
|
137
|
+
* e-mail and never proved it (`SocialConfig.unverifiedHolder`): given the
|
|
138
|
+
* holder and the frozen profile, `'replace'` takes the account over,
|
|
139
|
+
* anything else refuses. Answer from the application's own configuration —
|
|
140
|
+
* which provider it trusts for which address — never from the request.
|
|
141
|
+
*/
|
|
142
|
+
export type SocialUnverifiedHolder = (holder: {
|
|
143
|
+
readonly id: string;
|
|
144
|
+
readonly type: string;
|
|
145
|
+
}, profile: SocialProfile) => 'refuse' | 'replace' | Promise<'refuse' | 'replace'>;
|
|
135
146
|
/** What `SocialConfig` holds whichever way its providers are named. */
|
|
136
147
|
interface SocialOptions {
|
|
137
148
|
/**
|
|
@@ -142,6 +153,26 @@ interface SocialOptions {
|
|
|
142
153
|
* type with no password, or `password.login` naming the e-mail field.
|
|
143
154
|
*/
|
|
144
155
|
readonly signUp?: false | ((profile: SocialProfile) => unknown);
|
|
156
|
+
/**
|
|
157
|
+
* What a sign-in does when the provider vouches for an e-mail that a user
|
|
158
|
+
* holds **without ever having proved it**. `'refuse'` when absent.
|
|
159
|
+
*
|
|
160
|
+
* - `'refuse'`: `EMAIL_NOT_VERIFIED_FOR_LINK`, every time — whoever made
|
|
161
|
+
* the account may hold a credential on it, so nothing is linked.
|
|
162
|
+
* - `'replace'`: the provider's proof is the first proof of the address.
|
|
163
|
+
* The user's social links are deleted, then the e-mail is verified with
|
|
164
|
+
* the ending of every first proof (the password, the avatar, the second
|
|
165
|
+
* factor, the passkeys, the API keys and every session go), then the
|
|
166
|
+
* account is linked and signed in, answered with `replaced: true`.
|
|
167
|
+
* - a function: asked per sign-in, to allow it only for the providers the
|
|
168
|
+
* application trusts for that address.
|
|
169
|
+
*
|
|
170
|
+
* **`'replace'` trusts the provider's `emailVerified`**: a provider that
|
|
171
|
+
* vouches for addresses it does not control could take over any unverified
|
|
172
|
+
* account. A verified user is never replaced, and a provider that does not
|
|
173
|
+
* vouch never replaces.
|
|
174
|
+
*/
|
|
175
|
+
readonly unverifiedHolder?: 'refuse' | 'replace' | SocialUnverifiedHolder;
|
|
145
176
|
/**
|
|
146
177
|
* How recently the session must have proved who it is to `social.link`.
|
|
147
178
|
* `'10m'` when absent.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-config.d.ts","sourceRoot":"","sources":["../../../src/auth/config/social-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IA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45,8 +45,9 @@ import type { Context } from './context';
|
|
|
45
45
|
* account: a link flow, an existing user matched by a verified e-mail, or
|
|
46
46
|
* the account a social sign-up created. Not for an account already linked
|
|
47
47
|
* to that user. Carries `provider`, never the account's id;
|
|
48
|
-
* - `user.socialUnlinked` — by `social.unlink`, when it deleted a link
|
|
49
|
-
*
|
|
48
|
+
* - `user.socialUnlinked` — by `social.unlink`, when it deleted a link, and
|
|
49
|
+
* by `social.complete` replacing an unverified holder
|
|
50
|
+
* (`social.unverifiedHolder`), once per link it deleted. Carries `provider`;
|
|
50
51
|
* - `user.passkeyAdded` — by `passkeys.register`, once the passkey is stored;
|
|
51
52
|
* not by `registrationOptions`, which stores no credential;
|
|
52
53
|
* - `user.passkeyRemoved` — by `passkeys.remove`, when it deleted a passkey,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/auth/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAU,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/auth/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAU,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,MAAM,MAAM,aAAa,GACtB,cAAc,GACd,oBAAoB,GACpB,oBAAoB,GACpB,sBAAsB,GACtB,mBAAmB,GACnB,0BAA0B,GAC1B,2BAA2B,GAC3B,+BAA+B,GAC/B,uBAAuB,GACvB,wBAAwB,GACxB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,qBAAqB,GACrB,mBAAmB,GACnB,qB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BAAgB,aAAa,CAC5B,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,MAAM,GACX,iBAAiB,GAAG,IAAI,CAQ1B;AAED;;;;;;GAMG;AACH,wBAAsB,IAAI,CACzB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE;IAAE,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAChD,UAAU,EAAE,IAAI,EAChB,MAAM,GAAE,WAAgB,GACtB,OAAO,CAAC,IAAI,CAAC,CAqBf"}
|
|
@@ -27,11 +27,16 @@ import type { UserRecord } from './port/types';
|
|
|
27
27
|
* Drops the password, the avatar and the second factor — active or waiting,
|
|
28
28
|
* and its recovery codes with it — in the same write, and revokes every session and
|
|
29
29
|
* spends what the password opened — reset links and second-factor
|
|
30
|
-
* challenges —
|
|
30
|
+
* challenges — and what a session of theirs left waiting — an e-mail change,
|
|
31
|
+
* a link flow, a passkey registration, a step-up — **both before the write
|
|
32
|
+
* and after it**.
|
|
31
33
|
*
|
|
32
34
|
* Before, so an outage there leaves the e-mail unproved and the owner's next
|
|
33
35
|
* code or link runs this again; after, so a sign-in landing in between is
|
|
34
36
|
* ended too. An outage after the write is the one that leaves a session live.
|
|
37
|
+
* `options.revokeFirst: false` skips the sweep before the write (a provider's
|
|
38
|
+
* proof, `social.unverifiedHolder`): a `VERSION_CONFLICT` then revokes
|
|
39
|
+
* nothing. `options.onWritten` is called once the write landed.
|
|
35
40
|
*
|
|
36
41
|
* `user.emailVerified` is sent, then `user.passwordChanged` when a password
|
|
37
42
|
* was dropped, `user.secondFactorDisabled` when an active factor was and
|
|
@@ -39,5 +44,8 @@ import type { UserRecord } from './port/types';
|
|
|
39
44
|
* the rule of `secondFactor.disable` — from a `finally`, so an outage ending
|
|
40
45
|
* the sessions still reports the write, which a retry would not make again.
|
|
41
46
|
*/
|
|
42
|
-
export declare function proveFirstEmail(context: Context, type: ResolvedType, user: UserRecord, where: string
|
|
47
|
+
export declare function proveFirstEmail(context: Context, type: ResolvedType, user: UserRecord, where: string, options?: {
|
|
48
|
+
readonly revokeFirst?: boolean;
|
|
49
|
+
readonly onWritten?: () => void;
|
|
50
|
+
}): Promise<UserRecord>;
|
|
43
51
|
//# sourceMappingURL=first-proof.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-proof.d.ts","sourceRoot":"","sources":["../../src/auth/first-proof.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,WAAW,CAAC;AAIpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C
|
|
1
|
+
{"version":3,"file":"first-proof.d.ts","sourceRoot":"","sources":["../../src/auth/first-proof.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,WAAW,CAAC;AAIpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,eAAe,CACpC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IACR,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B,GACJ,OAAO,CAAC,UAAU,CAAC,CAkErB"}
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ApiKeysConfig, CookieConfig, DevicesConfig, FederatedAmr, FieldsJson, InvitationsConfig, JanusConfig, MagicLinkConfig, MailConfig, MailThrottleConfig, MultiTypeConfig, Normalize, PasskeysConfig, PasswordConfig, PasswordHasher, SecondFactorConfig, SecondFactorThrottleConfig, ServiceKeysConfig, SessionConfig, SignInConfig, SignInThrottleConfig, SingleTypeConfig, SocialConfig, SocialIdentity, SocialProfile, SocialProvider, SocialProviderResolver, SocialStepUpRequest, UserSchema, UserTypeConfig, } from './config';
|
|
1
|
+
export type { ApiKeysConfig, CookieConfig, DevicesConfig, FederatedAmr, FieldsJson, InvitationsConfig, JanusConfig, MagicLinkConfig, MailConfig, MailThrottleConfig, MultiTypeConfig, Normalize, PasskeysConfig, PasswordConfig, PasswordHasher, SecondFactorConfig, SecondFactorThrottleConfig, ServiceKeysConfig, SessionConfig, SignInConfig, SignInThrottleConfig, SingleTypeConfig, SocialConfig, SocialIdentity, SocialProfile, SocialProvider, SocialProviderResolver, SocialStepUpRequest, SocialUnverifiedHolder, UserSchema, UserTypeConfig, } from './config';
|
|
2
2
|
export { DEVICE_COOKIE, type DeviceCookieOptions, deviceCookie, deviceFromCookieHeader, } from './devices/cookie';
|
|
3
3
|
export type { UserEvent, UserEventListener, UserEventType, } from './events';
|
|
4
4
|
export { bunHasher, scryptHasher } from './hashers';
|
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,cAAc,EACd,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd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AAK,EACL,gBAAgB,EAChB,OAAO,EACP,YAAY,EACZ,OAAO,EACP,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,SAAS,EACT,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,OAAO,EACP,SAAS,EACT,QAAQ,EACR,aAAa,EACb,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,EACf,eAAe,EACf,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,UAAU,EACV,QAAQ,EACR,MAAM,EACN,OAAO,EACP,WAAW,EACX,cAAc,EACd,YAAY,GACZ,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,cAAc,EACd,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,UAAU,EACV,cAAc,GACd,MAAM,UAAU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1B,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,SAAS,EACT,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,OAAO,EACP,SAAS,EACT,QAAQ,EACR,aAAa,EACb,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,EACf,eAAe,EACf,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,UAAU,EACV,QAAQ,EACR,MAAM,EACN,OAAO,EACP,WAAW,EACX,cAAc,EACd,YAAY,GACZ,MAAM,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-api.d.ts","sourceRoot":"","sources":["../../src/auth/shared-api.ts"],"names":[],"mappings":"AAAA,yFAAyF;AAGzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIjE,4GAA4G;AAC5G,wBAAgB,aAAa,CAC5B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,WAAW,GAAE,eAAe,GAAG,IAAW;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"shared-api.d.ts","sourceRoot":"","sources":["../../src/auth/shared-api.ts"],"names":[],"mappings":"AAAA,yFAAyF;AAGzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIjE,4GAA4G;AAC5G,wBAAgB,aAAa,CAC5B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,WAAW,GAAE,eAAe,GAAG,IAAW;;;;;;;;;;;;;;;;;;;;4BAckgJ,CAAC;4BAAyC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAAnxE,CAAC;;;;;uBAAob,CAAC;;;2BAAglB,CAAC;yBAAqC,CAAC;wBAA0B,CAAC;2BAA6B,CAAC;0BAAwC,CAAC;0BAAoC,CAAC;0BAA4B,CAAC;;;;;;;2BAAw2B,CAAC;yBAAqC,CAAC;wBAA0B,CAAC;2BAA6B,CAAC;;;;;;6BAAg5H,CAAC;2BAA4B,CAAC;;;;;;;;;;0BAAzjH,CAAC;;;;;;;;;0BAA03D,CAAC;;;;;;;;;;;;;;;;;;;;;;;uBAA/oK,CAAC;6BAA4G,CAAC;;;;;;qBAHrqD,CAAC;uBAA4B,CAAC;wBAGhC,CAAC;;EADP"}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
/** A link flow's callback: the signed-in user who started it links the account. */
|
|
2
2
|
import type { SocialIdentity } from '../config';
|
|
3
3
|
import { type Ending } from './finish';
|
|
4
|
+
import type { Redeemed } from './redeem';
|
|
4
5
|
/**
|
|
5
6
|
* Links the identity to the user the flow belongs to. **No e-mail match is
|
|
6
7
|
* required**: the user is signed in, and chose to link. An account already
|
|
7
8
|
* theirs answers `linked` with no write and no event; one that is another
|
|
8
9
|
* user's is `SOCIAL_ACCOUNT_TAKEN`.
|
|
10
|
+
*
|
|
11
|
+
* A flow started before the user's e-mail was proved is `FLOW_MISMATCH`: a
|
|
12
|
+
* first proof ends what whoever held the account had opened, and a link
|
|
13
|
+
* whose callback was waiting on the provider meanwhile is theirs too. The
|
|
14
|
+
* record read here, after the provider answered, decides.
|
|
9
15
|
*/
|
|
10
|
-
export declare function completeLink(ending: Ending,
|
|
16
|
+
export declare function completeLink(ending: Ending, flow: Pick<Redeemed, 'startedAt'> & {
|
|
17
|
+
readonly userId: string;
|
|
18
|
+
}, provider: string, identity: SocialIdentity): Promise<{
|
|
11
19
|
status: "linked";
|
|
12
20
|
user: import("../context").AnyUser;
|
|
13
21
|
link: import("..").SocialLink;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"complete-link.d.ts","sourceRoot":"","sources":["../../../src/auth/social/complete-link.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAGnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAa,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"complete-link.d.ts","sourceRoot":"","sources":["../../../src/auth/social/complete-link.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAGnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAa,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CACjC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC/D,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,cAAc;;;;;;GA+BxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"complete.d.ts","sourceRoot":"","sources":["../../../src/auth/social/complete.ts"],"names":[],"mappings":"AAAA,8DAA8D;
|
|
1
|
+
{"version":3,"file":"complete.d.ts","sourceRoot":"","sources":["../../../src/auth/social/complete.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAG9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAW9C;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CACjC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,KAAK,EAAE;IACN,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EACd;QAAE,QAAQ,CAAC,IAAI,EAAE;YAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,GAC1C,IAAI,GACJ,SAAS,CAAC;CACb,EACD,OAAO,EAAE,aAAa,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DlC"}
|
|
@@ -36,12 +36,15 @@ export declare function finishSocial(ending: Ending, record: UserRecord, outcome
|
|
|
36
36
|
readonly provider: string;
|
|
37
37
|
readonly created: boolean;
|
|
38
38
|
readonly linked: boolean;
|
|
39
|
+
/** Whether an unverified holder of the e-mail was taken over. */
|
|
40
|
+
readonly replaced: boolean;
|
|
39
41
|
}): Promise<{
|
|
40
42
|
returnTo: string | null;
|
|
41
43
|
stepUp: SocialStepUpProof | null;
|
|
42
44
|
provider: string;
|
|
43
45
|
created: boolean;
|
|
44
46
|
linked: boolean;
|
|
47
|
+
replaced: boolean;
|
|
45
48
|
status: "signedIn";
|
|
46
49
|
user: import("../context").AnyUser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,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC3B;;;cALmB,MAAM;aACP,OAAO;YACR,OAAO;cAEL,OAAO;;;;;;;;;;;;;;;;;GAsB3B"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
/** A user matched by the identity's e-mail: linked, and signed in, when both sides vouch for it. */
|
|
2
|
-
import type
|
|
2
|
+
import { type SocialIdentity } from '../config';
|
|
3
3
|
import type { UserRecord } from '../port/types';
|
|
4
4
|
import { type Ending } from './finish';
|
|
5
5
|
/**
|
|
6
6
|
* Links a user matched by e-mail, and signs them in — **only when the
|
|
7
7
|
* provider and the local account both vouch for the address**; either
|
|
8
8
|
* unverified is `EMAIL_NOT_VERIFIED_FOR_LINK` and nothing is linked.
|
|
9
|
+
*
|
|
10
|
+
* One exception, which the type opts into (`social.unverifiedHolder`): the
|
|
11
|
+
* provider vouches, the account never proved the address, and the policy
|
|
12
|
+
* answers `'replace'`. The provider's proof is then the first proof of the
|
|
13
|
+
* address (`./replace-holder`), and the answer says `replaced: true`. The
|
|
14
|
+
* record read by id decides, not the one handed in: it must still be
|
|
15
|
+
* unproved and still hold the provider's e-mail, and an inactive user is
|
|
16
|
+
* refused before anything of theirs is dropped.
|
|
9
17
|
*/
|
|
10
18
|
export declare function linkHolder(ending: Ending, holder: UserRecord, provider: string, identity: SocialIdentity): Promise<{
|
|
11
19
|
returnTo: string | null;
|
|
@@ -13,6 +21,7 @@ export declare function linkHolder(ending: Ending, holder: UserRecord, provider:
|
|
|
13
21
|
provider: string;
|
|
14
22
|
created: boolean;
|
|
15
23
|
linked: boolean;
|
|
24
|
+
replaced: boolean;
|
|
16
25
|
status: "signedIn";
|
|
17
26
|
user: import("../context").AnyUser;
|
|
18
27
|
session: import("..").Session;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-holder.d.ts","sourceRoot":"","sources":["../../../src/auth/social/link-holder.ts"],"names":[],"mappings":"AAAA,oGAAoG;AAGpG,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"link-holder.d.ts","sourceRoot":"","sources":["../../../src/auth/social/link-holder.ts"],"names":[],"mappings":"AAAA,oGAAoG;AAGpG,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAa,KAAK,MAAM,EAAgB,MAAM,UAAU,CAAC;AAGhE;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAC/B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;GAiDxB"}
|
|
@@ -17,6 +17,8 @@ export interface Redeemed {
|
|
|
17
17
|
readonly values: FlowValues;
|
|
18
18
|
/** For a link flow, the user it belongs to; `null` for a sign-in. */
|
|
19
19
|
readonly userId: string | null;
|
|
20
|
+
/** When the flow was started: its token's `createdAt`. */
|
|
21
|
+
readonly startedAt: Date;
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Parses the cookie and checks the callback's `state` — both before the token
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redeem.d.ts","sourceRoot":"","sources":["../../../src/auth/social/redeem.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAK1C,OAAO,EAGN,KAAK,QAAQ,EACb,KAAK,UAAU,EAEf,MAAM,eAAe,CAAC;AAGvB,uFAAuF;AACvF,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC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QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,GAAG,IAAI,CAAC;CACpE,EACD,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,QAAQ,CAAC,CA0EnB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Taking over a user who holds an e-mail and never proved it, on the word of
|
|
3
|
+
* a provider that vouches for the address (`social.unverifiedHolder`).
|
|
4
|
+
*/
|
|
5
|
+
import type { SocialIdentity } from '../config';
|
|
6
|
+
import type { UserRecord } from '../port/types';
|
|
7
|
+
import type { Ending } from './finish';
|
|
8
|
+
/**
|
|
9
|
+
* Whether the type's policy lets this sign-in replace `holder`: `'replace'`,
|
|
10
|
+
* or a function that answers it. Anything else it answers refuses; what it
|
|
11
|
+
* throws propagates, before anything was touched.
|
|
12
|
+
*/
|
|
13
|
+
export declare function allowsReplacing(ending: Ending, holder: UserRecord, provider: string, identity: SocialIdentity): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Makes the provider's proof the first proof of `record`'s e-mail, and
|
|
16
|
+
* answers the proved record: nothing whoever made the account could hold
|
|
17
|
+
* outlives it.
|
|
18
|
+
*
|
|
19
|
+
* `proveFirstEmail` goes first, under the version read: the password, the
|
|
20
|
+
* avatar, the second factor, the passkeys, the API keys and every session,
|
|
21
|
+
* and the tokens a session of theirs left waiting, a link flow among them.
|
|
22
|
+
* Only once its write landed are the social links dropped — a first proof by
|
|
23
|
+
* code or link has none to drop, since it cannot tell whose they are; here
|
|
24
|
+
* the account's owner is the one arriving, with an account that is not
|
|
25
|
+
* linked yet, so every link is somebody else's. A `VERSION_CONFLICT` (the
|
|
26
|
+
* owner proved the address, or changed it, since the read) wrote nothing and
|
|
27
|
+
* revokes and drops nothing: their links, sessions and keys stand. A link
|
|
28
|
+
* flow already at the provider when the proof lands is refused by
|
|
29
|
+
* `completeLink`, which compares the proof with the flow's start.
|
|
30
|
+
*
|
|
31
|
+
* An outage before the proof leaves the e-mail unproved, so the next sign-in
|
|
32
|
+
* runs this again. One after its write leaves the account proved with no
|
|
33
|
+
* credential: the next sign-in links it as a verified holder's, and answers
|
|
34
|
+
* `replaced: false`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function replaceHolder(ending: Ending, record: UserRecord): Promise<UserRecord>;
|
|
37
|
+
//# sourceMappingURL=replace-holder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace-holder.d.ts","sourceRoot":"","sources":["../../../src/auth/social/replace-holder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;GAIG;AACH,wBAAsB,eAAe,CACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,cAAc,GACtB,OAAO,CAAC,OAAO,CAAC,CAQlB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,aAAa,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,UAAU,GAChB,OAAO,CAAC,UAAU,CAAC,CAiBrB"}
|
|
@@ -12,7 +12,9 @@ import { type Ending } from './finish';
|
|
|
12
12
|
* gone is deleted and the account treated as new.
|
|
13
13
|
* 2. Otherwise a user of the type holding the identity's e-mail is linked and
|
|
14
14
|
* signed in — **only when the provider and the local account both vouch for
|
|
15
|
-
* the address**; either unverified is `EMAIL_NOT_VERIFIED_FOR_LINK
|
|
15
|
+
* the address**; either unverified is `EMAIL_NOT_VERIFIED_FOR_LINK`,
|
|
16
|
+
* unless the type's `social.unverifiedHolder` lets a provider that vouches
|
|
17
|
+
* replace a user who never proved the address.
|
|
16
18
|
* 3. Otherwise nobody is known: `sign-up.ts`.
|
|
17
19
|
*/
|
|
18
20
|
export declare function signInAccount(ending: Ending, provider: string, identity: SocialIdentity): Promise<{
|
|
@@ -21,6 +23,7 @@ export declare function signInAccount(ending: Ending, provider: string, identity
|
|
|
21
23
|
provider: string;
|
|
22
24
|
created: boolean;
|
|
23
25
|
linked: boolean;
|
|
26
|
+
replaced: boolean;
|
|
24
27
|
status: "signedIn";
|
|
25
28
|
user: import("../context").AnyUser;
|
|
26
29
|
session: import("..").Session;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-in.d.ts","sourceRoot":"","sources":["../../../src/auth/social/sign-in.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,UAAU,CAAC;AAIrD
|
|
1
|
+
{"version":3,"file":"sign-in.d.ts","sourceRoot":"","sources":["../../../src/auth/social/sign-in.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,UAAU,CAAC;AAIrD;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAClC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;GA2BxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up.d.ts","sourceRoot":"","sources":["../../../src/auth/social/sign-up.ts"],"names":[],"mappings":"AAAA,iGAAiG;AAQjG,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAOhE,OAAO,EAAa,KAAK,MAAM,EAAgB,MAAM,UAAU,CAAC;AAGhE;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC9B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,cAAc
|
|
1
|
+
{"version":3,"file":"sign-up.d.ts","sourceRoot":"","sources":["../../../src/auth/social/sign-up.ts"],"names":[],"mappings":"AAAA,iGAAiG;AAQjG,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAOhE,OAAO,EAAa,KAAK,MAAM,EAAgB,MAAM,UAAU,CAAC;AAGhE;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC9B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;GA8DxB"}
|