@softistx/janus 0.77.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 +42 -15
- package/dist/auth/api-keys/authenticate-key.d.ts +3 -2
- package/dist/auth/api-keys/authenticate-key.d.ts.map +1 -1
- package/dist/auth/api-keys/count.d.ts.map +1 -1
- package/dist/auth/api-keys/create/after-insert.d.ts +11 -0
- package/dist/auth/api-keys/create/after-insert.d.ts.map +1 -0
- package/dist/auth/api-keys/create/checks.d.ts +17 -0
- package/dist/auth/api-keys/create/checks.d.ts.map +1 -1
- package/dist/auth/api-keys/create/index.d.ts.map +1 -1
- package/dist/auth/api-keys/create/service-checks.d.ts +25 -0
- package/dist/auth/api-keys/create/service-checks.d.ts.map +1 -0
- package/dist/auth/api-keys/create/service.d.ts +12 -0
- package/dist/auth/api-keys/create/service.d.ts.map +1 -0
- package/dist/auth/api-keys/expiry.d.ts.map +1 -1
- package/dist/auth/api-keys/flows.d.ts +6 -2
- package/dist/auth/api-keys/flows.d.ts.map +1 -1
- package/dist/auth/api-keys/owned.d.ts +12 -0
- package/dist/auth/api-keys/owned.d.ts.map +1 -0
- package/dist/auth/api-keys/read.d.ts.map +1 -1
- package/dist/auth/api-keys/service-flows.d.ts +13 -0
- package/dist/auth/api-keys/service-flows.d.ts.map +1 -0
- package/dist/auth/api-keys/to-api-key.d.ts.map +1 -1
- package/dist/auth/config/api-keys-config.d.ts +29 -2
- package/dist/auth/config/api-keys-config.d.ts.map +1 -1
- package/dist/auth/config/index.d.ts +2 -2
- package/dist/auth/config/index.d.ts.map +1 -1
- package/dist/auth/config/resolve-api-keys.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 +11 -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 +3 -2
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/port/memory/api-keys/capabilities.d.ts.map +1 -1
- package/dist/auth/port/memory/api-keys/index.d.ts.map +1 -1
- package/dist/auth/port/types/api-keys.d.ts +25 -5
- package/dist/auth/port/types/api-keys.d.ts.map +1 -1
- package/dist/auth/sessions/authenticate.d.ts +3 -2
- package/dist/auth/sessions/authenticate.d.ts.map +1 -1
- package/dist/auth/sessions/fresh.d.ts +2 -2
- package/dist/auth/sessions/fresh.d.ts.map +1 -1
- package/dist/auth/sessions/shared-api.d.ts +3 -2
- package/dist/auth/sessions/shared-api.d.ts.map +1 -1
- package/dist/auth/shared-api.d.ts +11 -3
- package/dist/auth/shared-api.d.ts.map +1 -1
- package/dist/auth/signed-token.d.ts +41 -0
- package/dist/auth/signed-token.d.ts.map +1 -0
- 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/api-keys-of.d.ts +6 -1
- package/dist/auth/types/api-keys-of.d.ts.map +1 -1
- package/dist/auth/types/api-keys.d.ts +18 -6
- package/dist/auth/types/api-keys.d.ts.map +1 -1
- package/dist/auth/types/checks.d.ts +17 -1
- package/dist/auth/types/checks.d.ts.map +1 -1
- package/dist/auth/types/index.d.ts +3 -2
- package/dist/auth/types/index.d.ts.map +1 -1
- package/dist/auth/types/service-keys.d.ts +58 -0
- package/dist/auth/types/service-keys.d.ts.map +1 -0
- package/dist/auth/types/session.d.ts +21 -2
- package/dist/auth/types/session.d.ts.map +1 -1
- package/dist/auth/types/shared-api.d.ts +15 -1
- package/dist/auth/types/shared-api.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/chunks/{index-7h34nqrm.js → index-5hcajrrx.js} +5 -5
- package/dist/chunks/{index-7h34nqrm.js.map → index-5hcajrrx.js.map} +4 -4
- package/dist/chunks/{index-n8jxmxeg.js → index-gzc472ar.js} +2 -2
- package/dist/chunks/{index-ftz0ne6j.js → index-r8fcessc.js} +2 -2
- package/dist/chunks/{index-2ttdcz7n.js → index-vx9a5cpy.js} +9 -3
- package/dist/chunks/{index-2ttdcz7n.js.map → index-vx9a5cpy.js.map} +4 -4
- package/dist/conformance/api-keys/cases/index.d.ts.map +1 -1
- package/dist/conformance/api-keys/cases/outage.d.ts.map +1 -1
- package/dist/conformance/api-keys/cases/service.d.ts +3 -0
- package/dist/conformance/api-keys/cases/service.d.ts.map +1 -0
- package/dist/conformance/index.js +407 -302
- package/dist/conformance/index.js.map +6 -5
- package/dist/errors/janus-error/codes.invitations.d.ts +6 -0
- package/dist/errors/janus-error/codes.invitations.d.ts.map +1 -1
- package/dist/errors/janus-error/index.d.ts +1 -1
- package/dist/errors/janus-error/index.d.ts.map +1 -1
- package/dist/errors/janus-error/options.d.ts +1 -1
- package/dist/errors/janus-error/options.d.ts.map +1 -1
- package/dist/errors/janus-error/refusals.d.ts +5 -0
- package/dist/errors/janus-error/refusals.d.ts.map +1 -1
- package/dist/errors/janus-error/status.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +517 -117
- package/dist/index.js.map +32 -25
- package/dist/permissions/index.js +3 -3
- package/docs/README.md +1 -0
- package/docs/guide/api-keys.md +78 -1
- package/docs/guide/email-flows.md +6 -1
- package/docs/guide/errors.md +4 -3
- package/docs/guide/events.md +7 -7
- package/docs/guide/magic-link.md +1 -1
- package/docs/guide/signed-tokens.md +46 -0
- package/docs/guide/social.md +102 -5
- package/docs/roadmap.md +3 -0
- package/docs/troubleshooting.md +33 -0
- package/package.json +1 -1
- /package/dist/chunks/{index-n8jxmxeg.js.map → index-gzc472ar.js.map} +0 -0
- /package/dist/chunks/{index-ftz0ne6j.js.map → index-r8fcessc.js.map} +0 -0
|
@@ -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;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,mDAAmD;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,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CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACtD,OAAO,EAAE,aAAa,KAClB,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC;AAE1D,uEAAuE;AACvE,UAAU,aAAa;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC;IAChE;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,sBAAsB,CAAC;IAC1E;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;CAChC;AAED,gFAAgF;AAChF,UAAU,eAAgB,SAAQ,aAAa;IAC9C;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE;QAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,CAAC;IAChE,QAAQ,CAAC,eAAe,CAAC,EAAE,sBAAsB,CAAC;CAClD;AAED,yEAAyE;AACzE,UAAU,iBAAkB,SAAQ,aAAa;IAChD,QAAQ,CAAC,SAAS,CAAC,EAAE;QAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAAA;KAAE,CAAC;IACjE;;;;;;;;;OASG;IACH,QAAQ,CAAC,eAAe,EAAE,sBAAsB,CAAC;CACjD;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,iBAAiB,CAAC"}
|
package/dist/auth/events.d.ts
CHANGED
|
@@ -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,qBAAqB,GACrB,4BAA4B,GAC5B,oBAAoB,GACpB,oBAAoB,GACpB,cAAc,CAAC;AAElB;;;;;;;;;GASG;AACH,MAAM,WAAW,SAAS;IACzB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IAChB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IA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,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, 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';
|
|
@@ -16,7 +16,8 @@ export { type PurposeSealer, sealerFor } from './sealer-for';
|
|
|
16
16
|
export type { SealingKey } from './sealing';
|
|
17
17
|
export { AMR, isMultiFactor } from './sessions/amr';
|
|
18
18
|
export { assertFresh } from './sessions/fresh';
|
|
19
|
+
export { type SignTokenOptions, signToken, type VerifiedToken, type VerifyTokenOptions, verifyToken, } from './signed-token';
|
|
19
20
|
export { isReturnTo } from './social/return-to';
|
|
20
21
|
export type { StandardSchemaV1 } from './standard-schema';
|
|
21
|
-
export type { AcceptedInvitation, AnyTypeChangeEmailApi, AnyTypeResetPasswordApi, AnyTypeVerifyEmailApi, ApiKey, ApiKeyListOptions, ApiKeyPage, ApiKeysApi, Authenticated, AvatarApi, ChangeEmailApi, Checked, CreateApiKeyInput, CreatedApiKey, EmailOf, FindByEmailApi, FindOrCreateApi, FirstProof, HeaderRecord, HistoryRecord, HistoryRefusal, ImportHistoryItem, ImportHistoryOptions, ImportHistoryReport, Invitation, InvitationPreview, InvitationsApi, IssuedCode, IssuedInvitation, IssuedToken, Janus, KeyAuthenticated, LoginOf, MagicLinkApi, Passkey, PasskeyFirstFactorApi, PasskeyRegistrationOptions, PasskeySignInApi, PasskeySignInChallenge, PasskeySignInOptions, PasskeysApi, PasswordApi, PreparedCode, PreparedRequest, Principal, ProvenSignInApi, RecoveredSignIn, RecoveryCodesIssued, RequestLike, RequiredStringKeys, ResetPasswordApi, SecondFactorApi, SecondFactorEnrolment, SecondFactorMethod, SecondFactorProof, SecondFactorRequired, SecondFactorResealed, SecondFactorSignedIn, Session, SharedApi, SignedIn, SignInCodeApi, SignInOptions, SignInResult, SocialApi, SocialCompleted, SocialFlowStart, SocialLink, SocialLinked, SocialStepUp, SocialStepUpProof, SpentRecoveryCode, StepUpApi, StepUpByApp, StepUpByEmail, StepUpByPasskey, StepUpPasskeyApi, TypeApi, TypesOf, User, UserAvatar, UserBase, UserOf, UserRef, UserTypeApi, VerifyEmailApi, WriteOptions, } from './types';
|
|
22
|
+
export type { AcceptedInvitation, AnyTypeChangeEmailApi, AnyTypeResetPasswordApi, AnyTypeVerifyEmailApi, ApiKey, ApiKeyListOptions, ApiKeyPage, ApiKeysApi, Authenticated, AvatarApi, ChangeEmailApi, Checked, CreateApiKeyInput, CreatedApiKey, CreateServiceKeyInput, EmailOf, FindByEmailApi, FindOrCreateApi, FirstProof, HeaderRecord, HistoryRecord, HistoryRefusal, ImportHistoryItem, ImportHistoryOptions, ImportHistoryReport, Invitation, InvitationPreview, InvitationsApi, IssuedCode, IssuedInvitation, IssuedToken, Janus, KeyAuthenticated, LoginOf, MagicLinkApi, Passkey, PasskeyFirstFactorApi, PasskeyRegistrationOptions, PasskeySignInApi, PasskeySignInChallenge, PasskeySignInOptions, PasskeysApi, PasswordApi, PreparedCode, PreparedRequest, Principal, ProvenSignInApi, RecoveredSignIn, RecoveryCodesIssued, RequestLike, RequiredStringKeys, ResetPasswordApi, SecondFactorApi, SecondFactorEnrolment, SecondFactorMethod, SecondFactorProof, SecondFactorRequired, SecondFactorResealed, SecondFactorSignedIn, ServiceKeyAuthenticated, ServiceKeysApi, Session, SharedApi, SignedIn, SignInCodeApi, SignInOptions, SignInResult, SocialApi, SocialCompleted, SocialFlowStart, SocialLink, SocialLinked, SocialStepUp, SocialStepUpProof, SpentRecoveryCode, StepUpApi, StepUpByApp, StepUpByEmail, StepUpByPasskey, StepUpPasskeyApi, TypeApi, TypesOf, User, UserApiKey, UserAvatar, UserBase, UserOf, UserRef, UserTypeApi, VerifyEmailApi, WriteOptions, } from './types';
|
|
22
23
|
//# 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,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,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,UAAU,EACV,cAAc,GACd,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,aAAa,EACb,KAAK,mBAAmB,EACxB,YAAY,EACZ,sBAAsB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACX,SAAS,EACT,iBAAiB,EACjB,aAAa,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACpD,YAAY,EACX,eAAe,EACf,uBAAuB,EACvB,mBAAmB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KA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,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,CAAC;AAClB,OAAO,EACN,aAAa,EACb,KAAK,mBAAmB,EACxB,YAAY,EACZ,sBAAsB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACX,SAAS,EACT,iBAAiB,EACjB,aAAa,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACpD,YAAY,EACX,eAAe,EACf,uBAAuB,EACvB,mBAAmB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACxB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EACN,KAAK,uBAAuB,EAC5B,gBAAgB,GAChB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACX,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,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,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../../../src/auth/port/memory/api-keys/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,yBAAyB,EACzB,QAAQ,EACR,YAAY,EACZ,sBAAsB,EACtB,MAAM,aAAa,CAAC;AAGrB,2DAA2D;AAC3D,wBAAgB,YAAY,CAC3B,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC/B,kBAAkB,CAuBpB;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC/B,sBAAsB,CAcxB;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC/B,yBAAyB,
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../../../src/auth/port/memory/api-keys/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,yBAAyB,EACzB,QAAQ,EACR,YAAY,EACZ,sBAAsB,EACtB,MAAM,aAAa,CAAC;AAGrB,2DAA2D;AAC3D,wBAAgB,YAAY,CAC3B,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC/B,kBAAkB,CAuBpB;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC/B,sBAAsB,CAcxB;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC/B,yBAAyB,CAyB3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/auth/port/memory/api-keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,yBAAyB,EAGzB,WAAW,EACX,sBAAsB,EACtB,MAAM,aAAa,CAAC;AASrB;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,IAAI,WAAW,GACjD,kBAAkB,GAClB,sBAAsB,GACtB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/auth/port/memory/api-keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,yBAAyB,EAGzB,WAAW,EACX,sBAAsB,EACtB,MAAM,aAAa,CAAC;AASrB;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,IAAI,WAAW,GACjD,kBAAkB,GAClB,sBAAsB,GACtB,yBAAyB,CAsEzB"}
|
|
@@ -31,14 +31,26 @@ export interface ApiKeyBound {
|
|
|
31
31
|
*/
|
|
32
32
|
export interface ApiKeyRecord {
|
|
33
33
|
readonly id: ApiKeyId;
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* The user who holds the key; `null` for a **service key**, which belongs
|
|
36
|
+
* to its `bound` object and outlives whoever created it. A store with the
|
|
37
|
+
* `bound` capability stores both, and every method that reads by user
|
|
38
|
+
* (`listUserApiKeys`, `revokeUserApiKeys`, `deleteUserApiKeys`) leaves a
|
|
39
|
+
* `null` one alone.
|
|
40
|
+
*/
|
|
41
|
+
readonly userId: Id | null;
|
|
35
42
|
/** A label the owner chose, to tell their keys apart. */
|
|
36
43
|
readonly name: string;
|
|
37
44
|
/** `sha256` of the secret, hex. */
|
|
38
45
|
readonly secretHash: string;
|
|
39
46
|
readonly createdAt: Date;
|
|
40
|
-
/**
|
|
41
|
-
|
|
47
|
+
/**
|
|
48
|
+
* When the key lapses; `null` for a service key created with the `'never'`
|
|
49
|
+
* lifetime, which stands until revoked. Every other key expires. A store
|
|
50
|
+
* with the `bound` capability stores `null` and never lists it as expiring
|
|
51
|
+
* or deletes it as expired.
|
|
52
|
+
*/
|
|
53
|
+
readonly expiresAt: Date | null;
|
|
42
54
|
/** When the key last authenticated a request, within the throttle; `null` if never. */
|
|
43
55
|
readonly lastUsedAt: Date | null;
|
|
44
56
|
/** `null` while the key stands. */
|
|
@@ -46,7 +58,7 @@ export interface ApiKeyRecord {
|
|
|
46
58
|
/**
|
|
47
59
|
* What the key may do, as the application names it (`mcp:read`…); absent
|
|
48
60
|
* for a key that may do whatever its user may. Only a store with the
|
|
49
|
-
* `bound` capability is handed one.
|
|
61
|
+
* `bound` capability is handed one. A service key always has them.
|
|
50
62
|
*/
|
|
51
63
|
readonly scopes?: readonly string[];
|
|
52
64
|
/**
|
|
@@ -54,6 +66,12 @@ export interface ApiKeyRecord {
|
|
|
54
66
|
* to nothing. Only a store with the `bound` capability is handed one.
|
|
55
67
|
*/
|
|
56
68
|
readonly bound?: ApiKeyBound;
|
|
69
|
+
/**
|
|
70
|
+
* Free-form JSON the application attached to a service key (`domains`…),
|
|
71
|
+
* answered verbatim as `apiKey.details`; absent for a key without any. Only a
|
|
72
|
+
* store with the `bound` capability is handed one.
|
|
73
|
+
*/
|
|
74
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
57
75
|
/** When the expiry notice was recorded; absent until it is. */
|
|
58
76
|
readonly expiryNotifiedAt?: Date;
|
|
59
77
|
}
|
|
@@ -134,7 +152,9 @@ export interface ApiKeyStoreBase {
|
|
|
134
152
|
}
|
|
135
153
|
/**
|
|
136
154
|
* The optional capability `bound`: both methods, or neither. A store that has
|
|
137
|
-
* them also stores `scopes` and `bound` as given, and answers them verbatim
|
|
155
|
+
* them also stores `scopes` and `bound` as given, and answers them verbatim,
|
|
156
|
+
* and stores a **service key**: a record whose `userId` is `null` and whose
|
|
157
|
+
* `expiresAt` may be `null` (see {@link ApiKeyRecord}).
|
|
138
158
|
*/
|
|
139
159
|
export interface ApiKeyBoundMethods {
|
|
140
160
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../../../src/auth/port/types/api-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../../../src/auth/port/types/api-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB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AAW,yBAAyB;IACzC;;;;;OAKG;IACH,mBAAmB,CAClB,OAAO,EAAE,qBAAqB,GAC5B,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;IAErC;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnE;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,WAChB,SAAQ,eAAe,EACtB,OAAO,CAAC,kBAAkB,CAAC,EAC3B,OAAO,CAAC,sBAAsB,CAAC,EAC/B,OAAO,CAAC,yBAAyB,CAAC;CAAG"}
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* anonymous — and the renewal of a session used past its `renewAfter`.
|
|
4
4
|
*/
|
|
5
5
|
import { type AnyUser, type Context } from '../context';
|
|
6
|
-
import type { Principal, RequestLike } from '../types';
|
|
6
|
+
import type { Principal, RequestLike, ServiceKeyAuthenticated } from '../types';
|
|
7
7
|
/** Answers the user and the session `request` presents, or `null` for anonymous. */
|
|
8
8
|
export declare function authenticate(context: Context, request: RequestLike, options?: {
|
|
9
9
|
readonly type?: string;
|
|
10
10
|
readonly apiKey?: boolean;
|
|
11
|
-
|
|
11
|
+
readonly service?: boolean;
|
|
12
|
+
}): Promise<Principal<AnyUser> | ServiceKeyAuthenticated | null>;
|
|
12
13
|
//# sourceMappingURL=authenticate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../../src/auth/sessions/authenticate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,YAAY,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../../src/auth/sessions/authenticate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,YAAY,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAKhF,oFAAoF;AACpF,wBAAsB,YAAY,CACjC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE;IACT,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC3B,GACC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,uBAAuB,GAAG,IAAI,CAAC,CAmF9D"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type Clock } from '../../time/clock';
|
|
7
7
|
import { type Duration } from '../../time/duration';
|
|
8
|
-
import type { Principal, Session } from '../types';
|
|
8
|
+
import type { Principal, ServiceKeyAuthenticated, Session } from '../types';
|
|
9
9
|
/**
|
|
10
10
|
* Refuses a session whose credentials were last presented `maxAge` ago or
|
|
11
11
|
* more — at its sign-in, or since by `stepUp.confirm` — with
|
|
@@ -31,5 +31,5 @@ export declare function assertFresh(session: Pick<Session, 'authenticatedAt' | '
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function assertFresh(principal: Principal<{
|
|
33
33
|
readonly id: string;
|
|
34
|
-
}
|
|
34
|
+
}> | ServiceKeyAuthenticated, maxAge: Duration, clock?: Clock): void;
|
|
35
35
|
//# sourceMappingURL=fresh.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fresh.d.ts","sourceRoot":"","sources":["../../../src/auth/sessions/fresh.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,KAAK,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"fresh.d.ts","sourceRoot":"","sources":["../../../src/auth/sessions/fresh.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,KAAK,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE5E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAC1B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,QAAQ,CAAC,EACpD,MAAM,EAAE,QAAQ,EAChB,KAAK,CAAC,EAAE,KAAK,GACX,IAAI,CAAC;AACR;;;;;GAKG;AACH,wBAAgB,WAAW,CAC1B,SAAS,EAAE,SAAS,CAAC;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,uBAAuB,EACvE,MAAM,EAAE,QAAQ,EAChB,KAAK,CAAC,EAAE,KAAK,GACX,IAAI,CAAC"}
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* sessions and one-time tokens.
|
|
5
5
|
*/
|
|
6
6
|
import { type AnyUser, type Context } from '../context';
|
|
7
|
-
import type { Principal, RequestLike, SharedApi } from '../types';
|
|
7
|
+
import type { Principal, RequestLike, ServiceKeyAuthenticated, SharedApi } from '../types';
|
|
8
8
|
/** `SharedApi`, degenericised: `janus()` casts it to the typed form once. */
|
|
9
9
|
export type InternalSharedApi = Omit<SharedApi<AnyUser>, 'authenticate'> & {
|
|
10
10
|
authenticate(request: RequestLike, options?: {
|
|
11
11
|
readonly type?: string;
|
|
12
12
|
readonly apiKey?: boolean;
|
|
13
|
-
|
|
13
|
+
readonly service?: boolean;
|
|
14
|
+
}): Promise<Principal<AnyUser> | ServiceKeyAuthenticated | null>;
|
|
14
15
|
};
|
|
15
16
|
/** Everything `janus()` answers whatever its user types. */
|
|
16
17
|
export declare function sharedApi(context: Context): InternalSharedApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-api.d.ts","sourceRoot":"","sources":["../../../src/auth/sessions/shared-api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,OAAO,EAKZ,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"shared-api.d.ts","sourceRoot":"","sources":["../../../src/auth/sessions/shared-api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,OAAO,EAKZ,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EACX,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,SAAS,EACT,MAAM,UAAU,CAAC;AAOlB,6EAA6E;AAC7E,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,GAAG;IAC1E,YAAY,CACX,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE;QACT,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;KAC3B,GACC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,uBAAuB,GAAG,IAAI,CAAC,CAAC;CAChE,CAAC;AAmCF,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAuE7D"}
|
|
@@ -101,7 +101,7 @@ export declare function sharedSurface(context: Context, resolved: ResolvedConfig
|
|
|
101
101
|
readonly id: string;
|
|
102
102
|
readonly type: string;
|
|
103
103
|
}>, input: import("./types").CreateApiKeyInput<string | number>): Promise<import("./types").CreatedApiKey>;
|
|
104
|
-
list(user: import("./types").UserRef, options?: import("./types").ApiKeyListOptions): Promise<import("..").CursorPage<import("./types").
|
|
104
|
+
list(user: import("./types").UserRef, options?: import("./types").ApiKeyListOptions): Promise<import("..").CursorPage<import("./types").UserApiKey>>;
|
|
105
105
|
get(id: string, options?: {
|
|
106
106
|
readonly owner?: import("./types").UserRef;
|
|
107
107
|
}): Promise<import("./types").ApiKey | null>;
|
|
@@ -109,12 +109,19 @@ export declare function sharedSurface(context: Context, resolved: ResolvedConfig
|
|
|
109
109
|
revokeAllBound(user: import("./types").UserRef, object: import(".").ApiKeyBound): Promise<number>;
|
|
110
110
|
expiring(options: {
|
|
111
111
|
readonly within: import("..").Duration;
|
|
112
|
-
} & import("./types").ApiKeyPage): Promise<import("..").CursorPage<import("./types").
|
|
112
|
+
} & import("./types").ApiKeyPage): Promise<import("..").CursorPage<import("./types").UserApiKey>>;
|
|
113
113
|
markExpiryNotified(id: string): Promise<boolean>;
|
|
114
114
|
revoke(id: string, options?: {
|
|
115
115
|
readonly owner?: import("./types").UserRef;
|
|
116
116
|
}): Promise<void>;
|
|
117
117
|
revokeAll(user: import("./types").UserRef): Promise<number>;
|
|
118
|
+
} & {
|
|
119
|
+
createService(current: import("./types").Principal<{
|
|
120
|
+
readonly id: string;
|
|
121
|
+
readonly type: string;
|
|
122
|
+
}>, input: import("./types").CreateServiceKeyInput<string | number>): Promise<import("./types").CreatedApiKey<import("./types").ApiKey>>;
|
|
123
|
+
listOwned(owner: import(".").ApiKeyBound, page?: import("./types").ApiKeyPage): Promise<import("..").CursorPage<import("./types").ApiKey>>;
|
|
124
|
+
revokeOwned(owner: import(".").ApiKeyBound, id: string): Promise<void>;
|
|
118
125
|
};
|
|
119
126
|
sessions: {
|
|
120
127
|
list(user: import("./types").UserRef): Promise<readonly import("./types").Session[]>;
|
|
@@ -137,6 +144,7 @@ export declare function sharedSurface(context: Context, resolved: ResolvedConfig
|
|
|
137
144
|
authenticate(request: import("./types").RequestLike, options?: {
|
|
138
145
|
readonly type?: string;
|
|
139
146
|
readonly apiKey?: boolean;
|
|
140
|
-
|
|
147
|
+
readonly service?: boolean;
|
|
148
|
+
}): Promise<import("./types").Principal<import("./context").AnyUser> | import("./types").ServiceKeyAuthenticated | null>;
|
|
141
149
|
};
|
|
142
150
|
//# sourceMappingURL=shared-api.d.ts.map
|
|
@@ -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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Clock } from '../time/clock';
|
|
2
|
+
import { type Duration } from '../time/duration';
|
|
3
|
+
import { type SealingKey } from './sealing';
|
|
4
|
+
/** What `signToken` takes beside the payload. */
|
|
5
|
+
export interface SignTokenOptions {
|
|
6
|
+
/** How long the token lives: `'15m'`, `'7d'`, or milliseconds. */
|
|
7
|
+
readonly expiresIn: Duration;
|
|
8
|
+
/** Where now comes from; the system clock by default. */
|
|
9
|
+
readonly clock?: Clock;
|
|
10
|
+
}
|
|
11
|
+
/** What `verifyToken` takes beside the token. */
|
|
12
|
+
export interface VerifyTokenOptions {
|
|
13
|
+
/** Where now comes from; the system clock by default. */
|
|
14
|
+
readonly clock?: Clock;
|
|
15
|
+
}
|
|
16
|
+
/** A token that verified. */
|
|
17
|
+
export interface VerifiedToken<T = unknown> {
|
|
18
|
+
/** The payload, as it was signed (a JSON round trip). */
|
|
19
|
+
readonly payload: T;
|
|
20
|
+
/** The instant the token stops verifying. */
|
|
21
|
+
readonly expiresAt: Date;
|
|
22
|
+
/** The id of the key that signed it. */
|
|
23
|
+
readonly keyId: string;
|
|
24
|
+
/** `true` when it was signed under another key than the first: sign it again. */
|
|
25
|
+
readonly needsResign: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Signs `payload` (any JSON value) under the first key, for `purpose`, valid
|
|
29
|
+
* for `expiresIn`. Throws a `TypeError` for a wiring mistake: no key, a badly
|
|
30
|
+
* formed key or purpose, a duration that is not above zero, a payload JSON
|
|
31
|
+
* cannot carry.
|
|
32
|
+
*/
|
|
33
|
+
export declare function signToken(keys: readonly SealingKey[], purpose: string, payload: unknown, options: SignTokenOptions): string;
|
|
34
|
+
/**
|
|
35
|
+
* Verifies `token` for `purpose`: its payload and expiry, or `null` for any
|
|
36
|
+
* failure — another purpose, a changed token, an expired one, a key no longer
|
|
37
|
+
* held, text that is not a token. Never throws for a token; a badly formed
|
|
38
|
+
* key list or purpose is a `TypeError`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function verifyToken<T = unknown>(keys: readonly SealingKey[], purpose: string, token: string, options?: VerifyTokenOptions): VerifiedToken<T> | null;
|
|
41
|
+
//# sourceMappingURL=signed-token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-token.d.ts","sourceRoot":"","sources":["../../src/auth/signed-token.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAe,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAoB3D,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAChC,kEAAkE;IAClE,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,yDAAyD;IACzD,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CACvB;AAED,iDAAiD;AACjD,MAAM,WAAW,kBAAkB;IAClC,yDAAyD;IACzD,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CACvB;AAED,6BAA6B;AAC7B,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO;IACzC,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iFAAiF;IACjF,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC9B;AAqBD;;;;;GAKG;AACH,wBAAgB,SAAS,CACxB,IAAI,EAAE,SAAS,UAAU,EAAE,EAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,gBAAgB,GACvB,MAAM,CAsBR;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,EACtC,IAAI,EAAE,SAAS,UAAU,EAAE,EAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,kBAAuB,GAC9B,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAuCzB"}
|
|
@@ -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;
|
|
47
50
|
session: import("..").Session;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finish.d.ts","sourceRoot":"","sources":["../../../src/auth/social/finish.ts"],"names":[],"mappings":"AAAA,uFAAu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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,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,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|
|
@@ -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"}
|