@better-auth/infra 0.4.9 → 0.4.11
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/CHANGELOG.md +17 -1
- package/dist/client.d.mts +3 -3
- package/dist/client.mjs +2 -2
- package/dist/{constants-CdZodAXp.mjs → constants-C82aGVpa.mjs} +1 -1
- package/dist/{crypto-DDadesq-.mjs → crypto-CgNWT4f3.mjs} +1 -1
- package/dist/email.d.mts +12 -13
- package/dist/email.mjs +1 -1
- package/dist/{identify-client-options-DgKA4Eq8.d.mts → identify-client-options-BfGftEgh.d.mts} +1 -1
- package/dist/index.d.mts +36 -17
- package/dist/index.mjs +83 -26
- package/dist/native.d.mts +3 -3
- package/dist/native.mjs +2 -2
- package/dist/{pow-retry-DRUkPcBn.mjs → pow-retry-B5TObAcM.mjs} +1 -1
- package/dist/{types-BkUWsMpe.d.mts → types-sFD6YavS.d.mts} +2 -0
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -5,11 +5,27 @@ All notable changes to `@better-auth/infra` are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0/).
|
|
7
7
|
|
|
8
|
+
## [0.4.11] - 2026-09-23
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`GET /dash/sso/connection-count`** — Project-wide SSO connection count (`{ count }`). Counts `ssoProvider` rows across organizations. Returns `{ count: 0 }` when the organization plugin or SSO plugin is unavailable.
|
|
13
|
+
|
|
14
|
+
## [0.4.10] - 2026-09-21
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **`GET /dash/directory-sync/connection-count`** — Project-wide directory sync connection count (`{ count, mode }`). Managed mode counts `active` / `decommissioning` connections; legacy mode counts `scimProvider` rows. Returns 404 when directory sync is unavailable.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- **Stored vs resolved auth base** — Platform-stored `baseURL` + `basePath` always rejoin (a path on stored `baseURL` no longer overrides a saved `basePath`). Request-scoped mount resolution still follows Better Auth path-in-`baseURL` via `context.baseURL` (dash config, Sentinel).
|
|
23
|
+
|
|
8
24
|
## [0.4.9] - 2026-09-09
|
|
9
25
|
|
|
10
26
|
### Fixed
|
|
11
27
|
|
|
12
|
-
- **Auth base URL
|
|
28
|
+
- **Auth base URL / path** — `GET /dash/config` reports origin + effective mount path when `baseURL` embeds a path or uses dynamic `allowedHosts`. Invitation callbacks, SSO/SCIM endpoint URLs, and Sentinel route matching use the same resolved mount.
|
|
13
29
|
|
|
14
30
|
## [0.4.8] - 2026-09-09
|
|
15
31
|
|
package/dist/client.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DashGetAllAuditLogsInput, i as DashClientOptions, n as DashAuditLog, o as DashGetAuditLogsInput, r as DashAuditLogsResponse, s as dashClient, t as IdentifyClientOptions } from "./identify-client-options-
|
|
1
|
+
import { a as DashGetAllAuditLogsInput, i as DashClientOptions, n as DashAuditLog, o as DashGetAuditLogsInput, r as DashAuditLogsResponse, s as dashClient, t as IdentifyClientOptions } from "./identify-client-options-BfGftEgh.mjs";
|
|
2
2
|
import { BetterFetchPlugin } from "@better-fetch/fetch";
|
|
3
3
|
//#region src/sentinel/client.d.ts
|
|
4
4
|
interface SentinelClientOptions {
|
|
@@ -34,9 +34,9 @@ interface SentinelClientOptions {
|
|
|
34
34
|
*/
|
|
35
35
|
onChallengeFailed?: (error: Error) => void;
|
|
36
36
|
}
|
|
37
|
-
declare const sentinelClient: (options?: SentinelClientOptions) => {
|
|
37
|
+
export declare const sentinelClient: (options?: SentinelClientOptions) => {
|
|
38
38
|
id: "sentinel";
|
|
39
39
|
fetchPlugins: BetterFetchPlugin[];
|
|
40
40
|
};
|
|
41
41
|
//#endregion
|
|
42
|
-
export { type DashAuditLog, type DashAuditLogsResponse, type DashClientOptions, type DashGetAllAuditLogsInput, type DashGetAuditLogsInput, type SentinelClientOptions, dashClient
|
|
42
|
+
export { type DashAuditLog, type DashAuditLogsResponse, type DashClientOptions, type DashGetAllAuditLogsInput, type DashGetAuditLogsInput, type SentinelClientOptions, dashClient };
|
package/dist/client.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as hash, o as createKV } from "./crypto-
|
|
2
|
-
import { a as resolveSentinelClientIdentifyUrl, c as identify, i as solvePoWChallenge, l as dashClient, n as decodePoWChallenge, o as resolveIdentifyClientRetry, r as encodePoWSolution, s as generateRequestId, t as createPowRetryTimeout } from "./pow-retry-
|
|
1
|
+
import { n as hash, o as createKV } from "./crypto-CgNWT4f3.mjs";
|
|
2
|
+
import { a as resolveSentinelClientIdentifyUrl, c as identify, i as solvePoWChallenge, l as dashClient, n as decodePoWChallenge, o as resolveIdentifyClientRetry, r as encodePoWSolution, s as generateRequestId, t as createPowRetryTimeout } from "./pow-retry-B5TObAcM.mjs";
|
|
3
3
|
import { env } from "@better-auth/core/env";
|
|
4
4
|
//#region src/sentinel/fingerprint.ts
|
|
5
5
|
function murmurhash3(str, seed = 0) {
|
package/dist/email.d.mts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Email template definitions with their required variables
|
|
10
10
|
*/
|
|
11
|
-
declare const EMAIL_TEMPLATES: {
|
|
11
|
+
export declare const EMAIL_TEMPLATES: {
|
|
12
12
|
readonly "verify-email": {
|
|
13
13
|
readonly variables: {
|
|
14
14
|
verificationCode?: string;
|
|
@@ -136,14 +136,14 @@ declare const EMAIL_TEMPLATES: {
|
|
|
136
136
|
};
|
|
137
137
|
};
|
|
138
138
|
};
|
|
139
|
-
type EmailTemplateId = keyof typeof EMAIL_TEMPLATES;
|
|
140
|
-
type EmailTemplateVariables<T extends EmailTemplateId> = (typeof EMAIL_TEMPLATES)[T]["variables"];
|
|
141
|
-
interface SendEmailResult {
|
|
139
|
+
export type EmailTemplateId = keyof typeof EMAIL_TEMPLATES;
|
|
140
|
+
export type EmailTemplateVariables<T extends EmailTemplateId> = (typeof EMAIL_TEMPLATES)[T]["variables"];
|
|
141
|
+
export interface SendEmailResult {
|
|
142
142
|
success: boolean;
|
|
143
143
|
messageId?: string;
|
|
144
144
|
error?: string;
|
|
145
145
|
}
|
|
146
|
-
interface EmailConfig {
|
|
146
|
+
export interface EmailConfig {
|
|
147
147
|
apiKey?: string;
|
|
148
148
|
apiUrl?: string;
|
|
149
149
|
/**
|
|
@@ -171,7 +171,7 @@ interface EmailConfig {
|
|
|
171
171
|
/**
|
|
172
172
|
* Type-safe send email options
|
|
173
173
|
*/
|
|
174
|
-
type SendEmailOptions<T extends EmailTemplateId = EmailTemplateId> = {
|
|
174
|
+
export type SendEmailOptions<T extends EmailTemplateId = EmailTemplateId> = {
|
|
175
175
|
/**
|
|
176
176
|
* The template ID to use
|
|
177
177
|
*/
|
|
@@ -192,7 +192,7 @@ type SendEmailOptions<T extends EmailTemplateId = EmailTemplateId> = {
|
|
|
192
192
|
/**
|
|
193
193
|
* Options for sending bulk emails
|
|
194
194
|
*/
|
|
195
|
-
type SendBulkEmailsOptions<T extends EmailTemplateId = EmailTemplateId> = {
|
|
195
|
+
export type SendBulkEmailsOptions<T extends EmailTemplateId = EmailTemplateId> = {
|
|
196
196
|
/**
|
|
197
197
|
* The template ID to use for all emails
|
|
198
198
|
*/
|
|
@@ -216,7 +216,7 @@ type SendBulkEmailsOptions<T extends EmailTemplateId = EmailTemplateId> = {
|
|
|
216
216
|
/**
|
|
217
217
|
* Result of a bulk email send operation
|
|
218
218
|
*/
|
|
219
|
-
interface SendBulkEmailsResult {
|
|
219
|
+
export interface SendBulkEmailsResult {
|
|
220
220
|
success: boolean;
|
|
221
221
|
failures?: Record<string, {
|
|
222
222
|
error?: string;
|
|
@@ -226,7 +226,7 @@ interface SendBulkEmailsResult {
|
|
|
226
226
|
/**
|
|
227
227
|
* Create an email sender instance
|
|
228
228
|
*/
|
|
229
|
-
declare function createEmailSender(config?: EmailConfig): {
|
|
229
|
+
export declare function createEmailSender(config?: EmailConfig): {
|
|
230
230
|
send: <T extends EmailTemplateId>(options: SendEmailOptions<T>) => Promise<SendEmailResult>;
|
|
231
231
|
sendBulk: <T extends EmailTemplateId>(options: SendBulkEmailsOptions<T>) => Promise<SendBulkEmailsResult>;
|
|
232
232
|
getTemplates: () => Promise<{
|
|
@@ -253,7 +253,7 @@ declare function createEmailSender(config?: EmailConfig): {
|
|
|
253
253
|
* });
|
|
254
254
|
* ```
|
|
255
255
|
*/
|
|
256
|
-
declare function sendEmail<T extends EmailTemplateId>(options: SendEmailOptions<T>, config?: EmailConfig): Promise<SendEmailResult>;
|
|
256
|
+
export declare function sendEmail<T extends EmailTemplateId>(options: SendEmailOptions<T>, config?: EmailConfig): Promise<SendEmailResult>;
|
|
257
257
|
/**
|
|
258
258
|
* Send bulk emails using the Better Auth dashboard's email templates.
|
|
259
259
|
*
|
|
@@ -270,6 +270,5 @@ declare function sendEmail<T extends EmailTemplateId>(options: SendEmailOptions<
|
|
|
270
270
|
* });
|
|
271
271
|
* ```
|
|
272
272
|
*/
|
|
273
|
-
declare function sendBulkEmails<T extends EmailTemplateId>(options: SendBulkEmailsOptions<T>, config?: EmailConfig): Promise<SendBulkEmailsResult>;
|
|
274
|
-
//#endregion
|
|
275
|
-
export { EMAIL_TEMPLATES, EmailConfig, EmailTemplateId, EmailTemplateVariables, SendBulkEmailsOptions, SendBulkEmailsResult, SendEmailOptions, SendEmailResult, createEmailSender, sendBulkEmails, sendEmail };
|
|
273
|
+
export declare function sendBulkEmails<T extends EmailTemplateId>(options: SendBulkEmailsOptions<T>, config?: EmailConfig): Promise<SendBulkEmailsResult>;
|
|
274
|
+
//#endregion
|
package/dist/email.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as INFRA_USER_AGENT, n as INFRA_API_URL } from "./constants-
|
|
1
|
+
import { i as INFRA_USER_AGENT, n as INFRA_API_URL } from "./constants-C82aGVpa.mjs";
|
|
2
2
|
import { logger } from "better-auth";
|
|
3
3
|
import { env } from "@better-auth/core/env";
|
|
4
4
|
import { createFetch } from "@better-fetch/fetch";
|
package/dist/{identify-client-options-DgKA4Eq8.d.mts → identify-client-options-BfGftEgh.d.mts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as KvRetryOptions } from "./types-
|
|
1
|
+
import { g as KvRetryOptions } from "./types-sFD6YavS.mjs";
|
|
2
2
|
import { BetterAuthClientOptions, ClientStore } from "better-auth";
|
|
3
3
|
import { BetterFetch } from "@better-fetch/fetch";
|
|
4
4
|
//#region src/dash-client.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as SecurityOptions, C as createAuthMiddleware, D as ImpossibleTravelResult, E as CredentialStuffingResult, M as StaleUserResult, N as ThresholdConfig, O as SecurityEvent, S as asInfraContext, T as CompromisedPasswordResult, _ as KvRetryOptionsResolved, a as DashOptionsInternal, b as SentinelOptions, c as EndpointOptions, d as InfraEndpointContextValue, f as InfraPluginConnectionOptions, g as KvRetryOptions, h as KvOptionsResolved, i as DashOptions, j as SecurityVerdict, k as SecurityEventType, l as InfraAuthContext, m as KvOptions, n as ApiOptions, o as DashOptionsResolved, p as InfraPluginConnectionOptionsInternal, r as ApiOptionsResolved, s as Endpoint, t as APIError, u as InfraEndpointContext, v as LocationData, w as sentinel, x as SentinelOptionsInternal, y as LocationDataContext } from "./types-
|
|
1
|
+
import { A as SecurityOptions, C as createAuthMiddleware, D as ImpossibleTravelResult, E as CredentialStuffingResult, M as StaleUserResult, N as ThresholdConfig, O as SecurityEvent, S as asInfraContext, T as CompromisedPasswordResult, _ as KvRetryOptionsResolved, a as DashOptionsInternal, b as SentinelOptions, c as EndpointOptions, d as InfraEndpointContextValue, f as InfraPluginConnectionOptions, g as KvRetryOptions, h as KvOptionsResolved, i as DashOptions, j as SecurityVerdict, k as SecurityEventType, l as InfraAuthContext, m as KvOptions, n as ApiOptions, o as DashOptionsResolved, p as InfraPluginConnectionOptionsInternal, r as ApiOptionsResolved, s as Endpoint, t as APIError, u as InfraEndpointContext, v as LocationData, w as sentinel, x as SentinelOptionsInternal, y as LocationDataContext } from "./types-sFD6YavS.mjs";
|
|
2
2
|
import { EMAIL_TEMPLATES, EmailConfig, EmailTemplateId, EmailTemplateVariables, SendBulkEmailsOptions, SendBulkEmailsResult, SendEmailOptions, SendEmailResult, createEmailSender, sendBulkEmails, sendEmail } from "./email.mjs";
|
|
3
3
|
import { Account, AuthContext, GenericEndpointContext, Session, User } from "better-auth";
|
|
4
4
|
import z from "zod";
|
|
@@ -30,26 +30,26 @@ interface PoWSolution {
|
|
|
30
30
|
counter: number;
|
|
31
31
|
}
|
|
32
32
|
/** Default difficulty in bits (18 = ~500ms solve time) */
|
|
33
|
-
declare const DEFAULT_DIFFICULTY = 18;
|
|
33
|
+
export declare const DEFAULT_DIFFICULTY = 18;
|
|
34
34
|
/** Challenge TTL in seconds */
|
|
35
|
-
declare const CHALLENGE_TTL = 60;
|
|
35
|
+
export declare const CHALLENGE_TTL = 60;
|
|
36
36
|
/**
|
|
37
37
|
* Solve a PoW challenge (browser-compatible)
|
|
38
38
|
* This function is designed to run in a browser environment
|
|
39
39
|
*/
|
|
40
|
-
declare function solvePoWChallenge(challenge: PoWChallenge): Promise<PoWSolution>;
|
|
40
|
+
export declare function solvePoWChallenge(challenge: PoWChallenge): Promise<PoWSolution>;
|
|
41
41
|
/**
|
|
42
42
|
* Decode a base64-encoded challenge string (browser-compatible)
|
|
43
43
|
*/
|
|
44
|
-
declare function decodePoWChallenge(encoded: string): PoWChallenge | null;
|
|
44
|
+
export declare function decodePoWChallenge(encoded: string): PoWChallenge | null;
|
|
45
45
|
/**
|
|
46
46
|
* Encode a solution string (browser-compatible)
|
|
47
47
|
*/
|
|
48
|
-
declare function encodePoWSolution(solution: PoWSolution): string;
|
|
48
|
+
export declare function encodePoWSolution(solution: PoWSolution): string;
|
|
49
49
|
/**
|
|
50
50
|
* Verify a PoW solution locally (for testing purposes)
|
|
51
51
|
*/
|
|
52
|
-
declare function verifyPoWSolution(nonce: string, counter: number, difficulty: number): Promise<boolean>;
|
|
52
|
+
export declare function verifyPoWSolution(nonce: string, counter: number, difficulty: number): Promise<boolean>;
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region src/sms.d.ts
|
|
55
55
|
/**
|
|
@@ -61,7 +61,7 @@ declare function verifyPoWSolution(nonce: string, counter: number, difficulty: n
|
|
|
61
61
|
/**
|
|
62
62
|
* SMS template definitions with their required variables
|
|
63
63
|
*/
|
|
64
|
-
declare const SMS_TEMPLATES: {
|
|
64
|
+
export declare const SMS_TEMPLATES: {
|
|
65
65
|
readonly "phone-verification": {
|
|
66
66
|
readonly variables: {
|
|
67
67
|
code: string;
|
|
@@ -140,7 +140,7 @@ interface SendSMSOptions {
|
|
|
140
140
|
/**
|
|
141
141
|
* Create an SMS sender instance
|
|
142
142
|
*/
|
|
143
|
-
declare function createSMSSender(config?: SMSConfig): {
|
|
143
|
+
export declare function createSMSSender(config?: SMSConfig): {
|
|
144
144
|
send: (options: SendSMSOptions) => Promise<SendSMSResult>;
|
|
145
145
|
};
|
|
146
146
|
/**
|
|
@@ -171,7 +171,7 @@ declare function createSMSSender(config?: SMSConfig): {
|
|
|
171
171
|
* });
|
|
172
172
|
* ```
|
|
173
173
|
*/
|
|
174
|
-
declare function sendSMS(options: SendSMSOptions, config?: SMSConfig): Promise<SendSMSResult>;
|
|
174
|
+
export declare function sendSMS(options: SendSMSOptions, config?: SMSConfig): Promise<SendSMSResult>;
|
|
175
175
|
//#endregion
|
|
176
176
|
//#region src/routes/auth/types.d.ts
|
|
177
177
|
type DBField = {
|
|
@@ -370,6 +370,10 @@ interface DashDirectoryRegenerateTokenResponse {
|
|
|
370
370
|
scimToken: string;
|
|
371
371
|
scimEndpoint: string;
|
|
372
372
|
}
|
|
373
|
+
interface DashDirectorySyncConnectionCountResponse {
|
|
374
|
+
count: number;
|
|
375
|
+
mode: "managed" | "legacy";
|
|
376
|
+
}
|
|
373
377
|
//#endregion
|
|
374
378
|
//#region src/events/constants.d.ts
|
|
375
379
|
declare const EVENT_TYPES: {
|
|
@@ -416,7 +420,7 @@ declare const ORGANIZATION_EVENT_TYPES: {
|
|
|
416
420
|
readonly ORGANIZATION_TEAM_MEMBER_REMOVED: "organization_team_member_removed";
|
|
417
421
|
};
|
|
418
422
|
/** All audit event type string constants (user + organization). */
|
|
419
|
-
declare const USER_EVENT_TYPES: {
|
|
423
|
+
export declare const USER_EVENT_TYPES: {
|
|
420
424
|
readonly ORGANIZATION_CREATED: "organization_created";
|
|
421
425
|
readonly ORGANIZATION_UPDATED: "organization_updated";
|
|
422
426
|
readonly ORGANIZATION_MEMBER_ADDED: "organization_member_added";
|
|
@@ -662,6 +666,9 @@ interface DashSsoVerifyDomainResponse {
|
|
|
662
666
|
verified: boolean;
|
|
663
667
|
message?: string;
|
|
664
668
|
}
|
|
669
|
+
interface DashSsoConnectionCountResponse {
|
|
670
|
+
count: number;
|
|
671
|
+
}
|
|
665
672
|
//#endregion
|
|
666
673
|
//#region src/routes/two-factor/types.d.ts
|
|
667
674
|
interface DashTwoFactorEnableResponse {
|
|
@@ -791,10 +798,10 @@ interface DashCheckUserExistsResponse {
|
|
|
791
798
|
* @param email - Raw email to normalize
|
|
792
799
|
* @param context - Auth context
|
|
793
800
|
*/
|
|
794
|
-
declare function normalizeEmail(email: string, context: AuthContext): string;
|
|
801
|
+
export declare function normalizeEmail(email: string, context: AuthContext): string;
|
|
795
802
|
//#endregion
|
|
796
803
|
//#region src/index.d.ts
|
|
797
|
-
declare const dash: <O extends DashOptions>(options?: O) => {
|
|
804
|
+
export declare const dash: <O extends DashOptions>(options?: O) => {
|
|
798
805
|
id: "dash";
|
|
799
806
|
options: DashOptionsResolved;
|
|
800
807
|
version: string;
|
|
@@ -838,7 +845,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
838
845
|
};
|
|
839
846
|
session: {
|
|
840
847
|
create: {
|
|
841
|
-
before(
|
|
848
|
+
before(_session: {
|
|
842
849
|
id: string;
|
|
843
850
|
createdAt: Date;
|
|
844
851
|
updatedAt: Date;
|
|
@@ -847,7 +854,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
847
854
|
token: string;
|
|
848
855
|
ipAddress?: string | null | undefined;
|
|
849
856
|
userAgent?: string | null | undefined;
|
|
850
|
-
} & Record<string, unknown>,
|
|
857
|
+
} & Record<string, unknown>, untypedCtx: GenericEndpointContext | null): Promise<{
|
|
851
858
|
data: {
|
|
852
859
|
loginMethod: string | null;
|
|
853
860
|
};
|
|
@@ -861,7 +868,7 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
861
868
|
token: string;
|
|
862
869
|
ipAddress?: string | null | undefined;
|
|
863
870
|
userAgent?: string | null | undefined;
|
|
864
|
-
} & Record<string, unknown>,
|
|
871
|
+
} & Record<string, unknown>, untypedCtx: GenericEndpointContext | null): Promise<void>;
|
|
865
872
|
};
|
|
866
873
|
delete: {
|
|
867
874
|
after(session: {
|
|
@@ -1303,6 +1310,12 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
1303
1310
|
verified: import("zod").ZodLiteral<false>;
|
|
1304
1311
|
}, import("zod/v4/core").$strip>;
|
|
1305
1312
|
}, DashSsoMarkDomainVerifiedResponse>;
|
|
1313
|
+
countDashSsoConnections: import("better-call").StrictEndpoint<"/dash/sso/connection-count", {
|
|
1314
|
+
method: "GET";
|
|
1315
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
1316
|
+
payload: Record<string, unknown>;
|
|
1317
|
+
}>>[];
|
|
1318
|
+
}, DashSsoConnectionCountResponse>;
|
|
1306
1319
|
listDashTeamMembers: import("better-call").StrictEndpoint<"/dash/organization/:orgId/teams/:teamId/members", {
|
|
1307
1320
|
method: "GET";
|
|
1308
1321
|
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
@@ -2197,6 +2210,12 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
2197
2210
|
}>>[];
|
|
2198
2211
|
body: import("zod").ZodObject<{}, import("zod/v4/core").$strip>;
|
|
2199
2212
|
}, DirectorySyncConnection>;
|
|
2213
|
+
countDashDirectorySyncConnections: import("better-call").StrictEndpoint<"/dash/directory-sync/connection-count", {
|
|
2214
|
+
method: "GET";
|
|
2215
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
2216
|
+
payload: Record<string, unknown>;
|
|
2217
|
+
}>>[];
|
|
2218
|
+
}, DashDirectorySyncConnectionCountResponse>;
|
|
2200
2219
|
dashExecuteAdapter: import("better-call").StrictEndpoint<"/dash/execute-adapter", {
|
|
2201
2220
|
method: "POST";
|
|
2202
2221
|
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
@@ -2341,4 +2360,4 @@ declare const dash: <O extends DashOptions>(options?: O) => {
|
|
|
2341
2360
|
} : {});
|
|
2342
2361
|
};
|
|
2343
2362
|
//#endregion
|
|
2344
|
-
export { type APIError, type ApiOptions, type ApiOptionsResolved,
|
|
2363
|
+
export { type APIError, type ApiOptions, type ApiOptionsResolved, type CompromisedPasswordResult, type CredentialStuffingResult, type DBField, type DashAddTeamMemberResponse, type DashBanManyResponse, type DashCheckUserByEmailResponse, type DashCheckUserExistsResponse, type DashCompleteInvitationResponse, type DashConfigResponse, type DashCreateOrganizationBody, type DashCreateOrganizationResponse, type DashCreateTeamResponse, type DashCreateUserResponse, type DashDeleteManyUsersResponse, type DashDirectoryCreateResponse, type DashDirectoryCredential, type DashDirectoryDeleteResponse, type DashDirectoryEvent, type DashDirectoryEventsResponse, type DashDirectoryItem, type DashDirectoryRegenerateTokenResponse, type DashDirectoryRotateCredentialResponse, type DashDirectorySyncConnectionCountResponse, type DashDirectorySyncSSOPairing, type DashExecuteAdapterCountResponse, type DashExecuteAdapterFindManyResponse, type DashExecuteAdapterFindOneResponse, type DashExecuteAdapterMutationResponse, type DashExecuteAdapterResponse, type DashExportOrganizationsResponse, type DashIdRow, type DashInviteMemberResponse, type DashMaybeSuccessResponse, type DashOptions, type DashOptionsInternal, type DashOptionsResolved, type DashOrganizationAddMemberResponse, type DashOrganizationDeleteManyResponse, type DashOrganizationDetailResponse, type DashOrganizationInvitationItem, type DashOrganizationInvitationListResponse, type DashOrganizationInvitationStatusItem, type DashOrganizationListResponse, type DashOrganizationMember, type DashOrganizationMemberListItem, type DashOrganizationMemberListResponse, type DashOrganizationMemberUser, type DashOrganizationOptionsResponse, type DashOrganizationTeamItem, type DashOrganizationTeamListResponse, type DashOrganizationUpdateMemberRoleResponse, type DashOrganizationUpdateResponse, type DashSCIMManagedConnectionEventType, type DashSCIMManagedCredentialStatus, type DashSCIMScope, type DashSendManyVerificationEmailsResponse, type DashSessionRevokeManyResponse, type DashSsoConnectionCountResponse, type DashSsoCreateProviderResponse, type DashSsoDeleteResponse, type DashSsoMarkDomainVerifiedResponse, type DashSsoProviderItem, type DashSsoProviderSummary, type DashSsoUpdateProviderResponse, type DashSsoVerificationTokenResponse, type DashSsoVerifyDomainResponse, type DashSuccessResponse, type DashTeam, type DashTeamMember, type DashTeamMemberListResponse, type DashTwoFactorBackupCodesResponse, type DashTwoFactorEnableResponse, type DashTwoFactorStatus, type DashTwoFactorTotpViewResponse, type DashUpdateTeamResponse, type DashUpdateUserResponse, type DashUserDetailsResponse, type DashUserGraphDataResponse, type DashUserListResponse, type DashUserOrganizationsResponse, type DashUserRetentionDataResponse, type DashUserStatsActivePeriod, type DashUserStatsResponse, type DashUserStatsSignUpPeriod, type DashValidateResponse, type DirectorySyncConnection, type DirectorySyncConnectionStatus, type DirectorySyncMode, EMAIL_TEMPLATES, type EmailConfig, type EmailTemplateId, type EmailTemplateVariables, type Endpoint, type EndpointOptions, type EventLocation, type EventTypesResponse, type ImpossibleTravelResult, type InfraAuthContext, type InfraEndpointContext, type InfraEndpointContextValue, type InfraPluginConnectionOptions, type InfraPluginConnectionOptionsInternal, type KvOptions, type KvOptionsResolved, type KvRetryOptions, type KvRetryOptionsResolved, type LegacyDashDirectoryCreateResponse, type LegacyDashDirectoryItem, type LocationData, type LocationDataContext, type ORGANIZATION_USER_PREVIEW_SELECT, type OrganizationUserPreview, type PoWChallenge, type PoWSolution, type SCIMPlugin, type SMSConfig, type SMSTemplateId, type SMSTemplateVariables, type SecurityEvent, type SecurityEventType, type SecurityOptions, type SecurityVerdict, type SendBulkEmailsOptions, type SendBulkEmailsResult, type SendEmailOptions, type SendEmailResult, type SendSMSOptions, type SendSMSResult, type SentinelOptions, type SentinelOptionsInternal, type StaleUserResult, type ThresholdConfig, type UserEvent, type UserEventType, type UserEventsResponse, type asInfraContext, type createAuthMiddleware, createEmailSender, sendBulkEmails, sendEmail, sentinel };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as INFRA_USER_AGENT, n as INFRA_API_URL, o as PLUGIN_VERSION, r as INFRA_KV_URL } from "./constants-
|
|
2
|
-
import { a as createAPI, n as hash$1, o as createKV, r as hmacSha256Hex } from "./crypto-
|
|
1
|
+
import { i as INFRA_USER_AGENT, n as INFRA_API_URL, o as PLUGIN_VERSION, r as INFRA_KV_URL } from "./constants-C82aGVpa.mjs";
|
|
2
|
+
import { a as createAPI, n as hash$1, o as createKV, r as hmacSha256Hex } from "./crypto-CgNWT4f3.mjs";
|
|
3
3
|
import { EMAIL_TEMPLATES, createEmailSender, sendBulkEmails, sendEmail } from "./email.mjs";
|
|
4
4
|
import { getCurrentAdapter, getCurrentAuthContext, getCurrentDBAdapterAsyncLocalStorage, runWithTransaction } from "@better-auth/core/context";
|
|
5
5
|
import { APIError, generateId, getAuthTables, logger } from "better-auth";
|
|
@@ -13,14 +13,24 @@ import z, { z as z$1 } from "zod";
|
|
|
13
13
|
import { DOMParser } from "@xmldom/xmldom";
|
|
14
14
|
import { base64Url } from "@better-auth/utils/base64";
|
|
15
15
|
import { createLocalJWKSet, jwtVerify } from "jose";
|
|
16
|
-
import { generateRandomString, symmetricEncrypt } from "better-auth/crypto";
|
|
16
|
+
import { generateRandomString, symmetricDecrypt, symmetricEncrypt } from "better-auth/crypto";
|
|
17
17
|
import { createOTP } from "@better-auth/utils/otp";
|
|
18
18
|
//#region src/options.ts
|
|
19
|
+
/** @internal */
|
|
20
|
+
function resolveApiKeys(raw) {
|
|
21
|
+
const apiKeys = (raw?.trim() || env.BETTER_AUTH_API_KEY?.trim() || "").split(",").map((k) => k.trim()).filter((k) => k.length > 0);
|
|
22
|
+
return {
|
|
23
|
+
apiKey: apiKeys[0] ?? "",
|
|
24
|
+
apiKeys
|
|
25
|
+
};
|
|
26
|
+
}
|
|
19
27
|
function resolveConnectionOptions(options) {
|
|
28
|
+
const { apiKey, apiKeys } = resolveApiKeys(options?.apiKey);
|
|
20
29
|
return {
|
|
21
30
|
apiUrl: options?.apiUrl || INFRA_API_URL,
|
|
22
31
|
kvUrl: options?.kvUrl || INFRA_KV_URL,
|
|
23
|
-
apiKey
|
|
32
|
+
apiKey,
|
|
33
|
+
apiKeys,
|
|
24
34
|
apiOptions: {
|
|
25
35
|
timeout: options?.apiOptions?.timeout ?? options?.apiTimeout ?? 3e3,
|
|
26
36
|
headers: options?.apiOptions?.headers
|
|
@@ -128,18 +138,19 @@ function resolveProjectBasePath(basePath) {
|
|
|
128
138
|
return basePath?.trim() || "/api/auth";
|
|
129
139
|
}
|
|
130
140
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
141
|
+
* Split a Better Auth **already-resolved** mount URL (`ctx.context.baseURL`).
|
|
142
|
+
* Path embedded in that URL is the effective mount (BA path-in-baseURL /
|
|
143
|
+
* withPath result). `fallbackBasePath` is used only when the mount URL has no
|
|
144
|
+
* path (e.g. dynamic allowedHosts before a request sets the full URL).
|
|
134
145
|
*/
|
|
135
|
-
function
|
|
146
|
+
function resolveAuthMountBase(mountURL, fallbackBasePath) {
|
|
136
147
|
try {
|
|
137
|
-
const url = new URL(
|
|
148
|
+
const url = new URL(mountURL);
|
|
138
149
|
const pathname = url.pathname.replace(/\/+$/, "") || "";
|
|
139
150
|
if (pathname && pathname !== "/") return resolveBaseUrlPath(url.origin, pathname);
|
|
140
|
-
return resolveBaseUrlPath(url.origin, resolveProjectBasePath(
|
|
151
|
+
return resolveBaseUrlPath(url.origin, resolveProjectBasePath(fallbackBasePath));
|
|
141
152
|
} catch {
|
|
142
|
-
return resolveBaseUrlPath(
|
|
153
|
+
return resolveBaseUrlPath(mountURL, resolveProjectBasePath(fallbackBasePath));
|
|
143
154
|
}
|
|
144
155
|
}
|
|
145
156
|
function toAllowedOriginSet(allowedOrigins) {
|
|
@@ -1341,7 +1352,7 @@ function createIdentificationMiddleware($kv, options) {
|
|
|
1341
1352
|
if (!skipIdentification) {
|
|
1342
1353
|
const extracted = extractIdentificationHeaders(ctx.request);
|
|
1343
1354
|
headerVisitorId = extracted.visitorId;
|
|
1344
|
-
requestId = extracted.requestId ?? ctx.getCookie(
|
|
1355
|
+
requestId = extracted.requestId ?? ctx.getCookie(IDENTIFICATION_COOKIE_NAME) ?? null;
|
|
1345
1356
|
}
|
|
1346
1357
|
ctx.context.requestId = requestId;
|
|
1347
1358
|
if (skipIdentification) ctx.context.identification = null;
|
|
@@ -2632,7 +2643,7 @@ const sentinel = (options) => {
|
|
|
2632
2643
|
id: "sentinel",
|
|
2633
2644
|
init(ctx) {
|
|
2634
2645
|
activityTrackingEnabled = (ctx.getPlugin("dash")?.options)?.activityTracking?.enabled === true;
|
|
2635
|
-
const basePath = ctx.baseURL ?
|
|
2646
|
+
const basePath = ctx.baseURL ? resolveAuthMountBase(ctx.baseURL, ctx.options.basePath).basePath : resolveProjectBasePath(ctx.options.basePath);
|
|
2636
2647
|
const ipHeaders = ctx.options.advanced?.ipAddress?.ipAddressHeaders || null;
|
|
2637
2648
|
const disableIpTracking = ctx.options.advanced?.ipAddress?.disableIpTracking === true;
|
|
2638
2649
|
/**
|
|
@@ -4282,14 +4293,14 @@ const jwtMiddleware = (options, schema, getJWT) => {
|
|
|
4282
4293
|
throw ctx.error("UNAUTHORIZED", { message: "Invalid API key" });
|
|
4283
4294
|
});
|
|
4284
4295
|
const apiKeyHash = payload.apiKeyHash;
|
|
4285
|
-
if (typeof apiKeyHash !== "string" ||
|
|
4296
|
+
if (typeof apiKeyHash !== "string" || options.apiKeys.length === 0) {
|
|
4286
4297
|
ctx.context.logger.warn("[Dash] API key hash is missing or invalid", {
|
|
4287
4298
|
apiKeyHash,
|
|
4288
|
-
apiKey: options.
|
|
4299
|
+
apiKey: options.apiKeys.length > 0 ? "present" : "missing"
|
|
4289
4300
|
});
|
|
4290
4301
|
throw ctx.error("UNAUTHORIZED", { message: "Invalid API key" });
|
|
4291
4302
|
}
|
|
4292
|
-
if (!
|
|
4303
|
+
if (!await apiKeyHashMatchesAny(apiKeyHash, options.apiKeys)) {
|
|
4293
4304
|
ctx.context.logger.warn("[Dash] API key hash mismatch");
|
|
4294
4305
|
throw ctx.error("UNAUTHORIZED", { message: "Invalid API key" });
|
|
4295
4306
|
}
|
|
@@ -4337,20 +4348,25 @@ const jwtValidateMiddleware = (options) => {
|
|
|
4337
4348
|
throw ctx.error("UNAUTHORIZED", { message: "Invalid API key" });
|
|
4338
4349
|
});
|
|
4339
4350
|
const apiKeyHash = payload.apiKeyHash;
|
|
4340
|
-
if (typeof apiKeyHash !== "string" ||
|
|
4351
|
+
if (typeof apiKeyHash !== "string" || options.apiKeys.length === 0) {
|
|
4341
4352
|
ctx.context.logger.warn("[Dash] API key hash is missing or invalid", {
|
|
4342
4353
|
apiKeyHash: typeof apiKeyHash,
|
|
4343
|
-
apiKey: options.
|
|
4354
|
+
apiKey: options.apiKeys.length > 0 ? "present" : "missing"
|
|
4344
4355
|
});
|
|
4345
4356
|
throw ctx.error("UNAUTHORIZED", { message: "Invalid API key" });
|
|
4346
4357
|
}
|
|
4347
|
-
if (!
|
|
4358
|
+
if (!await apiKeyHashMatchesAny(apiKeyHash, options.apiKeys)) {
|
|
4348
4359
|
ctx.context.logger.warn("[Dash] API key hash mismatch");
|
|
4349
4360
|
throw ctx.error("UNAUTHORIZED", { message: "Invalid API key" });
|
|
4350
4361
|
}
|
|
4351
4362
|
return { payload };
|
|
4352
4363
|
});
|
|
4353
4364
|
};
|
|
4365
|
+
async function apiKeyHashMatchesAny(apiKeyHash, apiKeys) {
|
|
4366
|
+
let matched = false;
|
|
4367
|
+
for (const key of apiKeys) if (timingSafeEqualHash(apiKeyHash, await hash(key))) matched = true;
|
|
4368
|
+
return matched;
|
|
4369
|
+
}
|
|
4354
4370
|
//#endregion
|
|
4355
4371
|
//#region src/lib/safe-url.ts
|
|
4356
4372
|
function isSafeHttpUrl(value) {
|
|
@@ -4482,7 +4498,7 @@ const getConfig = (options) => {
|
|
|
4482
4498
|
}, async (ctx) => {
|
|
4483
4499
|
const advancedOptions = ctx.context.options.advanced;
|
|
4484
4500
|
const organizationPlugin = ctx.context.getPlugin("organization");
|
|
4485
|
-
const authBase =
|
|
4501
|
+
const authBase = resolveAuthMountBase(getAuthBaseUrl(ctx), ctx.context.options.basePath);
|
|
4486
4502
|
return redactDashSettings({
|
|
4487
4503
|
version: ctx.context.version || null,
|
|
4488
4504
|
socialProviders: Object.keys(ctx.context.options.socialProviders || {}),
|
|
@@ -5664,6 +5680,36 @@ function isDuplicateDirectorySyncError(e) {
|
|
|
5664
5680
|
if (e instanceof Error) return /unique constraint|duplicate key|already exists|P2002/i.test(e.message);
|
|
5665
5681
|
return false;
|
|
5666
5682
|
}
|
|
5683
|
+
const countDirectorySyncConnections = (options) => {
|
|
5684
|
+
return createAuthEndpoint("/dash/directory-sync/connection-count", {
|
|
5685
|
+
method: "GET",
|
|
5686
|
+
use: [jwtMiddleware(options)]
|
|
5687
|
+
}, async (ctx) => {
|
|
5688
|
+
const mode = resolveMode(ctx);
|
|
5689
|
+
if (mode === "managed") return {
|
|
5690
|
+
count: await ctx.context.adapter.count({
|
|
5691
|
+
model: "directorySyncConnection",
|
|
5692
|
+
where: [{
|
|
5693
|
+
field: "status",
|
|
5694
|
+
value: ["active", "decommissioning"],
|
|
5695
|
+
operator: "in"
|
|
5696
|
+
}]
|
|
5697
|
+
}),
|
|
5698
|
+
mode: "managed"
|
|
5699
|
+
};
|
|
5700
|
+
if (mode === "legacy") {
|
|
5701
|
+
if (!isOrganizationEnabled(ctx)) return {
|
|
5702
|
+
count: 0,
|
|
5703
|
+
mode: "legacy"
|
|
5704
|
+
};
|
|
5705
|
+
return {
|
|
5706
|
+
count: await ctx.context.adapter.count({ model: "scimProvider" }),
|
|
5707
|
+
mode: "legacy"
|
|
5708
|
+
};
|
|
5709
|
+
}
|
|
5710
|
+
throw ctx.error("NOT_FOUND", { message: "Directory sync connection count unavailable" });
|
|
5711
|
+
});
|
|
5712
|
+
};
|
|
5667
5713
|
const listOrganizationDirectories = (options) => {
|
|
5668
5714
|
return createAuthEndpoint("/dash/organization/:id/directories", {
|
|
5669
5715
|
method: "GET",
|
|
@@ -8551,6 +8597,17 @@ async function resolveOIDCConfig(oidcConfig, _domain, ctx) {
|
|
|
8551
8597
|
issuer: oidcConfig.issuer
|
|
8552
8598
|
};
|
|
8553
8599
|
}
|
|
8600
|
+
const countSsoConnections = (options) => {
|
|
8601
|
+
return createAuthEndpoint("/dash/sso/connection-count", {
|
|
8602
|
+
method: "GET",
|
|
8603
|
+
use: [jwtMiddleware(options)]
|
|
8604
|
+
}, async (ctx) => {
|
|
8605
|
+
if (!isOrganizationEnabled(ctx)) return { count: 0 };
|
|
8606
|
+
if (!ctx.context.getPlugin("sso")) return { count: 0 };
|
|
8607
|
+
const count = await ctx.context.adapter.count({ model: "ssoProvider" });
|
|
8608
|
+
return { count: typeof count === "number" && Number.isFinite(count) && count >= 0 ? Math.floor(count) : 0 };
|
|
8609
|
+
});
|
|
8610
|
+
};
|
|
8554
8611
|
const listOrganizationSsoProviders = (options) => {
|
|
8555
8612
|
return createAuthEndpoint("/dash/organization/:id/sso-providers", {
|
|
8556
8613
|
method: "GET",
|
|
@@ -8996,7 +9053,6 @@ const enableTwoFactor = (options) => createAuthEndpoint("/dash/enable-two-factor
|
|
|
8996
9053
|
value: userId
|
|
8997
9054
|
}]
|
|
8998
9055
|
});
|
|
8999
|
-
const { generateRandomString, symmetricEncrypt } = await import("better-auth/crypto");
|
|
9000
9056
|
const secret = generateRandomString(32);
|
|
9001
9057
|
const { backupCodes, encryptedBackupCodes } = await generateBackupCodes$1(ctx.context.secret, resolveBackupCodeOptions(twoFactorPlugin));
|
|
9002
9058
|
const encryptedSecret = await symmetricEncrypt({
|
|
@@ -9079,7 +9135,6 @@ const viewTwoFactorTotpUri = (options) => createAuthEndpoint("/dash/view-two-fac
|
|
|
9079
9135
|
if (!twoFactorRecord) throw new APIError("NOT_FOUND", { message: "Two-factor authentication not set up for this user" });
|
|
9080
9136
|
let secret = twoFactorRecord.secret;
|
|
9081
9137
|
try {
|
|
9082
|
-
const { symmetricDecrypt } = await import("better-auth/crypto");
|
|
9083
9138
|
secret = await symmetricDecrypt({
|
|
9084
9139
|
key: ctx.context.secret,
|
|
9085
9140
|
data: twoFactorRecord.secret
|
|
@@ -10930,13 +10985,13 @@ const dash = (options) => {
|
|
|
10930
10985
|
},
|
|
10931
10986
|
session: {
|
|
10932
10987
|
create: {
|
|
10933
|
-
async before(
|
|
10934
|
-
const ctx =
|
|
10988
|
+
async before(_session, untypedCtx) {
|
|
10989
|
+
const ctx = untypedCtx;
|
|
10935
10990
|
if (!ctx) return;
|
|
10936
10991
|
return { data: { loginMethod: getLoginMethod(ctx) } };
|
|
10937
10992
|
},
|
|
10938
|
-
async after(session,
|
|
10939
|
-
const ctx =
|
|
10993
|
+
async after(session, untypedCtx) {
|
|
10994
|
+
const ctx = untypedCtx;
|
|
10940
10995
|
if (!ctx || !session.userId) return;
|
|
10941
10996
|
const location = ctx.context.location;
|
|
10942
10997
|
const loginMethod = getLoginMethod(ctx) ?? void 0;
|
|
@@ -11137,6 +11192,7 @@ const dash = (options) => {
|
|
|
11137
11192
|
verifyDashSsoProviderDomain: verifySsoProviderDomain(settings),
|
|
11138
11193
|
deleteDashSsoProvider: deleteSsoProvider(settings),
|
|
11139
11194
|
markDashSsoProviderDomainVerified: markSsoProviderDomainVerified(settings),
|
|
11195
|
+
countDashSsoConnections: countSsoConnections(settings),
|
|
11140
11196
|
listDashTeamMembers: listTeamMembers(settings),
|
|
11141
11197
|
createDashOrganization: createOrganization(settings),
|
|
11142
11198
|
deleteDashOrganization: deleteOrganization(settings),
|
|
@@ -11199,6 +11255,7 @@ const dash = (options) => {
|
|
|
11199
11255
|
listDashManagedDirectoryEvents: listDirectoryEvents(settings),
|
|
11200
11256
|
decommissionDashManagedOrganizationDirectory: decommissionOrganizationDirectory(settings),
|
|
11201
11257
|
unpairDashManagedOrganizationDirectory: unpairOrganizationDirectory(settings),
|
|
11258
|
+
countDashDirectorySyncConnections: countDirectorySyncConnections(settings),
|
|
11202
11259
|
dashExecuteAdapter: executeAdapter(settings)
|
|
11203
11260
|
},
|
|
11204
11261
|
schema: {
|
package/dist/native.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DashGetAllAuditLogsInput, i as DashClientOptions, n as DashAuditLog, o as DashGetAuditLogsInput, r as DashAuditLogsResponse, s as dashClient, t as IdentifyClientOptions } from "./identify-client-options-
|
|
1
|
+
import { a as DashGetAllAuditLogsInput, i as DashClientOptions, n as DashAuditLog, o as DashGetAuditLogsInput, r as DashAuditLogsResponse, s as dashClient, t as IdentifyClientOptions } from "./identify-client-options-BfGftEgh.mjs";
|
|
2
2
|
import { BetterAuthClientPlugin } from "better-auth";
|
|
3
3
|
//#region src/sentinel/native/client.d.ts
|
|
4
4
|
interface SentinelNativeClientOptions {
|
|
@@ -22,6 +22,6 @@ interface SentinelNativeClientOptions {
|
|
|
22
22
|
setItem: (key: string, value: string) => Promise<void>;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
declare const sentinelNativeClient: (options?: SentinelNativeClientOptions) => BetterAuthClientPlugin;
|
|
25
|
+
export declare const sentinelNativeClient: (options?: SentinelNativeClientOptions) => BetterAuthClientPlugin;
|
|
26
26
|
//#endregion
|
|
27
|
-
export { type DashAuditLog, type DashAuditLogsResponse, type DashClientOptions, type DashGetAllAuditLogsInput, type DashGetAuditLogsInput, type SentinelNativeClientOptions, dashClient
|
|
27
|
+
export { type DashAuditLog, type DashAuditLogsResponse, type DashClientOptions, type DashGetAllAuditLogsInput, type DashGetAuditLogsInput, type SentinelNativeClientOptions, dashClient };
|
package/dist/native.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as createKV, t as bytesToHex } from "./crypto-
|
|
2
|
-
import { a as resolveSentinelClientIdentifyUrl, c as identify, i as solvePoWChallenge, l as dashClient, n as decodePoWChallenge, o as resolveIdentifyClientRetry, r as encodePoWSolution, t as createPowRetryTimeout } from "./pow-retry-
|
|
1
|
+
import { o as createKV, t as bytesToHex } from "./crypto-CgNWT4f3.mjs";
|
|
2
|
+
import { a as resolveSentinelClientIdentifyUrl, c as identify, i as solvePoWChallenge, l as dashClient, n as decodePoWChallenge, o as resolveIdentifyClientRetry, r as encodePoWSolution, t as createPowRetryTimeout } from "./pow-retry-B5TObAcM.mjs";
|
|
3
3
|
import { env } from "@better-auth/core/env";
|
|
4
4
|
import { Dimensions, InteractionManager, PixelRatio, Platform } from "react-native";
|
|
5
5
|
//#region src/sentinel/native/components.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as randomBytes, n as hash, t as bytesToHex } from "./crypto-
|
|
1
|
+
import { i as randomBytes, n as hash, t as bytesToHex } from "./crypto-CgNWT4f3.mjs";
|
|
2
2
|
//#region src/dash-client.ts
|
|
3
3
|
function resolveDashUserId(input, options) {
|
|
4
4
|
return input.userId || options?.resolveUserId?.({
|
|
@@ -481,6 +481,8 @@ interface InfraPluginConnectionOptionsInternal extends Omit<InfraPluginConnectio
|
|
|
481
481
|
apiUrl: string;
|
|
482
482
|
kvUrl: string;
|
|
483
483
|
apiKey: string;
|
|
484
|
+
/** @internal */
|
|
485
|
+
apiKeys: string[];
|
|
484
486
|
apiOptions: ApiOptionsResolved;
|
|
485
487
|
kvOptions: KvOptionsResolved;
|
|
486
488
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/infra",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.11",
|
|
4
4
|
"description": "Dashboard and analytics plugin for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -66,32 +66,32 @@
|
|
|
66
66
|
},
|
|
67
67
|
"homepage": "https://better-auth.com",
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@better-auth/kysely-adapter": "1.7.
|
|
70
|
-
"@better-auth/scim": "1.7.
|
|
71
|
-
"@better-auth/sso": "1.7.
|
|
69
|
+
"@better-auth/kysely-adapter": "1.7.5",
|
|
70
|
+
"@better-auth/scim": "1.7.5",
|
|
71
|
+
"@better-auth/sso": "1.7.5",
|
|
72
72
|
"@infra/mocks": "0.0.0",
|
|
73
73
|
"@infra/utils": "0.0.0",
|
|
74
74
|
"@types/bun": "latest",
|
|
75
75
|
"@types/node": "^24.12.0",
|
|
76
76
|
"@vitest/browser-playwright": "5.0.0",
|
|
77
77
|
"@vitest/coverage-istanbul": "^5.0.0",
|
|
78
|
-
"better-auth": "1.7.
|
|
79
|
-
"expo-crypto": "^57.0.
|
|
78
|
+
"better-auth": "1.7.5",
|
|
79
|
+
"expo-crypto": "^57.0.3",
|
|
80
80
|
"msw": "^2.14.6",
|
|
81
81
|
"playwright": "^1.63.0",
|
|
82
|
-
"tsdown": "^0.
|
|
82
|
+
"tsdown": "^0.23.0",
|
|
83
83
|
"typescript": "^6.0.3",
|
|
84
84
|
"vitest": "^5.0.0",
|
|
85
85
|
"zod": "4.5.4"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@better-auth/utils": "^0.4.2",
|
|
89
|
-
"@better-fetch/fetch": "1.3.
|
|
89
|
+
"@better-fetch/fetch": "1.3.2",
|
|
90
90
|
"@noble/hashes": "^2.2.0",
|
|
91
91
|
"@xmldom/xmldom": "^0.9.10",
|
|
92
92
|
"better-call": "1.4.0",
|
|
93
|
-
"jose": "^6.2.
|
|
94
|
-
"libphonenumber-js": "^1.13.
|
|
93
|
+
"jose": "^6.2.12",
|
|
94
|
+
"libphonenumber-js": "^1.13.13"
|
|
95
95
|
},
|
|
96
96
|
"peerDependencies": {
|
|
97
97
|
"better-auth": ">=1.4.0",
|