@nxgt/janus 0.20.0 → 0.22.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 +112 -12
- package/dist/auth/context/index.d.ts +1 -1
- package/dist/auth/context/index.d.ts.map +1 -1
- package/dist/auth/context/user.d.ts +7 -0
- package/dist/auth/context/user.d.ts.map +1 -1
- package/dist/auth/email-flows/prove-first.d.ts +23 -0
- package/dist/auth/email-flows/prove-first.d.ts.map +1 -0
- package/dist/auth/email-flows/verify-email.d.ts +6 -2
- package/dist/auth/email-flows/verify-email.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/proven-sign-in.d.ts.map +1 -1
- package/dist/auth/types/email-flows.d.ts +43 -0
- package/dist/auth/types/email-flows.d.ts.map +1 -1
- package/dist/auth/types/find-by-email.d.ts +31 -0
- package/dist/auth/types/find-by-email.d.ts.map +1 -0
- package/dist/auth/types/index.d.ts +2 -1
- package/dist/auth/types/index.d.ts.map +1 -1
- package/dist/auth/types/janus.d.ts +2 -1
- package/dist/auth/types/janus.d.ts.map +1 -1
- package/dist/auth/users/any-type-api.d.ts +2 -2
- package/dist/auth/users/any-type-api.d.ts.map +1 -1
- package/dist/auth/users/find-by-email.d.ts +11 -0
- package/dist/auth/users/find-by-email.d.ts.map +1 -0
- package/dist/auth/users/type-api.d.ts +1 -1
- package/dist/auth/users/type-api.d.ts.map +1 -1
- package/dist/index.js +74 -41
- package/dist/index.js.map +10 -8
- package/docs/README.md +2 -2
- package/docs/guide/email-flows.md +60 -1
- package/docs/guide/errors.md +3 -3
- package/docs/guide/events.md +4 -4
- package/docs/guide/magic-link.md +7 -2
- package/docs/guide/sessions.md +37 -6
- package/docs/guide/users.md +70 -0
- package/docs/guide/vocabulary.md +1 -1
- package/docs/roadmap.md +16 -15
- package/docs/troubleshooting.md +56 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -321,6 +321,7 @@ await auth.authenticate(request); // { user, session, token, re
|
|
|
321
321
|
await auth.signOut(request);
|
|
322
322
|
await auth.verifyEmail.send(user); // { token, email, expiresAt } — sending it is yours
|
|
323
323
|
await auth.verifyEmail.confirm(token);
|
|
324
|
+
await auth.verifyEmail.proveFirst(user); // privileged: FirstProof — { user, proved }; drops a squatter's password and factor
|
|
324
325
|
await auth.resetPassword.request(email); // … | null
|
|
325
326
|
await auth.resetPassword.confirm(token, newPassword);
|
|
326
327
|
await auth.signInCode.request(email); // { code, challenge, email, expiresAt, user } | null
|
|
@@ -328,6 +329,7 @@ await auth.signInCode.confirm(challenge, code); // { status: 'signedIn', user
|
|
|
328
329
|
await auth.magicLink.request(email); // { token, email, expiresAt, user } | null
|
|
329
330
|
await auth.magicLink.confirm(token); // { status: 'signedIn', user, session, token }
|
|
330
331
|
await auth.magicLink.prepare(email); // counted, nobody looked up: { send() } — and signInCode, resetPassword
|
|
332
|
+
await auth.findByEmail(email); // User | null — server-side only, counts nothing; every type with an e-mail
|
|
331
333
|
await auth.signInProven(user.id); // privileged: after a proof YOUR server verified — { status: 'signedIn', … }
|
|
332
334
|
await auth.stepUp.request(user); // { via: 'email', code, challenge, email, expiresAt, user }
|
|
333
335
|
await auth.stepUp.confirm(request, challenge, code); // the request's session, authenticatedAt: now
|
|
@@ -376,14 +378,15 @@ else reaches the store and is asynchronous.
|
|
|
376
378
|
compile error on `login`, and the message lists the fields you could have
|
|
377
379
|
meant. It is normalised with `'lowercaseTrim'` unless you say otherwise.
|
|
378
380
|
- **`email`** defaults to the field named `email`. A type without one has no
|
|
379
|
-
`verifyEmail`, no `resetPassword`, no `signInCode` and
|
|
380
|
-
are absent from its type, not failing at run time.
|
|
381
|
-
back to `false`.
|
|
381
|
+
`findByEmail`, no `verifyEmail`, no `resetPassword`, no `signInCode` and
|
|
382
|
+
no `magicLink` — they are absent from its type, not failing at run time.
|
|
383
|
+
Changing the e-mail sets `emailVerified` back to `false`.
|
|
382
384
|
- **Per type**: `create`, `find` (or `null`), `findMany`, `get` (or
|
|
383
385
|
`NOT_FOUND`), `list`, `update(user, patch)` — merged over the stored fields,
|
|
384
386
|
then validated whole — `setActive`, `delete` and `signInProven` (below);
|
|
385
|
-
with
|
|
386
|
-
`
|
|
387
|
+
with an e-mail, `findByEmail` (below), password or not; with a password,
|
|
388
|
+
`signUp`, `signIn`, `findByLogin`, `setPassword` and `changePassword`.
|
|
389
|
+
Every write but `delete` takes an optional `ifVersion`.
|
|
387
390
|
- **`findMany(ids)`** answers the type's users **in the order the ids were
|
|
388
391
|
given**, each once — a repeated id at its first place. An id `find` answers
|
|
389
392
|
`null` for — malformed, unknown, another type's — is **left out**, so match
|
|
@@ -781,6 +784,7 @@ has a route for each flow, with Hono.
|
|
|
781
784
|
const invitation = await invitations.redeem(body.invitationToken); // yours: one use, expiring, hashed at rest
|
|
782
785
|
if (invitation === null) return new Response(null, { status: 404 });
|
|
783
786
|
|
|
787
|
+
// The invitation reached the inbox: call verifyEmail.proveFirst before this — see below.
|
|
784
788
|
const result = await auth.signInProven(invitation.userId, { device: deviceCookie ?? null });
|
|
785
789
|
if (result.status === 'secondFactor') return askForCode(result.challenge); // switch on status, as after signIn
|
|
786
790
|
// result: { status: 'signedIn', user, session, token, newDevice, deviceToken }
|
|
@@ -808,11 +812,82 @@ with no password, code or link. Every user type has it.
|
|
|
808
812
|
`magicLink.request` on the invitee's address cannot make it answer 429 —
|
|
809
813
|
and links or codes already in the person's inbox still work. It proves
|
|
810
814
|
no e-mail either: `emailVerified` stays as it was, and nothing is dropped
|
|
811
|
-
as on a first proof by link.
|
|
815
|
+
as on a first proof by link — call `verifyEmail.proveFirst` before it
|
|
816
|
+
when your proof reached the inbox, as an invitation does.
|
|
812
817
|
|
|
813
818
|
[Sessions](docs/guide/sessions.md#signing-in-on-your-own-proof--signinproven)
|
|
814
819
|
has the invitation route in full, and what to verify before the call.
|
|
815
820
|
|
|
821
|
+
### Finding a user by e-mail — `findByEmail`
|
|
822
|
+
|
|
823
|
+
```ts
|
|
824
|
+
// Accepting an invitation sent to an address: the account may already exist, on a type with no password.
|
|
825
|
+
const invitation = await invitations.redeem(body.invitationToken); // yours: verified first
|
|
826
|
+
if (invitation === null) return new Response(null, { status: 404 });
|
|
827
|
+
|
|
828
|
+
const member =
|
|
829
|
+
(await auth.member.findByEmail(invitation.email)) ?? // User | null — counts nothing, sends nothing
|
|
830
|
+
(await auth.member.create({ email: invitation.email, name: '' }));
|
|
831
|
+
await auth.member.verifyEmail.proveFirst(member); // the invitation reached the inbox: before signInProven
|
|
832
|
+
const result = await auth.member.signInProven(member, { device: deviceCookie ?? null });
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
The user of this type holding the address, or `null` — on **every type with
|
|
836
|
+
an e-mail, password or not**. A type with no password has no `findByLogin`,
|
|
837
|
+
and needs no password login to be found: declaring one would open the
|
|
838
|
+
password and reset flows on it.
|
|
839
|
+
|
|
840
|
+
- **Normalised as the e-mail flows normalise**: trimmed and lowercased,
|
|
841
|
+
whatever the type's login. A type that signs in with a username is still
|
|
842
|
+
found by its e-mail, and a username that only looks like an address is
|
|
843
|
+
nobody's — the same holder `magicLink.request` and `resetPassword.request`
|
|
844
|
+
would find.
|
|
845
|
+
- **Read-only**: counts nothing in the mail or the sign-in throttle,
|
|
846
|
+
issues nothing, writes nothing. An inactive user is answered, as by
|
|
847
|
+
`find` — `signInProven` then refuses them with `USER_INACTIVE`.
|
|
848
|
+
- **A value that is no address is nobody's**: not a string, empty once
|
|
849
|
+
trimmed, or holding a NUL or a lone surrogate answers `null` without
|
|
850
|
+
asking the store, as `find` answers a malformed id. An outage is
|
|
851
|
+
`STORE_FAILED`, never `null`.
|
|
852
|
+
- **Server-side only**: it tells whether an account exists. See *Traps*.
|
|
853
|
+
|
|
854
|
+
### Proving an e-mail on your own proof — `verifyEmail.proveFirst`
|
|
855
|
+
|
|
856
|
+
```ts
|
|
857
|
+
// Accepting an invitation: the token YOUR server mailed to the address proves the inbox.
|
|
858
|
+
const user = (await auth.findByEmail(invitation.email)) ?? (await auth.create({ email: invitation.email, name }));
|
|
859
|
+
const { proved } = await auth.verifyEmail.proveFirst(user); // 1. first: drops a squatter's password, factor, sessions
|
|
860
|
+
await auth.setPassword(user, body.password); // 2. then the invitee's own password, if the type has one
|
|
861
|
+
const result = await auth.signInProven(user); // 3. last: proveFirst revokes every session
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
Answers `FirstProof<User>` — `{ user, proved }`, exported. Applies **the
|
|
865
|
+
first proof of an e-mail** that `magicLink.confirm` and
|
|
866
|
+
`signInCode.confirm` apply, when the proof is the application's — an
|
|
867
|
+
invitation token it mailed to the address and the person followed. On every
|
|
868
|
+
type with an e-mail; `signInProven` alone proves nothing.
|
|
869
|
+
|
|
870
|
+
- **On an e-mail never proved, in one write**: marks it verified and drops
|
|
871
|
+
the password and the second factor — active or waiting, with its recovery
|
|
872
|
+
codes. It revokes every session and spends the reset links and
|
|
873
|
+
second-factor challenges, before the write and after it, and sends
|
|
874
|
+
`user.emailVerified`, then `user.passwordChanged` when a password was
|
|
875
|
+
dropped and `user.secondFactorDisabled` when an active factor was.
|
|
876
|
+
Answers `{ user, proved: true }`.
|
|
877
|
+
- **On an e-mail already proved, nothing**: no write, no event, no session
|
|
878
|
+
revoked — `{ user, proved: false }`.
|
|
879
|
+
- **Sends nothing, counts nothing**: no e-mail, no token, no mail-throttle
|
|
880
|
+
or sign-in-throttle count.
|
|
881
|
+
- **Refused as `signInProven` refuses**: an inactive user is
|
|
882
|
+
`USER_INACTIVE`; a malformed id, an unknown one or one of another type is
|
|
883
|
+
`NOT_FOUND`. A user written between its read and its write is
|
|
884
|
+
`VERSION_CONFLICT`, with nothing proved; an outage is `STORE_FAILED`.
|
|
885
|
+
- **Privileged, and the order matters**: see *Traps*.
|
|
886
|
+
|
|
887
|
+
[E-mail flows](docs/guide/email-flows.md#proving-an-e-mail-on-your-own-proof--provefirst)
|
|
888
|
+
has the details; [sessions](docs/guide/sessions.md#accepting-an-invitation)
|
|
889
|
+
has the invitation route in full.
|
|
890
|
+
|
|
816
891
|
### Step-up — `stepUp` and `assertFresh`
|
|
817
892
|
|
|
818
893
|
```ts
|
|
@@ -925,12 +1000,12 @@ await auth.signUp({ email, password }); // the listener has the event before thi
|
|
|
925
1000
|
| `type` | Sent by |
|
|
926
1001
|
| --- | --- |
|
|
927
1002
|
| `user.created` | `create`, `signUp` |
|
|
928
|
-
| `user.emailVerified` | `verifyEmail.confirm`; `resetPassword.confirm`, `magicLink.confirm` and `signInCode.confirm`, whose link or code proves the e-mail too — never for an e-mail already verified |
|
|
1003
|
+
| `user.emailVerified` | `verifyEmail.confirm` and `verifyEmail.proveFirst`; `resetPassword.confirm`, `magicLink.confirm` and `signInCode.confirm`, whose link or code proves the e-mail too — never for an e-mail already verified |
|
|
929
1004
|
| `user.passwordReset` | `resetPassword.confirm` |
|
|
930
|
-
| `user.passwordChanged` | `changePassword`, `setPassword`; `signInCode.confirm` and `
|
|
1005
|
+
| `user.passwordChanged` | `changePassword`, `setPassword`; `signInCode.confirm`, `magicLink.confirm` and `verifyEmail.proveFirst` when their first proof of the e-mail dropped a password — never a reset, which is `user.passwordReset` alone |
|
|
931
1006
|
| `user.emailChanged` | `update`, when it changed the e-mail — carrying `formerEmail`, the address before (`null` for none) |
|
|
932
1007
|
| `user.secondFactorEnabled` | `secondFactor.activate`, once the factor is active — not `enroll`, which leaves it waiting |
|
|
933
|
-
| `user.secondFactorDisabled` | `secondFactor.disable`, when it removed an active factor; `signInCode.confirm` and `
|
|
1008
|
+
| `user.secondFactorDisabled` | `secondFactor.disable`, when it removed an active factor; `signInCode.confirm`, `magicLink.confirm` and `verifyEmail.proveFirst` 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 |
|
|
934
1009
|
| `user.recoveryCodesRegenerated` | `secondFactor.regenerateRecoveryCodes` — not `activate`, whose codes come with `user.secondFactorEnabled` |
|
|
935
1010
|
| `user.recoveryCodeUsed` | `secondFactor.recover`, once the recovery code is spent: a sign-in without the user's phone |
|
|
936
1011
|
| `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 |
|
|
@@ -1225,6 +1300,31 @@ id from that proof's record. For an invitation, it replaces
|
|
|
1225
1300
|
five anonymous requests for the invitee's address would make the
|
|
1226
1301
|
acceptance answer 429.
|
|
1227
1302
|
|
|
1303
|
+
**Call `verifyEmail.proveFirst` first: it drops the password and revokes
|
|
1304
|
+
every session.** On an e-mail never proved, it does what a first sign-in by
|
|
1305
|
+
link does, so a password set before it is erased — the invitee's own,
|
|
1306
|
+
chosen on your acceptance form, included — and a session opened before it
|
|
1307
|
+
is revoked. Accept an invitation in this order: `findByEmail` (or
|
|
1308
|
+
`create`), then `verifyEmail.proveFirst`, then `setPassword` on a type with
|
|
1309
|
+
a password, then `signInProven`. Called after `setPassword`, the person
|
|
1310
|
+
signs in once and then finds `signIn` answering `CREDENTIALS_INVALID`
|
|
1311
|
+
(`reason: 'noPassword'`). **It is privileged, like `signInProven`**: it
|
|
1312
|
+
checks no credential, so call it only right after your server verified
|
|
1313
|
+
its own proof of the inbox — an invitation token it mailed to that
|
|
1314
|
+
address — on the user that proof names, whose e-mail is the address the
|
|
1315
|
+
proof reached; never with an id a request supplied, or anybody can wipe
|
|
1316
|
+
anybody's password and second factor and sign them out.
|
|
1317
|
+
|
|
1318
|
+
**`findByEmail` is an account-existence oracle — never expose it to an
|
|
1319
|
+
anonymous client.** It answers whether somebody of the type holds an
|
|
1320
|
+
address, at once, with no throttle: a route that calls it on an address a
|
|
1321
|
+
visitor typed tells anybody who has an account. Call it on the server, after
|
|
1322
|
+
a proof of your own — an invitation token your server issued and just
|
|
1323
|
+
verified — with the address read from that proof's record, never from the
|
|
1324
|
+
request. A visitor who types an address goes through `magicLink.request` or
|
|
1325
|
+
`signInCode.request` instead: throttled per address, and answered with the
|
|
1326
|
+
same page whether they issued or not.
|
|
1327
|
+
|
|
1228
1328
|
**Confirm a sign-in link from a `POST`, never from its `GET`.** Mail
|
|
1229
1329
|
scanners open every link in an e-mail before the user does: a route that
|
|
1230
1330
|
calls `magicLink.confirm` on the link's `GET` spends it for the scanner, and
|
|
@@ -1517,7 +1617,7 @@ that sends one, since it is awaited: queue the event and return.
|
|
|
1517
1617
|
|
|
1518
1618
|
## Type safety, counted
|
|
1519
1619
|
|
|
1520
|
-
**One hundred and sixty-
|
|
1620
|
+
**One hundred and sixty-nine plausible mistakes, one hundred and sixty-nine refused at compile time — and
|
|
1521
1621
|
two gaps, named.**
|
|
1522
1622
|
|
|
1523
1623
|
The lists are typechecked and never run, with one `@ts-expect-error` per
|
|
@@ -1525,10 +1625,10 @@ mistake beside the shapes that must keep compiling. One is a single file:
|
|
|
1525
1625
|
`test/types/refusals.ts` (fifteen, on the shared vocabulary). The other three
|
|
1526
1626
|
are folders with one file per behaviour: `test/types/port/` (twenty-five, on
|
|
1527
1627
|
the identity stores' port, from the point of view of the person implementing
|
|
1528
|
-
it), `test/types/auth/` (
|
|
1628
|
+
it), `test/types/auth/` (eighty-one, on `janus()`, from the point of view of
|
|
1529
1629
|
the application — twelve of them on the second factor, three on sign-in codes,
|
|
1530
1630
|
five on user events, four on step-ups, six on the sign-in throttle, five on the mail throttle, four on
|
|
1531
|
-
sign-in links, six on devices, two on `findMany`, five on requests in two steps, three on signing in on the application's proof) and `test/types/permissions/` (forty-eight, on the
|
|
1631
|
+
sign-in links, six on devices, two 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) and `test/types/permissions/` (forty-eight, on the
|
|
1532
1632
|
permission model and the questions asked of it). The rule comes from
|
|
1533
1633
|
`nxgt-data`, and so does the reason to distrust the claim without the files:
|
|
1534
1634
|
when it was last measured on `@nxgt/mongo`, *seven of twelve plausible
|
|
@@ -12,6 +12,6 @@ export { type Context, createContext } from './create-context';
|
|
|
12
12
|
export { emailOf, holderOfEmail, loginsOf } from './logins';
|
|
13
13
|
export { checkPassword, passwordMatches, passwordRule, rehashed, requireHasher, } from './password';
|
|
14
14
|
export { findRecord, getRecord, writeUser } from './records';
|
|
15
|
-
export { type AnyUser, idOf, toUser } from './user';
|
|
15
|
+
export { type AnyUser, idOf, refId, toUser } from './user';
|
|
16
16
|
export { validateFields } from './validate-fields';
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/context/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EACN,aAAa,EACb,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,aAAa,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,KAAK,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/context/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EACN,aAAa,EACb,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,aAAa,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,KAAK,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -11,4 +11,11 @@ export type AnyUser = User<string, Record<string, unknown>>;
|
|
|
11
11
|
export declare function toUser(record: UserRecord): AnyUser;
|
|
12
12
|
/** The id a {@link UserRef} names. */
|
|
13
13
|
export declare const idOf: (user: UserRef) => string;
|
|
14
|
+
/**
|
|
15
|
+
* The id a JavaScript caller's reference names, or `''` — malformed, and
|
|
16
|
+
* so `NOT_FOUND` without reaching the store — for anything that names none:
|
|
17
|
+
* what the privileged calls read, `signInProven` and
|
|
18
|
+
* `verifyEmail.proveFirst`, which must never mistake a bad value for a user.
|
|
19
|
+
*/
|
|
20
|
+
export declare function refId(user: UserRef): string;
|
|
14
21
|
//# sourceMappingURL=user.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/auth/context/user.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE9C,kEAAkE;AAClE,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAalD;AAED,sCAAsC;AACtC,eAAO,MAAM,IAAI,GAAI,MAAM,OAAO,KAAG,MACK,CAAC"}
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/auth/context/user.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE9C,kEAAkE;AAClE,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAalD;AAED,sCAAsC;AACtC,eAAO,MAAM,IAAI,GAAI,MAAM,OAAO,KAAG,MACK,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAK3C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proving an e-mail on the application's own proof of the inbox — an
|
|
3
|
+
* invitation token it issued to the address — with the ending a first
|
|
4
|
+
* sign-in by link or code gives an e-mail never proved (`../first-proof`).
|
|
5
|
+
*/
|
|
6
|
+
import type { At } from '../at';
|
|
7
|
+
import type { ResolvedType } from '../config';
|
|
8
|
+
import { type AnyUser, type Context } from '../context';
|
|
9
|
+
import type { VerifyEmailApi } from '../types';
|
|
10
|
+
/**
|
|
11
|
+
* `verifyEmail.proveFirst` for one user type: the user read by id —
|
|
12
|
+
* `NOT_FOUND` for nobody, as `signInProven` — refused when inactive, then,
|
|
13
|
+
* when the e-mail was never proved, `proveFirstEmail` exactly as
|
|
14
|
+
* `magicLink.confirm` and `signInCode.confirm` run it, decided the same way:
|
|
15
|
+
* on the record read, `emailVerifiedAt === null`. An e-mail already proved
|
|
16
|
+
* is answered as it is, with nothing written.
|
|
17
|
+
*
|
|
18
|
+
* No throttle is counted and no count restarted, no e-mail sent and no
|
|
19
|
+
* token issued; the only tokens spent are the ones `proveFirstEmail`
|
|
20
|
+
* spends, what the password opened.
|
|
21
|
+
*/
|
|
22
|
+
export declare function proveFirstFlow(context: Context, type: ResolvedType, at: At): VerifyEmailApi<AnyUser>['verifyEmail']['proveFirst'];
|
|
23
|
+
//# sourceMappingURL=prove-first.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prove-first.d.ts","sourceRoot":"","sources":["../../../src/auth/email-flows/prove-first.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,OAAO,EAIZ,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC7B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,YAAY,EAClB,EAAE,EAAE,EAAE,GACJ,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,CAgBtD"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Verifying an e-mail: send a token to it, then redeem the token to mark the
|
|
3
|
-
* address verified
|
|
3
|
+
* address verified — or prove it on the application's own proof
|
|
4
|
+
* (`prove-first.ts`).
|
|
4
5
|
*/
|
|
5
6
|
import type { At } from '../at';
|
|
6
7
|
import type { ResolvedType } from '../config';
|
|
7
8
|
import { type AnyUser, type Context } from '../context';
|
|
8
9
|
import type { VerifyEmailApi } from '../types';
|
|
9
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* `verifyEmail` of one user type: `send` a token to its e-mail, then
|
|
12
|
+
* `confirm` it; or `proveFirst`, on the application's own proof.
|
|
13
|
+
*/
|
|
10
14
|
export declare function verifyEmailFlows(context: Context, type: ResolvedType, at: At): VerifyEmailApi<AnyUser>['verifyEmail'];
|
|
11
15
|
//# sourceMappingURL=verify-email.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-email.d.ts","sourceRoot":"","sources":["../../../src/auth/email-flows/verify-email.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"verify-email.d.ts","sourceRoot":"","sources":["../../../src/auth/email-flows/verify-email.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,OAAO,EAKZ,MAAM,YAAY,CAAC;AAIpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI/C;;;GAGG;AACH,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,YAAY,EAClB,EAAE,EAAE,EAAE,GACJ,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CA0CxC"}
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ export type { JanusStores, Json, JsonObject, PasswordRecord, SecondFactorRecord,
|
|
|
8
8
|
export type { SealingKey } from './sealing';
|
|
9
9
|
export { assertFresh } from './sessions/fresh';
|
|
10
10
|
export type { StandardSchemaV1 } from './standard-schema';
|
|
11
|
-
export type { Authenticated, Checked, EmailOf, HeaderRecord, IssuedCode, IssuedToken, Janus, LoginOf, MagicLinkApi, PasswordApi, PreparedCode, PreparedRequest, ProvenSignInApi, RecoveredSignIn, RecoveryCodesIssued, RequestLike, RequiredStringKeys, ResetPasswordApi, SecondFactorApi, SecondFactorEnrolment, SecondFactorRequired, Session, SharedApi, SignedIn, SignInCodeApi, SignInOptions, SignInResult, StepUpApi, StepUpByApp, StepUpByEmail, TypeApi, TypesOf, User, UserBase, UserOf, UserRef, UserTypeApi, VerifyEmailApi, WriteOptions, } from './types';
|
|
11
|
+
export type { Authenticated, Checked, EmailOf, FindByEmailApi, FirstProof, HeaderRecord, IssuedCode, IssuedToken, Janus, LoginOf, MagicLinkApi, PasswordApi, PreparedCode, PreparedRequest, ProvenSignInApi, RecoveredSignIn, RecoveryCodesIssued, RequestLike, RequiredStringKeys, ResetPasswordApi, SecondFactorApi, SecondFactorEnrolment, SecondFactorRequired, Session, SharedApi, SignedIn, SignInCodeApi, SignInOptions, SignInResult, StepUpApi, StepUpByApp, StepUpByEmail, TypeApi, TypesOf, User, UserBase, UserOf, UserRef, UserTypeApi, VerifyEmailApi, WriteOptions, } from './types';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
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,YAAY,EACZ,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,cAAc,GACd,MAAM,UAAU,CAAC;AAClB,YAAY,EACX,SAAS,EACT,iBAAiB,EACjB,aAAa,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EACX,WAAW,EACX,IAAI,EACJ,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,UAAU,EACV,eAAe,EACf,SAAS,EACT,UAAU,EACV,SAAS,GACT,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,YAAY,EACX,aAAa,EACb,OAAO,EACP,OAAO,EACP,YAAY,EACZ,UAAU,EACV,WAAW,EACX,KAAK,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,eAAe,EACf,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,OAAO,EACP,SAAS,EACT,QAAQ,EACR,aAAa,EACb,aAAa,EACb,YAAY,EACZ,SAAS,EACT,WAAW,EACX,aAAa,EACb,OAAO,EACP,OAAO,EACP,IAAI,EACJ,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,YAAY,EACZ,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,cAAc,GACd,MAAM,UAAU,CAAC;AAClB,YAAY,EACX,SAAS,EACT,iBAAiB,EACjB,aAAa,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EACX,WAAW,EACX,IAAI,EACJ,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,UAAU,EACV,eAAe,EACf,SAAS,EACT,UAAU,EACV,SAAS,GACT,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,YAAY,EACX,aAAa,EACb,OAAO,EACP,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,KAAK,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,eAAe,EACf,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,OAAO,EACP,SAAS,EACT,QAAQ,EACR,aAAa,EACb,aAAa,EACb,YAAY,EACZ,SAAS,EACT,WAAW,EACX,aAAa,EACb,OAAO,EACP,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,WAAW,EACX,cAAc,EACd,YAAY,GACZ,MAAM,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proven-sign-in.d.ts","sourceRoot":"","sources":["../../src/auth/proven-sign-in.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"proven-sign-in.d.ts","sourceRoot":"","sources":["../../src/auth/proven-sign-in.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAoB,MAAM,WAAW,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE7D;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAChC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,YAAY,EAClB,EAAE,EAAE,EAAE,EACN,MAAM,EAAE,MAAM,GACZ,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAiBjD"}
|
|
@@ -91,8 +91,51 @@ export interface VerifyEmailApi<U> {
|
|
|
91
91
|
* e-mail the user has since changed is `TOKEN_STALE`.
|
|
92
92
|
*/
|
|
93
93
|
confirm(token: string): Promise<U>;
|
|
94
|
+
/**
|
|
95
|
+
* Applies the first proof of the user's e-mail **the application made
|
|
96
|
+
* itself** — an invitation token it issued to the address and the
|
|
97
|
+
* person followed: exactly what `magicLink.confirm` and
|
|
98
|
+
* `signInCode.confirm` do to an e-mail never proved, with no link and
|
|
99
|
+
* no code. In one write it marks the e-mail verified and drops the
|
|
100
|
+
* password and the second factor — active or waiting, with its
|
|
101
|
+
* recovery codes — and it revokes every session and spends the reset
|
|
102
|
+
* links and second-factor challenges, before the write and after it.
|
|
103
|
+
* Sends `user.emailVerified`, then `user.passwordChanged` when a
|
|
104
|
+
* password was dropped and `user.secondFactorDisabled` when an active
|
|
105
|
+
* factor was. Answers `{ user, proved: true }`.
|
|
106
|
+
*
|
|
107
|
+
* An e-mail already proved changes nothing and sends nothing:
|
|
108
|
+
* `{ user, proved: false }`.
|
|
109
|
+
*
|
|
110
|
+
* **Privileged: janus checks no credential.** Call it only after your
|
|
111
|
+
* server verified its own proof of the inbox, with the user from that
|
|
112
|
+
* proof's record — never with an id a request supplied: whoever
|
|
113
|
+
* chooses it drops anybody's password and second factor.
|
|
114
|
+
*
|
|
115
|
+
* **Call it before `setPassword` and before `signInProven`**: it drops
|
|
116
|
+
* the password and revokes every session, so a password set or a
|
|
117
|
+
* session opened before it is gone after it.
|
|
118
|
+
*
|
|
119
|
+
* Counts nothing in the mail or the sign-in throttle, sends no e-mail
|
|
120
|
+
* and issues no token. An inactive user is `USER_INACTIVE`; a
|
|
121
|
+
* malformed id, an unknown one or one of another type is `NOT_FOUND`;
|
|
122
|
+
* a user written since it was read is `VERSION_CONFLICT`, and nothing
|
|
123
|
+
* is proved.
|
|
124
|
+
*/
|
|
125
|
+
proveFirst(user: UserRef): Promise<FirstProof<U>>;
|
|
94
126
|
};
|
|
95
127
|
}
|
|
128
|
+
/** What `verifyEmail.proveFirst` answers: the user, and whether this call proved the e-mail. */
|
|
129
|
+
export interface FirstProof<U> {
|
|
130
|
+
/** The user after the call: `emailVerified` is `true` either way. */
|
|
131
|
+
readonly user: U;
|
|
132
|
+
/**
|
|
133
|
+
* `true` when the e-mail had never been proved and this call proved it,
|
|
134
|
+
* dropping the password and the second factor and revoking every
|
|
135
|
+
* session; `false` when it was already proved, and nothing changed.
|
|
136
|
+
*/
|
|
137
|
+
readonly proved: boolean;
|
|
138
|
+
}
|
|
96
139
|
/** What a user type with an e-mail and a password answers besides. */
|
|
97
140
|
export interface ResetPasswordApi<U> {
|
|
98
141
|
readonly resetPassword: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-flows.d.ts","sourceRoot":"","sources":["../../../src/auth/types/email-flows.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAgB,MAAM,WAAW,CAAC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AO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;KACrD,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a user type with an e-mail answers besides: finding its user by the
|
|
3
|
+
* address, whether the type signs in with a password or not.
|
|
4
|
+
*
|
|
5
|
+
* Part of what `janus()` hands back; `./index` gathers it.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Finding a user by their e-mail — the lookup an invitation needs before
|
|
9
|
+
* `signInProven`, on a type with no password and so no `findByLogin`.
|
|
10
|
+
*/
|
|
11
|
+
export interface FindByEmailApi<U> {
|
|
12
|
+
/**
|
|
13
|
+
* The user of this type holding this e-mail, or `null`. The address is
|
|
14
|
+
* normalised as the e-mail flows normalise it — trimmed and lowercased —
|
|
15
|
+
* whatever the type's login, so a type signing in with a username is
|
|
16
|
+
* still found by its e-mail, and a username that only looks like an
|
|
17
|
+
* address is nobody's. An inactive user is answered too, as by `find`.
|
|
18
|
+
*
|
|
19
|
+
* **An account-existence oracle: never expose it to an anonymous
|
|
20
|
+
* client.** It is a server-side read, to call after a proof of your own —
|
|
21
|
+
* an invitation token your server issued. It counts nothing in the mail
|
|
22
|
+
* or the sign-in throttle, issues nothing and writes nothing.
|
|
23
|
+
*
|
|
24
|
+
* A value that is no address — not a string, empty once trimmed, or
|
|
25
|
+
* holding a NUL or a lone surrogate — is nobody's: `null`, without
|
|
26
|
+
* asking the store, as `find` answers a malformed id. Rejects with
|
|
27
|
+
* `STORE_FAILED` only.
|
|
28
|
+
*/
|
|
29
|
+
findByEmail(email: string): Promise<U | null>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=find-by-email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-by-email.d.ts","sourceRoot":"","sources":["../../../src/auth/types/find-by-email.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC;IAChC;;;;;;;;;;;;;;;;OAgBG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;CAC9C"}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* dragging a type parameter through every internal function.
|
|
9
9
|
*/
|
|
10
10
|
export type { Checked } from './checks';
|
|
11
|
-
export type { IssuedCode, IssuedToken, ResetPasswordApi, SignInCodeApi, VerifyEmailApi, } from './email-flows';
|
|
11
|
+
export type { FirstProof, IssuedCode, IssuedToken, ResetPasswordApi, SignInCodeApi, VerifyEmailApi, } from './email-flows';
|
|
12
|
+
export type { FindByEmailApi } from './find-by-email';
|
|
12
13
|
export type { EmailOf, LoginOf, RequiredStringKeys, TypesOf, UserOf, } from './inference';
|
|
13
14
|
export type { Janus, SharedApi, TypeApi } from './janus';
|
|
14
15
|
export type { MagicLinkApi } from './magic-link';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EACX,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,cAAc,GACd,MAAM,eAAe,CAAC;AACvB,YAAY,EACX,OAAO,EACP,OAAO,EACP,kBAAkB,EAClB,OAAO,EACP,MAAM,GACN,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAChE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,YAAY,EACX,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,qBAAqB,GACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,OAAO,GACP,MAAM,WAAW,CAAC;AACnB,YAAY,EACX,oBAAoB,EACpB,QAAQ,EACR,aAAa,EACb,YAAY,GACZ,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACvE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACpE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,cAAc,GACd,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,YAAY,EACX,OAAO,EACP,OAAO,EACP,kBAAkB,EAClB,OAAO,EACP,MAAM,GACN,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAChE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,YAAY,EACX,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,qBAAqB,GACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,OAAO,GACP,MAAM,WAAW,CAAC;AACnB,YAAY,EACX,oBAAoB,EACpB,QAAQ,EACR,aAAa,EACb,YAAY,GACZ,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACvE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACpE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { JanusConfig, MultiTypeConfig, SingleTypeConfig } from '../config';
|
|
8
8
|
import type { ResetPasswordApi, SignInCodeApi, VerifyEmailApi } from './email-flows';
|
|
9
|
+
import type { FindByEmailApi } from './find-by-email';
|
|
9
10
|
import type { EmailOf, FieldsInput, LoginOf, SingleAsType, UserOf, UserOfType } from './inference';
|
|
10
11
|
import type { MagicLinkApi } from './magic-link';
|
|
11
12
|
import type { PasswordApi } from './password';
|
|
@@ -27,7 +28,7 @@ type SignInAnswer<Name extends string, Def, TwoFactor extends boolean> = TwoFact
|
|
|
27
28
|
* The whole surface of one user type, with only the flows its configuration
|
|
28
29
|
* allows. `TwoFactor` is whether `janus()` was given a `secondFactor`.
|
|
29
30
|
*/
|
|
30
|
-
export type TypeApi<Name extends string, Def, TwoFactor extends boolean = false> = UserTypeApi<UserOfType<Name, Def>, FieldsInput<Def>> & ProvenSignInApi<UserOfType<Name, Def>, SignInAnswer<Name, Def, TwoFactor>> & ([LoginOf<Def>] extends [never] ? unknown : TwoFactor extends true ? PasswordApi<UserOfType<Name, Def>, FieldsInput<Def>, LoginOf<Def>, SignInResult<UserOfType<Name, Def>>> & SecondFactorApi<UserOfType<Name, Def>> : PasswordApi<UserOfType<Name, Def>, FieldsInput<Def>, LoginOf<Def>>) & ([EmailOf<Def>] extends [never] ? unknown : VerifyEmailApi<UserOfType<Name, Def>> & SignInCodeApi<UserOfType<Name, Def>, SignInAnswer<Name, Def, TwoFactor>> & MagicLinkApi<UserOfType<Name, Def>, SignInAnswer<Name, Def, TwoFactor>> & StepUpApi<UserOfType<Name, Def>, TwoFactor extends true ? [LoginOf<Def>] extends [never] ? StepUpByEmail<UserOfType<Name, Def>> : StepUpByEmail<UserOfType<Name, Def>> | StepUpByApp<UserOfType<Name, Def>> : StepUpByEmail<UserOfType<Name, Def>>>) & ([LoginOf<Def>] extends [never] ? unknown : [EmailOf<Def>] extends [never] ? unknown : ResetPasswordApi<UserOfType<Name, Def>>);
|
|
31
|
+
export type TypeApi<Name extends string, Def, TwoFactor extends boolean = false> = UserTypeApi<UserOfType<Name, Def>, FieldsInput<Def>> & ProvenSignInApi<UserOfType<Name, Def>, SignInAnswer<Name, Def, TwoFactor>> & ([LoginOf<Def>] extends [never] ? unknown : TwoFactor extends true ? PasswordApi<UserOfType<Name, Def>, FieldsInput<Def>, LoginOf<Def>, SignInResult<UserOfType<Name, Def>>> & SecondFactorApi<UserOfType<Name, Def>> : PasswordApi<UserOfType<Name, Def>, FieldsInput<Def>, LoginOf<Def>>) & ([EmailOf<Def>] extends [never] ? unknown : FindByEmailApi<UserOfType<Name, Def>> & VerifyEmailApi<UserOfType<Name, Def>> & SignInCodeApi<UserOfType<Name, Def>, SignInAnswer<Name, Def, TwoFactor>> & MagicLinkApi<UserOfType<Name, Def>, SignInAnswer<Name, Def, TwoFactor>> & StepUpApi<UserOfType<Name, Def>, TwoFactor extends true ? [LoginOf<Def>] extends [never] ? StepUpByEmail<UserOfType<Name, Def>> : StepUpByEmail<UserOfType<Name, Def>> | StepUpByApp<UserOfType<Name, Def>> : StepUpByEmail<UserOfType<Name, Def>>>) & ([LoginOf<Def>] extends [never] ? unknown : [EmailOf<Def>] extends [never] ? unknown : ResetPasswordApi<UserOfType<Name, Def>>);
|
|
31
32
|
/** What every configuration answers, whatever its user types. */
|
|
32
33
|
export interface SharedApi<U extends {
|
|
33
34
|
readonly type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"janus.d.ts","sourceRoot":"","sources":["../../../src/auth/types/janus.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,KAAK,EACX,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACX,OAAO,EACP,WAAW,EACX,OAAO,EACP,YAAY,EACZ,MAAM,EACN,UAAU,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;GAKG;AACH,KAAK,YAAY,CAChB,IAAI,SAAS,MAAM,EACnB,GAAG,EACH,SAAS,SAAS,OAAO,IACtB,SAAS,SAAS,IAAI,GACvB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAC7B,QAAQ,CAAC,UAAU,CAAC,IAAI,EAA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AAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EACb,WAAW,CAAC,CAAC,CAAC,CACd;CACD,GACA,CAAC,SAAS,gBAAgB,GACzB,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAChD,KAAK,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AnyUser } from '../context';
|
|
2
|
-
import type { MagicLinkApi, PasswordApi, ProvenSignInApi, ResetPasswordApi, SecondFactorApi, SignInCodeApi, SignInResult, StepUpApi, StepUpByApp, StepUpByEmail, UserTypeApi, VerifyEmailApi } from '../types';
|
|
2
|
+
import type { FindByEmailApi, MagicLinkApi, PasswordApi, ProvenSignInApi, ResetPasswordApi, SecondFactorApi, SignInCodeApi, SignInResult, StepUpApi, StepUpByApp, StepUpByEmail, UserTypeApi, VerifyEmailApi } from '../types';
|
|
3
3
|
import type { Input } from './flow-types';
|
|
4
4
|
/** Everything one user type answers. Which flows it has is decided by its types; all are built. */
|
|
5
|
-
export type AnyTypeApi = UserTypeApi<AnyUser, Input> & PasswordApi<AnyUser, Input, string, SignInResult<AnyUser>> & SecondFactorApi<AnyUser> & ProvenSignInApi<AnyUser, SignInResult<AnyUser>> & SignInCodeApi<AnyUser, SignInResult<AnyUser>> & MagicLinkApi<AnyUser, SignInResult<AnyUser>> & StepUpApi<AnyUser, StepUpByEmail<AnyUser> | StepUpByApp<AnyUser>> & VerifyEmailApi<AnyUser> & ResetPasswordApi<AnyUser>;
|
|
5
|
+
export type AnyTypeApi = UserTypeApi<AnyUser, Input> & PasswordApi<AnyUser, Input, string, SignInResult<AnyUser>> & SecondFactorApi<AnyUser> & ProvenSignInApi<AnyUser, SignInResult<AnyUser>> & SignInCodeApi<AnyUser, SignInResult<AnyUser>> & MagicLinkApi<AnyUser, SignInResult<AnyUser>> & StepUpApi<AnyUser, StepUpByEmail<AnyUser> | StepUpByApp<AnyUser>> & VerifyEmailApi<AnyUser> & FindByEmailApi<AnyUser> & ResetPasswordApi<AnyUser>;
|
|
6
6
|
//# sourceMappingURL=any-type-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any-type-api.d.ts","sourceRoot":"","sources":["../../../src/auth/users/any-type-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EACX,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,SAAS,EACT,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,mGAAmG;AACnG,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,GACnD,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GAC1D,eAAe,CAAC,OAAO,CAAC,GACxB,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GAC/C,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GAC7C,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GAC5C,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GACjE,cAAc,CAAC,OAAO,CAAC,GACvB,gBAAgB,CAAC,OAAO,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"any-type-api.d.ts","sourceRoot":"","sources":["../../../src/auth/users/any-type-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,SAAS,EACT,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,mGAAmG;AACnG,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,GACnD,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GAC1D,eAAe,CAAC,OAAO,CAAC,GACxB,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GAC/C,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GAC7C,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GAC5C,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GACjE,cAAc,CAAC,OAAO,CAAC,GACvB,cAAc,CAAC,OAAO,CAAC,GACvB,gBAAgB,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ResolvedType } from '../config';
|
|
2
|
+
import { type AnyUser, type Context } from '../context';
|
|
3
|
+
import type { FindByEmailApi } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* `findByEmail` for one user type: the holder the e-mail flows would find —
|
|
6
|
+
* the same normalisation, the same comparison with the stored address — with
|
|
7
|
+
* nothing counted, issued or written. A value that is no address is
|
|
8
|
+
* nobody's, as a malformed id is for `find`, and the store is not asked.
|
|
9
|
+
*/
|
|
10
|
+
export declare function findByEmailFlows(context: Context, type: ResolvedType): FindByEmailApi<AnyUser>;
|
|
11
|
+
//# sourceMappingURL=find-by-email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-by-email.d.ts","sourceRoot":"","sources":["../../../src/auth/users/find-by-email.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAyB,MAAM,YAAY,CAAC;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,YAAY,GAChB,cAAc,CAAC,OAAO,CAAC,CASzB"}
|
|
@@ -4,7 +4,7 @@ import type { AnyTypeApi } from './any-type-api';
|
|
|
4
4
|
/**
|
|
5
5
|
* Everything one user type answers, gathered from its flows: its records,
|
|
6
6
|
* its password, its sign-in on the application's proof, its second factor,
|
|
7
|
-
* its sign-in code and link, its step-up and
|
|
7
|
+
* its sign-in code and link, its step-up, its e-mails and the lookup by e-mail.
|
|
8
8
|
*/
|
|
9
9
|
export declare function typeApi(context: Context, type: ResolvedType): AnyTypeApi;
|
|
10
10
|
//# sourceMappingURL=type-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-api.d.ts","sourceRoot":"","sources":["../../../src/auth/users/type-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAO1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"type-api.d.ts","sourceRoot":"","sources":["../../../src/auth/users/type-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAO1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,GAAG,UAAU,CAmBxE"}
|