@better-auth/infra 0.4.0 → 0.4.2
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 +18 -0
- package/README.md +4 -0
- package/dist/client.d.mts +1 -2
- package/dist/client.mjs +9 -7
- package/dist/{constants-CcJHk5SE.mjs → constants-CDhjfr8S.mjs} +1 -1
- package/dist/{crypto-CAdWFWEz.mjs → crypto-D3yZH0Cy.mjs} +21 -6
- package/dist/email.mjs +1 -1
- package/dist/{identify-client-options-RI-JiXQx.d.mts → identify-client-options-CgijjwVT.d.mts} +1 -2
- package/dist/index.d.mts +19 -4
- package/dist/index.mjs +987 -568
- package/dist/native.d.mts +1 -2
- package/dist/native.mjs +7 -6
- package/dist/{pow-retry-DZhZiYd_.mjs → pow-retry-jWGI__oh.mjs} +3 -2
- package/dist/{types-B673lCib.d.mts → types-Ddk4r5x9.d.mts} +0 -1
- package/package.json +6 -4
- package/dist/saml-policy-BTVLoTyS.mjs +0 -12
package/dist/native.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
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-CgijjwVT.mjs";
|
|
2
2
|
import { BetterAuthClientPlugin } from "better-auth";
|
|
3
|
-
|
|
4
3
|
//#region src/sentinel/native/client.d.ts
|
|
5
4
|
interface SentinelNativeClientOptions {
|
|
6
5
|
identifyUrl?: string;
|
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-D3yZH0Cy.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-jWGI__oh.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
|
|
@@ -224,12 +224,13 @@ function scheduleIdentify(send) {
|
|
|
224
224
|
}
|
|
225
225
|
const sentinelNativeClient = (options) => {
|
|
226
226
|
const autoSolve = options?.autoSolveChallenge !== false;
|
|
227
|
+
const identifyUrl = resolveSentinelClientIdentifyUrl({
|
|
228
|
+
identifyUrl: options?.identifyUrl,
|
|
229
|
+
envKvUrl: env.BETTER_AUTH_KV_URL
|
|
230
|
+
});
|
|
227
231
|
const runtime = createNativeFingerprintRuntime({
|
|
228
232
|
$kv: createKV({
|
|
229
|
-
kvUrl:
|
|
230
|
-
identifyUrl: options?.identifyUrl,
|
|
231
|
-
envKvUrl: env.BETTER_AUTH_KV_URL
|
|
232
|
-
}),
|
|
233
|
+
kvUrl: identifyUrl,
|
|
233
234
|
timeout: options?.identifyOptions?.timeout ?? options?.kvTimeout
|
|
234
235
|
}, {
|
|
235
236
|
throw: true,
|
|
@@ -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-D3yZH0Cy.mjs";
|
|
2
2
|
//#region src/dash-client.ts
|
|
3
3
|
function resolveDashUserId(input, options) {
|
|
4
4
|
return input.userId || options?.resolveUserId?.({
|
|
@@ -120,7 +120,8 @@ async function solvePoWChallenge(challenge) {
|
|
|
120
120
|
const { nonce, difficulty } = challenge;
|
|
121
121
|
let counter = 0;
|
|
122
122
|
while (true) {
|
|
123
|
-
|
|
123
|
+
const input = `${nonce}:${counter}`;
|
|
124
|
+
if (hasLeadingZeroBits(await hash(input), difficulty)) return {
|
|
124
125
|
nonce,
|
|
125
126
|
counter
|
|
126
127
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BetterAuthPlugin, GenericEndpointContext } from "better-auth";
|
|
2
2
|
import { createFetch } from "@better-fetch/fetch";
|
|
3
3
|
import { APIError as APIError$1, Endpoint, EndpointOptions } from "better-call";
|
|
4
|
-
|
|
5
4
|
//#region src/identification.d.ts
|
|
6
5
|
interface IPLocation {
|
|
7
6
|
lat: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/infra",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Dashboard and analytics plugin for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -70,19 +70,21 @@
|
|
|
70
70
|
"@types/bun": "latest",
|
|
71
71
|
"@types/node": "^24.12.0",
|
|
72
72
|
"better-auth": "1.7.0-rc.1",
|
|
73
|
-
"expo-crypto": "^
|
|
73
|
+
"expo-crypto": "^57.0.1",
|
|
74
74
|
"happy-dom": "^20.9.0",
|
|
75
75
|
"msw": "^2.14.6",
|
|
76
|
-
"tsdown": "^0.22.
|
|
76
|
+
"tsdown": "^0.22.14",
|
|
77
77
|
"typescript": "^5.9.2",
|
|
78
78
|
"zod": "4.3.6"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@better-auth/utils": "^0.4.2",
|
|
82
82
|
"@better-fetch/fetch": "1.3.1",
|
|
83
|
+
"@noble/hashes": "^2.2.0",
|
|
84
|
+
"@xmldom/xmldom": "^0.9.10",
|
|
83
85
|
"better-call": "1.3.7",
|
|
84
86
|
"jose": "^6.2.4",
|
|
85
|
-
"libphonenumber-js": "^1.13.
|
|
87
|
+
"libphonenumber-js": "^1.13.11"
|
|
86
88
|
},
|
|
87
89
|
"peerDependencies": {
|
|
88
90
|
"better-auth": ">=1.4.0",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//#region src/directory-sync/saml-policy.ts
|
|
2
|
-
/**
|
|
3
|
-
* `deriveSAMLServiceProviderPolicy` ships in `@better-auth/sso` 1.7.0-rc.4+.
|
|
4
|
-
* Load it at runtime so catalog typecheck against rc.1 still succeeds.
|
|
5
|
-
*/
|
|
6
|
-
async function requiresSignedSAMLAssertions(config) {
|
|
7
|
-
const sso = await import("@better-auth/sso");
|
|
8
|
-
if (typeof sso.deriveSAMLServiceProviderPolicy === "function") return sso.deriveSAMLServiceProviderPolicy(config).wantAssertionsSigned;
|
|
9
|
-
return config.wantAssertionsSigned === true;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { requiresSignedSAMLAssertions };
|