@better-auth/infra 0.4.5 → 0.4.6
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 +9 -1
- package/dist/client.mjs +2 -2
- package/dist/{constants-DjM7toCN.mjs → constants-CApB_fKA.mjs} +1 -1
- package/dist/{crypto-BhIjjZNe.mjs → crypto-CfK70MTZ.mjs} +1 -1
- package/dist/email.mjs +1 -1
- package/dist/index.mjs +9 -26
- package/dist/native.mjs +2 -2
- package/dist/{pow-retry-CsInOtOL.mjs → pow-retry-DkrUdqDd.mjs} +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
All notable changes to `@better-auth/infra` are documented in this file.
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0/).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.4.6] - 2026-09-07
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **Better Auth 1.7.3 account identity** — Dropped never-shipped `account.identityStrategy` insights/compat. Issuer-scoped account paths (`issuer` column, `findAccountByKey`) remain only for better-auth 1.7.0–1.7.2; 1.7.3+ uses `(providerId, accountId)` again. Runtime still feature-detects issuer APIs when present.
|
|
7
15
|
|
|
8
16
|
## [0.4.5] - 2026-08-28
|
|
9
17
|
|
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-CfK70MTZ.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-DkrUdqDd.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.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-CApB_fKA.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/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-CApB_fKA.mjs";
|
|
2
|
+
import { a as createAPI, n as hash$1, o as createKV, r as hmacSha256Hex } from "./crypto-CfK70MTZ.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";
|
|
@@ -386,37 +386,23 @@ const getLoginMethod = (ctx) => {
|
|
|
386
386
|
//#endregion
|
|
387
387
|
//#region src/compat/account.ts
|
|
388
388
|
/**
|
|
389
|
-
* Mirrors better-auth 1.7
|
|
389
|
+
* Mirrors better-auth 1.7.0–1.7.2 `createLocalAccountIssuer` so infra can
|
|
390
390
|
* typecheck against older core packages while emitting the same issuer strings.
|
|
391
391
|
*/
|
|
392
392
|
function createLocalAccountIssuer(providerId) {
|
|
393
393
|
return `local:${encodeURIComponent(providerId)}`;
|
|
394
394
|
}
|
|
395
395
|
/**
|
|
396
|
-
* Mirrors better-auth 1.7
|
|
396
|
+
* Mirrors better-auth 1.7.0–1.7.2 `createOAuthAccountIssuer`.
|
|
397
397
|
*/
|
|
398
398
|
function createOAuthAccountIssuer(providerId) {
|
|
399
399
|
return `local:oauth:${encodeURIComponent(providerId)}`;
|
|
400
400
|
}
|
|
401
|
-
/** Configured strategy when set; `null` when omitted (pre-option or default). */
|
|
402
|
-
function getConfiguredAccountIdentityStrategy(account) {
|
|
403
|
-
const strategy = account?.identityStrategy;
|
|
404
|
-
if (strategy === "provider-id" || strategy === "issuer") return strategy;
|
|
405
|
-
return null;
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Effective strategy for account-key derivation.
|
|
409
|
-
* Matches better-auth: omit/`"issuer"` → issuer-scoped; `"provider-id"` → provider-scoped.
|
|
410
|
-
*/
|
|
411
|
-
function resolveAccountIdentityStrategy(account) {
|
|
412
|
-
return getConfiguredAccountIdentityStrategy(account) ?? "issuer";
|
|
413
|
-
}
|
|
414
401
|
/**
|
|
415
|
-
* Resolves the OAuth account issuer the same way better-auth
|
|
416
|
-
*
|
|
402
|
+
* Resolves the OAuth account issuer the same way better-auth 1.7.0–1.7.2 did
|
|
403
|
+
* for issuer-scoped account keys.
|
|
417
404
|
*/
|
|
418
405
|
async function resolveOAuthAccountIssuer(params) {
|
|
419
|
-
if (params.identityStrategy === "provider-id") return createOAuthAccountIssuer(params.providerId);
|
|
420
406
|
const { accountIssuer } = params;
|
|
421
407
|
if (typeof accountIssuer === "function") {
|
|
422
408
|
const issuer = await accountIssuer(params.context);
|
|
@@ -459,7 +445,7 @@ function normalizeProviderSubject(subject) {
|
|
|
459
445
|
if (!subject || subject === "undefined" || subject === "null") return;
|
|
460
446
|
return subject;
|
|
461
447
|
}
|
|
462
|
-
async function resolveAccountKey(provider, tokens, profile
|
|
448
|
+
async function resolveAccountKey(provider, tokens, profile) {
|
|
463
449
|
const keyedProvider = provider;
|
|
464
450
|
const context = {
|
|
465
451
|
tokens,
|
|
@@ -477,7 +463,6 @@ async function resolveAccountKey(provider, tokens, profile, identityStrategy) {
|
|
|
477
463
|
if (!accountId) return void 0;
|
|
478
464
|
const issuer = await resolveOAuthAccountIssuer({
|
|
479
465
|
providerId: provider.id,
|
|
480
|
-
identityStrategy,
|
|
481
466
|
accountIssuer: keyedProvider.accountIssuer,
|
|
482
467
|
context
|
|
483
468
|
});
|
|
@@ -503,8 +488,7 @@ function instrumentSocialProviders(providers) {
|
|
|
503
488
|
if (user) try {
|
|
504
489
|
const endpointCtx = await getCurrentAuthContext();
|
|
505
490
|
const adapter = endpointCtx.context.internalAdapter;
|
|
506
|
-
const
|
|
507
|
-
const accountKey = result.data && typeof adapter.findAccountOwnerByKey === "function" ? await resolveAccountKey(provider, token, result.data, identityStrategy) : void 0;
|
|
491
|
+
const accountKey = result.data && typeof adapter.findAccountOwnerByKey === "function" ? await resolveAccountKey(provider, token, result.data) : void 0;
|
|
508
492
|
endpointCtx.context[OAUTH_CALLBACK_USER] = {
|
|
509
493
|
user,
|
|
510
494
|
accountKey
|
|
@@ -4300,7 +4284,7 @@ function isVersionAtLeast(version, target) {
|
|
|
4300
4284
|
}
|
|
4301
4285
|
/**
|
|
4302
4286
|
* True for better-auth 1.7+ (including 1.8+).
|
|
4303
|
-
* Marks the cutover for
|
|
4287
|
+
* Marks the cutover for protocol-defined SSO subjects,
|
|
4304
4288
|
* `advanced.database.joins`, and post-legacy SCIM connections.
|
|
4305
4289
|
* Keep in sync with `apps/web/lib/better-auth-compat.ts`.
|
|
4306
4290
|
*/
|
|
@@ -4430,7 +4414,6 @@ const getConfig = (options) => {
|
|
|
4430
4414
|
disableCSRFCheck: ctx.context.options.advanced?.disableCSRFCheck || false,
|
|
4431
4415
|
disableOriginCheck: ctx.context.options.advanced?.disableOriginCheck || false,
|
|
4432
4416
|
allowDifferentEmails: ctx.context.options.account?.accountLinking?.enabled && ctx.context.options.account?.accountLinking?.allowDifferentEmails || false,
|
|
4433
|
-
identityStrategy: getConfiguredAccountIdentityStrategy(ctx.context.options.account),
|
|
4434
4417
|
skipStateCookieCheck: ctx.context.options.account?.skipStateCookieCheck || false,
|
|
4435
4418
|
storeStateCookieStrategy: ctx.context.options.account?.storeStateStrategy || null,
|
|
4436
4419
|
cookieCache: {
|
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-CfK70MTZ.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-DkrUdqDd.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-CfK70MTZ.mjs";
|
|
2
2
|
//#region src/dash-client.ts
|
|
3
3
|
function resolveDashUserId(input, options) {
|
|
4
4
|
return input.userId || options?.resolveUserId?.({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/infra",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Dashboard and analytics plugin for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"types": "dist/index.d.mts",
|
|
9
9
|
"sideEffects": false,
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "tsdown",
|
|
12
|
-
"dev": "tsdown --watch --no-clean",
|
|
11
|
+
"build": "bun --bun tsdown",
|
|
12
|
+
"dev": "bun --bun tsdown --watch --no-clean",
|
|
13
13
|
"typecheck": "tsc --noEmit",
|
|
14
14
|
"test": "bun test --parallel",
|
|
15
15
|
"test:watch": "bun test --watch",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"msw": "^2.14.6",
|
|
76
76
|
"tsdown": "^0.22.14",
|
|
77
77
|
"typescript": "^6.0.3",
|
|
78
|
-
"zod": "4.
|
|
78
|
+
"zod": "4.5.4"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@better-auth/utils": "^0.4.2",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@noble/hashes": "^2.2.0",
|
|
84
84
|
"@xmldom/xmldom": "^0.9.10",
|
|
85
85
|
"better-call": "1.3.7",
|
|
86
|
-
"jose": "^6.2.
|
|
86
|
+
"jose": "^6.2.10",
|
|
87
87
|
"libphonenumber-js": "^1.13.11"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|