@authowl/core 0.20.0 → 0.21.1
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/dist/chunk-5NL5GJW6.js +1 -0
- package/dist/chunk-GFSJFTD7.js +1 -0
- package/dist/chunk-MW6RNUTR.js +1 -0
- package/dist/{client-N1yD-Tvm.d.cts → client-BRDFS1ln.d.cts} +125 -59
- package/dist/{client-C76hiQOA.d.ts → client-DhUE4JL1.d.ts} +125 -59
- package/dist/cookie-BqcfagTw.d.cts +30 -0
- package/dist/cookie-BqcfagTw.d.ts +30 -0
- package/dist/idempotency-DmDFUS3e.d.ts +61 -0
- package/dist/idempotency-kuv3HQVN.d.cts +61 -0
- package/dist/{index-hIdXOzRp.d.ts → index-DgVPDEYx.d.cts} +1 -1
- package/dist/{index-hIdXOzRp.d.cts → index-DgVPDEYx.d.ts} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +7 -8
- package/dist/index.d.ts +7 -8
- package/dist/index.js +3 -3
- package/dist/messages.cjs +1 -1
- package/dist/messages.d.cts +41 -2
- package/dist/messages.d.ts +41 -2
- package/dist/messages.js +1 -1
- package/dist/native.cjs +2 -2
- package/dist/native.d.cts +9 -4
- package/dist/native.d.ts +9 -4
- package/dist/native.js +1 -1
- package/dist/{organization-membership-B05mzhtA.d.cts → organization-membership-DSqmZLkN.d.cts} +1 -30
- package/dist/{organization-membership-B05mzhtA.d.ts → organization-membership-DSqmZLkN.d.ts} +1 -30
- package/dist/privacy.cjs +1 -0
- package/dist/privacy.d.cts +24 -0
- package/dist/privacy.d.ts +24 -0
- package/dist/privacy.js +1 -0
- package/dist/server.d.cts +3 -2
- package/dist/server.d.ts +3 -2
- package/package.json +12 -2
- package/dist/chunk-KZCWYFAX.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ResolvedAuthConfig, H as HasParams, O as OrganizationMembership } from './organization-membership-
|
|
1
|
+
import { R as ResolvedAuthConfig, H as HasParams, O as OrganizationMembership } from './organization-membership-DSqmZLkN.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The organization invitation an emailed link is asking this browser to accept.
|
|
@@ -71,7 +71,11 @@ type PublicConfig = {
|
|
|
71
71
|
environmentId: string;
|
|
72
72
|
/** Environment class that determines key prefixes and billing treatment. */
|
|
73
73
|
environmentType: EnvironmentType;
|
|
74
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Authentication endpoint used by this SDK instance. Hosted portals and
|
|
76
|
+
* custom domains keep this same-origin even when the stable JWT issuer uses
|
|
77
|
+
* the platform's canonical origin.
|
|
78
|
+
*/
|
|
75
79
|
authBaseUrl: string;
|
|
76
80
|
/**
|
|
77
81
|
* Public acquisition mode. Optional only for rolling compatibility with
|
|
@@ -174,6 +178,50 @@ type PublicConfig = {
|
|
|
174
178
|
version: number;
|
|
175
179
|
required: boolean;
|
|
176
180
|
};
|
|
181
|
+
/** Published, bilingual privacy notices and optional consent purposes. */
|
|
182
|
+
privacy?: {
|
|
183
|
+
notices: Array<{
|
|
184
|
+
noticeId: string;
|
|
185
|
+
noticeVersionId: string;
|
|
186
|
+
code: string;
|
|
187
|
+
version: number;
|
|
188
|
+
title: {
|
|
189
|
+
en: string;
|
|
190
|
+
ar: string;
|
|
191
|
+
};
|
|
192
|
+
body: {
|
|
193
|
+
en: string;
|
|
194
|
+
ar: string;
|
|
195
|
+
};
|
|
196
|
+
digest: {
|
|
197
|
+
en: string;
|
|
198
|
+
ar: string;
|
|
199
|
+
};
|
|
200
|
+
activityCodes: string[];
|
|
201
|
+
purposeCodes: string[];
|
|
202
|
+
effectiveFrom: string;
|
|
203
|
+
}>;
|
|
204
|
+
consentPurposes: Array<{
|
|
205
|
+
purposeId: string;
|
|
206
|
+
purposeVersionId: string;
|
|
207
|
+
code: string;
|
|
208
|
+
version: number;
|
|
209
|
+
title: {
|
|
210
|
+
en: string;
|
|
211
|
+
ar: string;
|
|
212
|
+
};
|
|
213
|
+
description: {
|
|
214
|
+
en: string;
|
|
215
|
+
ar: string;
|
|
216
|
+
};
|
|
217
|
+
digest: {
|
|
218
|
+
en: string;
|
|
219
|
+
ar: string;
|
|
220
|
+
};
|
|
221
|
+
activityCodes: string[];
|
|
222
|
+
dataCategories: string[];
|
|
223
|
+
}>;
|
|
224
|
+
};
|
|
177
225
|
/**
|
|
178
226
|
* Whether the project lets signed-in users enrol a second factor (TOTP). A
|
|
179
227
|
* capability flag, not a sign-in method (so it's absent from `enabledMethods`):
|
|
@@ -199,8 +247,8 @@ type PublicConfig = {
|
|
|
199
247
|
* JWT issuer (server contract CONTRACTS §8). Non-null only when the project's
|
|
200
248
|
* issuer toggle is on: exactly what a third-party verifier needs (Convex
|
|
201
249
|
* `auth.config.ts` = `{ type: "customJwt", issuer, jwks: jwksUrl,
|
|
202
|
-
* applicationID: aud, algorithm: "ES256" }`).
|
|
203
|
-
*
|
|
250
|
+
* applicationID: aud, algorithm: "ES256" }`). The issuer remains stable when
|
|
251
|
+
* `authBaseUrl` follows a hosted or custom account-portal origin.
|
|
204
252
|
*/
|
|
205
253
|
jwtIssuer: {
|
|
206
254
|
issuer: string;
|
|
@@ -230,38 +278,6 @@ type PublicConfig = {
|
|
|
230
278
|
*/
|
|
231
279
|
declare function getPublicConfig(config: ResolvedAuthConfig): Promise<PublicConfig>;
|
|
232
280
|
|
|
233
|
-
/** One compatibility boundary for project-controlled authentication UI. */
|
|
234
|
-
type ProjectCapabilities = {
|
|
235
|
-
emailSignUp: boolean;
|
|
236
|
-
passwordSignUp: boolean;
|
|
237
|
-
phoneSignUp: boolean;
|
|
238
|
-
passwordSignIn: boolean;
|
|
239
|
-
passwordMinLength: number;
|
|
240
|
-
passwordMaxLength: number;
|
|
241
|
-
magicLinkSignIn: boolean;
|
|
242
|
-
emailOtpSignIn: boolean;
|
|
243
|
-
phoneSignIn: boolean;
|
|
244
|
-
usernameSignIn: boolean;
|
|
245
|
-
collectUsername: boolean;
|
|
246
|
-
passkeySignIn: boolean;
|
|
247
|
-
passkeyAdd: boolean;
|
|
248
|
-
firstLastName: boolean;
|
|
249
|
-
emailChange: boolean;
|
|
250
|
-
accountDeletion: boolean;
|
|
251
|
-
emailVerificationRequired: boolean;
|
|
252
|
-
emailVerificationMethod: 'link' | 'code';
|
|
253
|
-
totp: boolean;
|
|
254
|
-
mfaRequired: boolean;
|
|
255
|
-
backupCodes: boolean;
|
|
256
|
-
/** Preserve the pre-plan-35 display-name field only for an older server. */
|
|
257
|
-
legacyNameField: boolean;
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* Resolve current and legacy public-config shapes once, rather than spreading
|
|
261
|
-
* compatibility checks through each platform's components.
|
|
262
|
-
*/
|
|
263
|
-
declare function resolveProjectCapabilities(config: PublicConfig | null): ProjectCapabilities;
|
|
264
|
-
|
|
265
281
|
/** Legal-consent status for the signed-in user (server contract: `GET /consent`). */
|
|
266
282
|
type ConsentStatus = {
|
|
267
283
|
/** Whether the project has an active consent gate at all. */
|
|
@@ -331,28 +347,6 @@ type TokenClient = {
|
|
|
331
347
|
*/
|
|
332
348
|
declare function createTokenClient(config: ResolvedAuthConfig): TokenClient;
|
|
333
349
|
|
|
334
|
-
declare const AUTH_CHALLENGE_HEADER = "x-authowl-turnstile-token";
|
|
335
|
-
/**
|
|
336
|
-
* The language this request is being conducted in.
|
|
337
|
-
*
|
|
338
|
-
* Advisory: a server that does not know it ignores it, and one that does
|
|
339
|
-
* falls back to the project default for anything it has no catalogue for.
|
|
340
|
-
*/
|
|
341
|
-
declare const AUTH_LOCALE_HEADER = "x-authowl-locale";
|
|
342
|
-
type ResponseDecoder<T> = (value: unknown) => T;
|
|
343
|
-
type AuthHttpRequest<T = unknown> = {
|
|
344
|
-
method?: 'GET' | 'POST' | 'PATCH';
|
|
345
|
-
body?: unknown;
|
|
346
|
-
query?: Record<string, string | number | boolean | undefined>;
|
|
347
|
-
fetchOptions?: ActionFetchOptions;
|
|
348
|
-
decode?: ResponseDecoder<T>;
|
|
349
|
-
credentials?: RequestCredentials;
|
|
350
|
-
};
|
|
351
|
-
interface AuthHttpClient {
|
|
352
|
-
request<T>(path: string, options?: AuthHttpRequest<T>): Promise<AuthActionResult<T>>;
|
|
353
|
-
}
|
|
354
|
-
declare function createAuthHttpClient(config: ResolvedAuthConfig, baseURL?: string): AuthHttpClient;
|
|
355
|
-
|
|
356
350
|
type JsonPrimitive = string | number | boolean | null;
|
|
357
351
|
type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
358
352
|
type JsonObject = {
|
|
@@ -801,6 +795,58 @@ interface OrganizationClient {
|
|
|
801
795
|
}): boolean;
|
|
802
796
|
}
|
|
803
797
|
|
|
798
|
+
type PrivacyLocale = 'en' | 'ar';
|
|
799
|
+
type PrivacyConsentState = 'granted' | 'refused' | 'withdrawn';
|
|
800
|
+
type PrivacyRightType = 'access' | 'correction' | 'portability' | 'erasure' | 'restriction' | 'objection' | 'consent_withdrawal';
|
|
801
|
+
type PrivacyRightState = 'received' | 'identity_pending' | 'in_progress' | 'restricted' | 'completed' | 'denied' | 'withdrawn';
|
|
802
|
+
interface PrivacyConsentPreference {
|
|
803
|
+
purposeId: string;
|
|
804
|
+
purposeVersionId: string;
|
|
805
|
+
code: string;
|
|
806
|
+
state: PrivacyConsentState | null;
|
|
807
|
+
updatedAt: Date | null;
|
|
808
|
+
decidedAt: Date | null;
|
|
809
|
+
}
|
|
810
|
+
interface PrivacyRightsRequest {
|
|
811
|
+
id: string;
|
|
812
|
+
rightType: PrivacyRightType;
|
|
813
|
+
state: PrivacyRightState;
|
|
814
|
+
locale: PrivacyLocale;
|
|
815
|
+
receivedAt: Date;
|
|
816
|
+
acknowledgedAt: Date | null;
|
|
817
|
+
fulfilmentDeadline: Date;
|
|
818
|
+
completedAt: Date | null;
|
|
819
|
+
}
|
|
820
|
+
interface RecordPrivacyConsentOptions {
|
|
821
|
+
purposeCode: string;
|
|
822
|
+
purposeVersionId: string;
|
|
823
|
+
noticeVersionId: string;
|
|
824
|
+
decision: PrivacyConsentState;
|
|
825
|
+
locale: PrivacyLocale;
|
|
826
|
+
/** Stable retry key. A secure UUID is generated when omitted. */
|
|
827
|
+
correlationId?: string;
|
|
828
|
+
}
|
|
829
|
+
interface CreatePrivacyRightsRequestOptions {
|
|
830
|
+
rightType: PrivacyRightType;
|
|
831
|
+
locale: PrivacyLocale;
|
|
832
|
+
}
|
|
833
|
+
interface PrivacyClient {
|
|
834
|
+
listConsentPreferences(fetchOptions?: ActionFetchOptions): Promise<AuthActionResult<{
|
|
835
|
+
preferences: PrivacyConsentPreference[];
|
|
836
|
+
}>>;
|
|
837
|
+
recordConsent(params: RecordPrivacyConsentOptions, fetchOptions?: ActionFetchOptions): Promise<AuthActionResult<{
|
|
838
|
+
recorded: true;
|
|
839
|
+
decision: PrivacyConsentState;
|
|
840
|
+
decidedAt: Date;
|
|
841
|
+
}>>;
|
|
842
|
+
listRightsRequests(fetchOptions?: ActionFetchOptions): Promise<AuthActionResult<{
|
|
843
|
+
requests: PrivacyRightsRequest[];
|
|
844
|
+
}>>;
|
|
845
|
+
createRightsRequest(params: CreatePrivacyRightsRequestOptions, fetchOptions?: ActionFetchOptions): Promise<AuthActionResult<{
|
|
846
|
+
request: PrivacyRightsRequest;
|
|
847
|
+
}>>;
|
|
848
|
+
}
|
|
849
|
+
|
|
804
850
|
/**
|
|
805
851
|
* The narrow, portable surface of the underlying auth client that this SDK
|
|
806
852
|
* depends on and re-exports.
|
|
@@ -1040,6 +1086,24 @@ interface EmailSignUpOptions {
|
|
|
1040
1086
|
* this automatically when it renders the consent checkbox.
|
|
1041
1087
|
*/
|
|
1042
1088
|
consentVersion?: number;
|
|
1089
|
+
/**
|
|
1090
|
+
* Exact published notice versions rendered by the sign-up surface, together
|
|
1091
|
+
* with purpose-specific choices. Current <SignUp/> builds this from public
|
|
1092
|
+
* config automatically; headless clients should echo the same projection.
|
|
1093
|
+
*/
|
|
1094
|
+
privacyEvidence?: {
|
|
1095
|
+
locale: 'en' | 'ar';
|
|
1096
|
+
correlationId: string;
|
|
1097
|
+
noticeVersionIds: string[];
|
|
1098
|
+
consentDecisions: Array<{
|
|
1099
|
+
purposeCode: string;
|
|
1100
|
+
purposeVersionId: string;
|
|
1101
|
+
noticeVersionId: string;
|
|
1102
|
+
decision: 'granted' | 'refused';
|
|
1103
|
+
guardianRequired: boolean;
|
|
1104
|
+
guardianEvidenceId: string | null;
|
|
1105
|
+
}>;
|
|
1106
|
+
};
|
|
1043
1107
|
}
|
|
1044
1108
|
interface WaitlistJoinOptions {
|
|
1045
1109
|
email: string;
|
|
@@ -1390,6 +1454,8 @@ interface AuthOwlClient {
|
|
|
1390
1454
|
account: AccountClient;
|
|
1391
1455
|
/** Signed-in organization, membership, role, and invitation actions. */
|
|
1392
1456
|
organization: OrganizationClient;
|
|
1457
|
+
/** Signed-in privacy preferences and data-subject-rights actions. */
|
|
1458
|
+
privacy: PrivacyClient;
|
|
1393
1459
|
signIn: {
|
|
1394
1460
|
/**
|
|
1395
1461
|
* Email + password sign-in. For a two-factor-enrolled user the result is a
|
|
@@ -1521,4 +1587,4 @@ interface AuthOwlClient {
|
|
|
1521
1587
|
*/
|
|
1522
1588
|
declare function createAuthOwlClient(config: ResolvedAuthConfig): AuthOwlClient;
|
|
1523
1589
|
|
|
1524
|
-
export { type
|
|
1590
|
+
export { type EmailAuthData as $, type ActionFetchOptions as A, type AccountClient as B, type CreatePrivacyRightsRequestOptions as C, type AccountSession as D, type AccountStatusData as E, type AddOrganizationTeamMemberOptions as F, type AuthErrorContext as G, type AuthOwlErrorCode as H, type AuthRequestContext as I, type AuthResponseContext as J, type ChangeEmailOptions as K, type ChangePasswordData as L, type ChangePasswordOptions as M, type ConsentAcceptResult as N, type Organization as O, type PublicConfig as P, type ConsentStatus as Q, type RecordPrivacyConsentOptions as R, type SocialIdTokenOptions as S, type CreateOrganizationOptions as T, type CreateOrganizationTeamOptions as U, type DeleteAccountData as V, type DeleteAccountOptions as W, type DeleteOrganizationOptions as X, type DeletePasskeyData as Y, type DeletePasskeyOptions as Z, type DisableTwoFactorOptions as _, type AuthActionResult as a, type SendTwoFactorOtpOptions as a$, type EmailOtpAuthData as a0, type EmailOtpSignInOptions as a1, type EmailOtpType as a2, type EmailSignInOptions as a3, type EmailSignUpData as a4, type EmailSignUpOptions as a5, type EnableTwoFactorOptions as a6, type EnvironmentType as a7, type GenerateBackupCodesOptions as a8, type GetOrganizationInvitationOptions as a9, type OrganizationMember as aA, type OrganizationMemberUser as aB, type OrganizationMemberWithUser as aC, type OrganizationMembersData as aD, type OrganizationRoleSummary as aE, type OrganizationSelector as aF, type OrganizationTeam as aG, type OrganizationTeamMember as aH, type OrganizationUserInvitation as aI, type PasswordResetData as aJ, type PhoneAuthUser as aK, type PhoneOtpStartData as aL, type PhoneOtpStartOptions as aM, type PhoneOtpVerifyData as aN, type PhoneOtpVerifyOptions as aO, type RejectOrganizationInvitationData as aP, type RemoveOrganizationMemberData as aQ, type RemoveOrganizationMemberOptions as aR, type RemoveOrganizationTeamData as aS, type RemoveOrganizationTeamMemberData as aT, type RemoveOrganizationTeamMemberOptions as aU, type RemoveOrganizationTeamOptions as aV, type RequestPasswordResetOptions as aW, type ResetPasswordOptions as aX, type RevokeSessionOptions as aY, type SendOtpData as aZ, type SendTwoFactorOtpData as a_, type GetOrganizationOptions as aa, type GetToken as ab, type GetTokenOptions as ac, INVITATION_CLAIM_MAX_AGE_MS as ad, INVITATION_QUERY_PARAM as ae, type InvitationClaim as af, type InvitationRecipientHint as ag, type InviteOrganizationMemberOptions as ah, type JsonObject as ai, type JsonPrimitive as aj, type JsonValue as ak, type LeaveOrganizationOptions as al, type LinkSocialData as am, type LinkSocialOptions as an, type ListOrganizationInvitationsOptions as ao, type ListOrganizationMembersOptions as ap, type ListOrganizationRolesOptions as aq, type ListOrganizationTeamMembersOptions as ar, type ListOrganizationTeamsOptions as as, type MagicLinkData as at, type MagicLinkSignInOptions as au, type OrganizationFilterOperator as av, type OrganizationInvitation as aw, type OrganizationInvitationActionOptions as ax, type OrganizationInvitationDetails as ay, type OrganizationInvitationStatus as az, type AuthOwlClient as b, type SendVerificationOtpOptions as b0, type SetActiveTeamOptions as b1, type SignOutData as b2, type SocialAccount as b3, type SocialSignInOptions as b4, type TokenClient as b5, type TwoFactorBackupCodesData as b6, type TwoFactorEnableData as b7, type TwoFactorRedirectData as b8, type TwoFactorStatusData as b9, type TwoFactorVerifyData as ba, type UnlinkSocialOptions as bb, type UpdateOrganizationMemberRoleOptions as bc, type UpdateOrganizationOptions as bd, type UpdateOrganizationTeamOptions as be, type UpdatePasskeyData as bf, type UpdatePasskeyOptions as bg, type UpdateProfileOptions as bh, type UpdateUnsafeMetadataOptions as bi, type UserMetadata as bj, type UsernameSignInOptions as bk, type VerifyBackupCodeOptions as bl, type VerifyEmailOtpData as bm, type VerifyEmailOtpOptions as bn, type VerifyTotpOptions as bo, type VerifyTwoFactorOtpOptions as bp, type WaitlistJoinData as bq, type WaitlistJoinOptions as br, acceptConsent as bs, captureInvitationClaim as bt, clearInvitationClaim as bu, createAuthOwlClient as bv, createTokenClient as bw, getConsentStatus as bx, readInvitationClaim as by, type PasskeySignInOptions as c, type PasskeyAuthData as d, type AddPasskeyOptions as e, type AuthPasskey as f, type AuthClientError as g, type AuthSession as h, type AuthUser as i, type OrganizationClient as j, type OrganizationDetails as k, type PrivacyClient as l, type PrivacyConsentPreference as m, type PrivacyConsentState as n, type PrivacyLocale as o, type PrivacyRightState as p, type PrivacyRightType as q, type PrivacyRightsRequest as r, type SessionState as s, type SessionStore as t, type SetActiveOrganizationOptions as u, type SocialAuthData as v, getPublicConfig as w, type PhoneOtpChallengeData as x, type AkedlyShieldStartProof as y, type AcceptOrganizationInvitationData as z };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The exact session-cookie name the auth server sets for a given project.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the cookie name across the SDK. The server
|
|
5
|
+
* (the AuthOwl server project factory) configures
|
|
6
|
+
* `advanced.cookiePrefix = "p_" + <projectId without dashes>` and
|
|
7
|
+
* `useSecureCookies` in production; the auth engine then names the session
|
|
8
|
+
* cookie `${securePrefix}${cookiePrefix}.session_token`, where `securePrefix`
|
|
9
|
+
* is `__Secure-` for secure cookies and empty otherwise:
|
|
10
|
+
*
|
|
11
|
+
* dev (http): p_<idNoDashes>.session_token
|
|
12
|
+
* prod (https): __Secure-p_<idNoDashes>.session_token
|
|
13
|
+
*
|
|
14
|
+
* Verified 2026-07-06 against the auth engine's `getCookies()` with the server's
|
|
15
|
+
* real config (see CONTRACTS section 5 and `cookie.test.ts`). Note the engine
|
|
16
|
+
* joins the prefix and name with a dot (`.`), not an underscore, and uses the
|
|
17
|
+
* `__Secure-` (not `__Host-`) prefix - both are easy to get wrong by hand, and
|
|
18
|
+
* getting them wrong makes `auth()` forward a cookie the server never set. If an
|
|
19
|
+
* auth-engine upgrade changes cookie naming, re-verify and update this function,
|
|
20
|
+
* the `cookie.test.ts` fixtures, and CONTRACTS section 5 together.
|
|
21
|
+
*
|
|
22
|
+
* `secure` must reflect the SERVER's cookie mode: callers holding the auth API
|
|
23
|
+
* URL derive it from the protocol (`https:` => secure). Callers that cannot
|
|
24
|
+
* know it (the UX-only redirect middleware) should check both variants.
|
|
25
|
+
*/
|
|
26
|
+
declare function sessionCookieName(projectId: string, opts?: {
|
|
27
|
+
secure?: boolean;
|
|
28
|
+
}): string;
|
|
29
|
+
|
|
30
|
+
export { sessionCookieName as s };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The exact session-cookie name the auth server sets for a given project.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the cookie name across the SDK. The server
|
|
5
|
+
* (the AuthOwl server project factory) configures
|
|
6
|
+
* `advanced.cookiePrefix = "p_" + <projectId without dashes>` and
|
|
7
|
+
* `useSecureCookies` in production; the auth engine then names the session
|
|
8
|
+
* cookie `${securePrefix}${cookiePrefix}.session_token`, where `securePrefix`
|
|
9
|
+
* is `__Secure-` for secure cookies and empty otherwise:
|
|
10
|
+
*
|
|
11
|
+
* dev (http): p_<idNoDashes>.session_token
|
|
12
|
+
* prod (https): __Secure-p_<idNoDashes>.session_token
|
|
13
|
+
*
|
|
14
|
+
* Verified 2026-07-06 against the auth engine's `getCookies()` with the server's
|
|
15
|
+
* real config (see CONTRACTS section 5 and `cookie.test.ts`). Note the engine
|
|
16
|
+
* joins the prefix and name with a dot (`.`), not an underscore, and uses the
|
|
17
|
+
* `__Secure-` (not `__Host-`) prefix - both are easy to get wrong by hand, and
|
|
18
|
+
* getting them wrong makes `auth()` forward a cookie the server never set. If an
|
|
19
|
+
* auth-engine upgrade changes cookie naming, re-verify and update this function,
|
|
20
|
+
* the `cookie.test.ts` fixtures, and CONTRACTS section 5 together.
|
|
21
|
+
*
|
|
22
|
+
* `secure` must reflect the SERVER's cookie mode: callers holding the auth API
|
|
23
|
+
* URL derive it from the protocol (`https:` => secure). Callers that cannot
|
|
24
|
+
* know it (the UX-only redirect middleware) should check both variants.
|
|
25
|
+
*/
|
|
26
|
+
declare function sessionCookieName(projectId: string, opts?: {
|
|
27
|
+
secure?: boolean;
|
|
28
|
+
}): string;
|
|
29
|
+
|
|
30
|
+
export { sessionCookieName as s };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { P as PublicConfig, A as ActionFetchOptions, a as AuthActionResult } from './client-DhUE4JL1.js';
|
|
2
|
+
import { R as ResolvedAuthConfig } from './organization-membership-DSqmZLkN.js';
|
|
3
|
+
|
|
4
|
+
/** One compatibility boundary for project-controlled authentication UI. */
|
|
5
|
+
type ProjectCapabilities = {
|
|
6
|
+
emailSignUp: boolean;
|
|
7
|
+
passwordSignUp: boolean;
|
|
8
|
+
phoneSignUp: boolean;
|
|
9
|
+
passwordSignIn: boolean;
|
|
10
|
+
passwordMinLength: number;
|
|
11
|
+
passwordMaxLength: number;
|
|
12
|
+
magicLinkSignIn: boolean;
|
|
13
|
+
emailOtpSignIn: boolean;
|
|
14
|
+
phoneSignIn: boolean;
|
|
15
|
+
usernameSignIn: boolean;
|
|
16
|
+
collectUsername: boolean;
|
|
17
|
+
passkeySignIn: boolean;
|
|
18
|
+
passkeyAdd: boolean;
|
|
19
|
+
firstLastName: boolean;
|
|
20
|
+
emailChange: boolean;
|
|
21
|
+
accountDeletion: boolean;
|
|
22
|
+
emailVerificationRequired: boolean;
|
|
23
|
+
emailVerificationMethod: 'link' | 'code';
|
|
24
|
+
totp: boolean;
|
|
25
|
+
mfaRequired: boolean;
|
|
26
|
+
backupCodes: boolean;
|
|
27
|
+
/** Preserve the pre-plan-35 display-name field only for an older server. */
|
|
28
|
+
legacyNameField: boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Resolve current and legacy public-config shapes once, rather than spreading
|
|
32
|
+
* compatibility checks through each platform's components.
|
|
33
|
+
*/
|
|
34
|
+
declare function resolveProjectCapabilities(config: PublicConfig | null): ProjectCapabilities;
|
|
35
|
+
|
|
36
|
+
declare const AUTH_CHALLENGE_HEADER = "x-authowl-turnstile-token";
|
|
37
|
+
/**
|
|
38
|
+
* The language this request is being conducted in.
|
|
39
|
+
*
|
|
40
|
+
* Advisory: a server that does not know it ignores it, and one that does
|
|
41
|
+
* falls back to the project default for anything it has no catalogue for.
|
|
42
|
+
*/
|
|
43
|
+
declare const AUTH_LOCALE_HEADER = "x-authowl-locale";
|
|
44
|
+
type ResponseDecoder<T> = (value: unknown) => T;
|
|
45
|
+
type AuthHttpRequest<T = unknown> = {
|
|
46
|
+
method?: 'GET' | 'POST' | 'PATCH';
|
|
47
|
+
body?: unknown;
|
|
48
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
49
|
+
fetchOptions?: ActionFetchOptions;
|
|
50
|
+
decode?: ResponseDecoder<T>;
|
|
51
|
+
credentials?: RequestCredentials;
|
|
52
|
+
};
|
|
53
|
+
interface AuthHttpClient {
|
|
54
|
+
request<T>(path: string, options?: AuthHttpRequest<T>): Promise<AuthActionResult<T>>;
|
|
55
|
+
}
|
|
56
|
+
declare function createAuthHttpClient(config: ResolvedAuthConfig, baseURL?: string): AuthHttpClient;
|
|
57
|
+
|
|
58
|
+
/** Create a cryptographically random RFC 4122 v4 key for retry-safe write actions. */
|
|
59
|
+
declare function createIdempotencyKey(): string;
|
|
60
|
+
|
|
61
|
+
export { type AuthHttpClient as A, type ProjectCapabilities as P, createIdempotencyKey as a, AUTH_CHALLENGE_HEADER as b, createAuthHttpClient as c, AUTH_LOCALE_HEADER as d, resolveProjectCapabilities as r };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { P as PublicConfig, A as ActionFetchOptions, a as AuthActionResult } from './client-BRDFS1ln.cjs';
|
|
2
|
+
import { R as ResolvedAuthConfig } from './organization-membership-DSqmZLkN.cjs';
|
|
3
|
+
|
|
4
|
+
/** One compatibility boundary for project-controlled authentication UI. */
|
|
5
|
+
type ProjectCapabilities = {
|
|
6
|
+
emailSignUp: boolean;
|
|
7
|
+
passwordSignUp: boolean;
|
|
8
|
+
phoneSignUp: boolean;
|
|
9
|
+
passwordSignIn: boolean;
|
|
10
|
+
passwordMinLength: number;
|
|
11
|
+
passwordMaxLength: number;
|
|
12
|
+
magicLinkSignIn: boolean;
|
|
13
|
+
emailOtpSignIn: boolean;
|
|
14
|
+
phoneSignIn: boolean;
|
|
15
|
+
usernameSignIn: boolean;
|
|
16
|
+
collectUsername: boolean;
|
|
17
|
+
passkeySignIn: boolean;
|
|
18
|
+
passkeyAdd: boolean;
|
|
19
|
+
firstLastName: boolean;
|
|
20
|
+
emailChange: boolean;
|
|
21
|
+
accountDeletion: boolean;
|
|
22
|
+
emailVerificationRequired: boolean;
|
|
23
|
+
emailVerificationMethod: 'link' | 'code';
|
|
24
|
+
totp: boolean;
|
|
25
|
+
mfaRequired: boolean;
|
|
26
|
+
backupCodes: boolean;
|
|
27
|
+
/** Preserve the pre-plan-35 display-name field only for an older server. */
|
|
28
|
+
legacyNameField: boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Resolve current and legacy public-config shapes once, rather than spreading
|
|
32
|
+
* compatibility checks through each platform's components.
|
|
33
|
+
*/
|
|
34
|
+
declare function resolveProjectCapabilities(config: PublicConfig | null): ProjectCapabilities;
|
|
35
|
+
|
|
36
|
+
declare const AUTH_CHALLENGE_HEADER = "x-authowl-turnstile-token";
|
|
37
|
+
/**
|
|
38
|
+
* The language this request is being conducted in.
|
|
39
|
+
*
|
|
40
|
+
* Advisory: a server that does not know it ignores it, and one that does
|
|
41
|
+
* falls back to the project default for anything it has no catalogue for.
|
|
42
|
+
*/
|
|
43
|
+
declare const AUTH_LOCALE_HEADER = "x-authowl-locale";
|
|
44
|
+
type ResponseDecoder<T> = (value: unknown) => T;
|
|
45
|
+
type AuthHttpRequest<T = unknown> = {
|
|
46
|
+
method?: 'GET' | 'POST' | 'PATCH';
|
|
47
|
+
body?: unknown;
|
|
48
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
49
|
+
fetchOptions?: ActionFetchOptions;
|
|
50
|
+
decode?: ResponseDecoder<T>;
|
|
51
|
+
credentials?: RequestCredentials;
|
|
52
|
+
};
|
|
53
|
+
interface AuthHttpClient {
|
|
54
|
+
request<T>(path: string, options?: AuthHttpRequest<T>): Promise<AuthActionResult<T>>;
|
|
55
|
+
}
|
|
56
|
+
declare function createAuthHttpClient(config: ResolvedAuthConfig, baseURL?: string): AuthHttpClient;
|
|
57
|
+
|
|
58
|
+
/** Create a cryptographically random RFC 4122 v4 key for retry-safe write actions. */
|
|
59
|
+
declare function createIdempotencyKey(): string;
|
|
60
|
+
|
|
61
|
+
export { type AuthHttpClient as A, type ProjectCapabilities as P, createIdempotencyKey as a, AUTH_CHALLENGE_HEADER as b, createAuthHttpClient as c, AUTH_LOCALE_HEADER as d, resolveProjectCapabilities as r };
|
|
@@ -12,4 +12,4 @@ declare function directionFor(locale: Locale): 'ltr' | 'rtl';
|
|
|
12
12
|
/** Narrow an arbitrary string (e.g. public-config `locale`) to a supported Locale. */
|
|
13
13
|
declare function isLocale(value: unknown): value is Locale;
|
|
14
14
|
|
|
15
|
-
export {
|
|
15
|
+
export { type Locale as L, LOCALES as a, directionFor as d, isLocale as i };
|
|
@@ -12,4 +12,4 @@ declare function directionFor(locale: Locale): 'ltr' | 'rtl';
|
|
|
12
12
|
/** Narrow an arbitrary string (e.g. public-config `locale`) to a supported Locale. */
|
|
13
13
|
declare function isLocale(value: unknown): value is Locale;
|
|
14
14
|
|
|
15
|
-
export {
|
|
15
|
+
export { type Locale as L, LOCALES as a, directionFor as d, isLocale as i };
|