@entro314labs/entro-auth 1.8.0-beta.12 → 1.8.0-beta.13
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/_virtual/_rolldown/runtime.mjs +4 -4
- package/dist/api/dispatch.d.mts +1 -1
- package/dist/api/dispatch.mjs +4 -4
- package/dist/api/index.d.mts +6 -6
- package/dist/api/index.mjs +7 -7
- package/dist/api/middlewares/authorization.mjs +1 -1
- package/dist/api/middlewares/origin-check.mjs +4 -4
- package/dist/api/rate-limiter/index.mjs +1 -1
- package/dist/api/routes/account.mjs +5 -5
- package/dist/api/routes/callback.mjs +3 -3
- package/dist/api/routes/email-verification.d.mts +1 -1
- package/dist/api/routes/email-verification.mjs +6 -6
- package/dist/api/routes/error.mjs +2 -2
- package/dist/api/routes/id-token-nonce.mjs +3 -3
- package/dist/api/routes/ok.mjs +1 -1
- package/dist/api/routes/password.mjs +4 -4
- package/dist/api/routes/session.d.mts +1 -1
- package/dist/api/routes/session.mjs +3 -3
- package/dist/api/routes/sign-in.mjs +5 -5
- package/dist/api/routes/sign-out.mjs +2 -2
- package/dist/api/routes/sign-up.d.mts +1 -1
- package/dist/api/routes/sign-up.mjs +6 -6
- package/dist/api/routes/update-session.d.mts +1 -1
- package/dist/api/routes/update-session.mjs +3 -3
- package/dist/api/routes/update-user.d.mts +1 -1
- package/dist/api/routes/update-user.mjs +4 -4
- package/dist/api/to-auth-endpoints.mjs +2 -2
- package/dist/auth/base.mjs +2 -2
- package/dist/auth/full.d.mts +1 -1
- package/dist/auth/minimal.d.mts +1 -1
- package/dist/auth/trusted-origins.mjs +1 -1
- package/dist/client/config.d.mts +6 -6
- package/dist/client/config.mjs +2 -2
- package/dist/client/index.d.mts +2 -2
- package/dist/client/lynx/index.d.mts +3 -3
- package/dist/client/lynx/index.mjs +1 -1
- package/dist/client/lynx/lynx-store.d.mts +1 -1
- package/dist/client/lynx/lynx-store.mjs +1 -1
- package/dist/client/path-to-object.d.mts +3 -3
- package/dist/client/proxy.mjs +2 -2
- package/dist/client/query.d.mts +2 -2
- package/dist/client/query.mjs +1 -1
- package/dist/client/react/index.d.mts +3 -3
- package/dist/client/react/index.mjs +1 -1
- package/dist/client/react/react-store.mjs +1 -1
- package/dist/client/session-atom.d.mts +2 -2
- package/dist/client/session-atom.mjs +1 -1
- package/dist/client/solid/index.d.mts +4 -4
- package/dist/client/solid/index.mjs +1 -1
- package/dist/client/svelte/index.d.mts +4 -4
- package/dist/client/svelte/index.mjs +1 -1
- package/dist/client/types.d.mts +9 -9
- package/dist/client/vanilla.d.mts +4 -4
- package/dist/client/vanilla.mjs +1 -1
- package/dist/client/vue/index.d.mts +4 -4
- package/dist/client/vue/index.mjs +1 -1
- package/dist/context/create-context.mjs +9 -9
- package/dist/context/helpers.mjs +4 -4
- package/dist/context/init-minimal.mjs +1 -1
- package/dist/context/init.mjs +1 -1
- package/dist/context/secret-utils.mjs +1 -1
- package/dist/cookies/index.d.mts +3 -3
- package/dist/cookies/index.mjs +7 -7
- package/dist/cookies/jwt.mjs +1 -1
- package/dist/cookies/session-store.mjs +3 -3
- package/dist/crypto/index.d.mts +1 -1
- package/dist/crypto/index.mjs +4 -4
- package/dist/crypto/jwt.mjs +1 -2
- package/dist/crypto/password.d.mts +10 -5
- package/dist/crypto/password.mjs +5 -5
- package/dist/db/adapter-kysely.mjs +1 -1
- package/dist/db/get-migration.d.mts +1 -1
- package/dist/db/get-migration.mjs +6 -6
- package/dist/db/get-schema.mjs +1 -1
- package/dist/db/index.mjs +1 -1
- package/dist/db/internal-adapter.d.mts +2 -2
- package/dist/db/internal-adapter.mjs +8 -8
- package/dist/db/revoke-unproven-account-access.d.mts +1 -1
- package/dist/db/schema.d.mts +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/integrations/next-js.mjs +1 -1
- package/dist/integrations/node.d.mts +1 -1
- package/dist/integrations/svelte-kit.d.mts +1 -1
- package/dist/integrations/svelte-kit.mjs +1 -1
- package/dist/integrations/tanstack-start-solid.mjs +1 -1
- package/dist/integrations/tanstack-start.mjs +1 -1
- package/dist/oauth2/account-key.mjs +1 -2
- package/dist/oauth2/callback.mjs +1 -1
- package/dist/oauth2/link-account.d.mts +1 -1
- package/dist/oauth2/link-account.mjs +4 -4
- package/dist/oauth2/state.d.mts +1 -1
- package/dist/oauth2/state.mjs +1 -1
- package/dist/{package.mjs → package.json.mjs} +1 -1
- package/dist/plugins/access/types.d.mts +1 -1
- package/dist/plugins/admin/admin.d.mts +5 -5
- package/dist/plugins/admin/admin.mjs +2 -2
- package/dist/plugins/admin/client.d.mts +1 -1
- package/dist/plugins/admin/error-codes.d.mts +1 -1
- package/dist/plugins/admin/routes.mjs +5 -5
- package/dist/plugins/admin/types.d.mts +1 -1
- package/dist/plugins/anonymous/index.mjs +4 -4
- package/dist/plugins/anonymous/types.d.mts +2 -2
- package/dist/plugins/bearer/index.mjs +3 -3
- package/dist/plugins/captcha/index.mjs +1 -1
- package/dist/plugins/captcha/verify-handlers/captchafox.mjs +1 -1
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +1 -1
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +1 -1
- package/dist/plugins/captcha/verify-handlers/h-captcha.mjs +1 -1
- package/dist/plugins/custom-session/client.d.mts +1 -1
- package/dist/plugins/custom-session/index.mjs +1 -1
- package/dist/plugins/device-authorization/index.d.mts +8 -8
- package/dist/plugins/device-authorization/index.mjs +2 -2
- package/dist/plugins/device-authorization/routes.d.mts +2 -2
- package/dist/plugins/device-authorization/routes.mjs +5 -4
- package/dist/plugins/email-otp/index.mjs +1 -1
- package/dist/plugins/email-otp/routes.mjs +4 -4
- package/dist/plugins/generic-oauth/index.d.mts +2 -2
- package/dist/plugins/generic-oauth/index.mjs +6 -6
- package/dist/plugins/generic-oauth/providers/index.d.mts +38 -0
- package/dist/plugins/generic-oauth/providers/line.mjs +1 -1
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +2 -2
- package/dist/plugins/haveibeenpwned/index.mjs +4 -4
- package/dist/plugins/jwt/client.d.mts +3 -3
- package/dist/plugins/jwt/cookie-cache.mjs +2 -2
- package/dist/plugins/jwt/index.d.mts +2 -2
- package/dist/plugins/jwt/index.mjs +3 -3
- package/dist/plugins/jwt/sign.d.mts +1 -1
- package/dist/plugins/jwt/sign.mjs +2 -2
- package/dist/plugins/jwt/types.d.mts +2 -2
- package/dist/plugins/jwt/utils.d.mts +1 -1
- package/dist/plugins/jwt/utils.mjs +1 -1
- package/dist/plugins/jwt/verify.d.mts +1 -1
- package/dist/plugins/jwt/verify.mjs +4 -4
- package/dist/plugins/last-login-method/index.mjs +1 -1
- package/dist/plugins/magic-link/index.mjs +2 -2
- package/dist/plugins/multi-session/index.d.mts +1 -1
- package/dist/plugins/multi-session/index.mjs +2 -2
- package/dist/plugins/oauth-popup/client.d.mts +2 -2
- package/dist/plugins/oauth-popup/index.mjs +4 -4
- package/dist/plugins/oauth-proxy/index.mjs +4 -4
- package/dist/plugins/oauth-proxy/utils.mjs +1 -1
- package/dist/plugins/one-tap/client.d.mts +1 -1
- package/dist/plugins/one-tap/client.mjs +1 -1
- package/dist/plugins/one-tap/index.mjs +5 -5
- package/dist/plugins/one-time-token/index.d.mts +1 -1
- package/dist/plugins/one-time-token/index.mjs +3 -4
- package/dist/plugins/open-api/generator.d.mts +4 -4
- package/dist/plugins/open-api/generator.mjs +1 -1
- package/dist/plugins/open-api/index.mjs +1 -1
- package/dist/plugins/organization/adapter.d.mts +3 -3
- package/dist/plugins/organization/adapter.mjs +4 -4
- package/dist/plugins/organization/call.mjs +1 -1
- package/dist/plugins/organization/client.d.mts +3 -3
- package/dist/plugins/organization/client.mjs +1 -1
- package/dist/plugins/organization/has-permission.d.mts +1 -1
- package/dist/plugins/organization/has-permission.mjs +2 -2
- package/dist/plugins/organization/organization.d.mts +1 -1
- package/dist/plugins/organization/organization.mjs +3 -3
- package/dist/plugins/organization/routes/crud-access-control.d.mts +1 -1
- package/dist/plugins/organization/routes/crud-access-control.mjs +3 -3
- package/dist/plugins/organization/routes/crud-invites.d.mts +24 -24
- package/dist/plugins/organization/routes/crud-invites.mjs +4 -4
- package/dist/plugins/organization/routes/crud-members.d.mts +19 -19
- package/dist/plugins/organization/routes/crud-members.mjs +4 -4
- package/dist/plugins/organization/routes/crud-org.d.mts +16 -16
- package/dist/plugins/organization/routes/crud-org.mjs +3 -3
- package/dist/plugins/organization/routes/crud-team.d.mts +1 -1
- package/dist/plugins/organization/routes/crud-team.mjs +4 -4
- package/dist/plugins/organization/schema.d.mts +2 -2
- package/dist/plugins/organization/types.d.mts +2 -2
- package/dist/plugins/phone-number/client.d.mts +4 -4
- package/dist/plugins/phone-number/error-codes.d.mts +4 -4
- package/dist/plugins/phone-number/index.d.mts +4 -4
- package/dist/plugins/phone-number/index.mjs +2 -2
- package/dist/plugins/phone-number/routes.mjs +4 -4
- package/dist/plugins/phone-number/types.d.mts +1 -1
- package/dist/plugins/siwe/index.d.mts +1 -1
- package/dist/plugins/siwe/index.mjs +4 -4
- package/dist/plugins/test-utils/auth-helpers.mjs +1 -1
- package/dist/plugins/test-utils/cookie-builder.mjs +2 -4
- package/dist/plugins/two-factor/backup-codes/index.d.mts +1 -1
- package/dist/plugins/two-factor/backup-codes/index.mjs +4 -4
- package/dist/plugins/two-factor/claim.d.mts +1 -1
- package/dist/plugins/two-factor/claim.mjs +1 -1
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/index.d.mts +4 -4
- package/dist/plugins/two-factor/index.mjs +6 -6
- package/dist/plugins/two-factor/otp/index.d.mts +1 -1
- package/dist/plugins/two-factor/otp/index.mjs +3 -3
- package/dist/plugins/two-factor/totp/index.d.mts +1 -1
- package/dist/plugins/two-factor/totp/index.mjs +5 -5
- package/dist/plugins/two-factor/types.d.mts +1 -1
- package/dist/plugins/two-factor/verify-two-factor.d.mts +1 -1
- package/dist/plugins/two-factor/verify-two-factor.mjs +2 -2
- package/dist/plugins/username/client.d.mts +1 -1
- package/dist/plugins/username/error-codes.d.mts +1 -1
- package/dist/plugins/username/index.d.mts +6 -6
- package/dist/plugins/username/index.mjs +4 -4
- package/dist/plugins/username/schema.d.mts +4 -4
- package/dist/state.d.mts +2 -2
- package/dist/state.mjs +3 -3
- package/dist/test-utils/http-test-instance.d.mts +7 -7
- package/dist/test-utils/http-test-instance.mjs +1 -1
- package/dist/test-utils/test-instance.d.mts +2 -2
- package/dist/test-utils/test-instance.mjs +4 -4
- package/dist/types/adapter.d.mts +2 -2
- package/dist/types/api.d.mts +1 -1
- package/dist/types/auth.d.mts +2 -2
- package/dist/types/index.d.mts +1 -1
- package/dist/types/models.d.mts +3 -3
- package/dist/types/plugins.d.mts +1 -1
- package/dist/utils/hashing.mjs +1 -1
- package/dist/utils/url.mjs +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +28 -28
package/dist/client/query.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BetterFetch, BetterFetchError } from "@better-fetch/fetch";
|
|
2
2
|
import { ClientFetchOption } from "@entro314labs/entro-auth-core";
|
|
3
3
|
import { PreinitializedWritableAtom } from "nanostores";
|
|
4
|
-
import {
|
|
4
|
+
import { SessionQueryParams } from "./types.mjs";
|
|
5
5
|
export type AuthQueryState<T> = {
|
|
6
6
|
data: null | T;
|
|
7
7
|
error: null | BetterFetchError;
|
package/dist/client/query.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { onMount } from "nanostores";
|
|
1
2
|
import { isJsonEqual, withEquality } from "./equality.mjs";
|
|
2
3
|
import { createAuthQueryAtom } from "./query-atom.mjs";
|
|
3
|
-
import { onMount } from "nanostores";
|
|
4
4
|
// src/client/query.ts
|
|
5
5
|
const isServer = () => typeof window === "undefined";
|
|
6
6
|
function isAuthQueryStateEqual(a, b) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
2
|
+
import { EntroAuthClientOptions } from "@entro314labs/entro-auth-core";
|
|
3
|
+
import { BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
1
4
|
import { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection } from "../../types/helper.mjs";
|
|
2
5
|
import { getClientConfig } from "../config.mjs";
|
|
3
6
|
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
4
7
|
import { useStore } from "./react-store.mjs";
|
|
5
|
-
import { EntroAuthClientOptions } from "@entro314labs/entro-auth-core";
|
|
6
|
-
import { BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
7
|
-
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
8
8
|
export type * from "nanostores";
|
|
9
9
|
export type * from "@better-fetch/fetch";
|
|
10
10
|
type InferResolvedHooks<O extends EntroAuthClientOptions> = O extends {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { capitalizeFirstLetter } from "@entro314labs/entro-auth-core/utils/string";
|
|
1
2
|
import { getClientConfig } from "../config.mjs";
|
|
2
3
|
import { createDynamicPathProxy } from "../proxy.mjs";
|
|
3
4
|
import { useStore } from "./react-store.mjs";
|
|
4
|
-
import { capitalizeFirstLetter } from "@entro314labs/entro-auth-core/utils/string";
|
|
5
5
|
// src/client/react/index.ts
|
|
6
6
|
function getAtomKey(str) {
|
|
7
7
|
return `use${capitalizeFirstLetter(str)}`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isAuthQueryStore } from "../query-atom.mjs";
|
|
2
1
|
import { listenKeys } from "nanostores";
|
|
3
2
|
import { useCallback, useRef, useSyncExternalStore } from "react";
|
|
3
|
+
import { isAuthQueryStore } from "../query-atom.mjs";
|
|
4
4
|
// src/client/react/react-store.ts
|
|
5
5
|
/**
|
|
6
6
|
* Subscribe to store changes and get store's value.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Session, User } from "../types/models.mjs";
|
|
2
|
+
import "@better-fetch/fetch";
|
|
3
|
+
import "@entro314labs/entro-auth-core";
|
|
2
4
|
import "../types/index.mjs";
|
|
3
5
|
import "./query.mjs";
|
|
4
|
-
import { EntroAuthClientOptions } from "@entro314labs/entro-auth-core";
|
|
5
|
-
import { BetterFetch } from "@better-fetch/fetch";
|
|
6
6
|
export type SessionData = {
|
|
7
7
|
user: User;
|
|
8
8
|
session: Session;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { STORE_UNMOUNT_DELAY, atom, onMount } from "nanostores";
|
|
1
2
|
import { isJsonEqual, withEquality } from "./equality.mjs";
|
|
2
3
|
import { createAuthQueryAtom } from "./query-atom.mjs";
|
|
3
4
|
import { createSessionRefreshManager } from "./session-refresh.mjs";
|
|
4
|
-
import { STORE_UNMOUNT_DELAY, atom, onMount } from "nanostores";
|
|
5
5
|
// src/client/session-atom.ts
|
|
6
6
|
const isServer = () => typeof window === "undefined";
|
|
7
7
|
const SESSION_MOUNT_DEDUPE_INTERVAL = STORE_UNMOUNT_DELAY;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getClientConfig } from "../config.mjs";
|
|
3
|
-
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
1
|
+
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
4
2
|
import { EntroAuthClientOptions } from "@entro314labs/entro-auth-core";
|
|
5
3
|
import { BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
6
|
-
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
7
4
|
import { Accessor } from "solid-js";
|
|
5
|
+
import { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection } from "../../types/helper.mjs";
|
|
6
|
+
import { getClientConfig } from "../config.mjs";
|
|
7
|
+
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
8
8
|
export type * from "nanostores";
|
|
9
9
|
export type * from "@better-fetch/fetch";
|
|
10
10
|
type InferResolvedHooks<O extends EntroAuthClientOptions> = O extends {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { capitalizeFirstLetter } from "@entro314labs/entro-auth-core/utils/string";
|
|
1
2
|
import { getClientConfig } from "../config.mjs";
|
|
2
3
|
import { createDynamicPathProxy } from "../proxy.mjs";
|
|
3
4
|
import { useStore } from "./solid-store.mjs";
|
|
4
|
-
import { capitalizeFirstLetter } from "@entro314labs/entro-auth-core/utils/string";
|
|
5
5
|
// src/client/solid/index.ts
|
|
6
6
|
function getAtomKey(str) {
|
|
7
7
|
return `use${capitalizeFirstLetter(str)}`;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getClientConfig } from "../config.mjs";
|
|
3
|
-
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
1
|
+
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
4
2
|
import { EntroAuthClientOptions } from "@entro314labs/entro-auth-core";
|
|
5
3
|
import { BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
6
4
|
import { Atom } from "nanostores";
|
|
7
|
-
import {
|
|
5
|
+
import { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection } from "../../types/helper.mjs";
|
|
6
|
+
import { getClientConfig } from "../config.mjs";
|
|
7
|
+
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
8
8
|
export type * from "nanostores";
|
|
9
9
|
export type * from "@better-fetch/fetch";
|
|
10
10
|
type InferResolvedHooks<O extends EntroAuthClientOptions> = O extends {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { capitalizeFirstLetter } from "@entro314labs/entro-auth-core/utils/string";
|
|
1
2
|
import { getClientConfig } from "../config.mjs";
|
|
2
3
|
import { createDynamicPathProxy } from "../proxy.mjs";
|
|
3
|
-
import { capitalizeFirstLetter } from "@entro314labs/entro-auth-core/utils/string";
|
|
4
4
|
// src/client/svelte/index.ts
|
|
5
5
|
function createAuthClient(options) {
|
|
6
6
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, atomListeners, $store } = getClientConfig(options);
|
package/dist/client/types.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { ClientAtomListener, ClientStore, EntroAuthClientOptions, EntroAuthClientPlugin } from "@entro314labs/entro-auth-core";
|
|
2
|
+
import { DBFieldAttribute, InferDBFieldsOutput } from "@entro314labs/entro-auth-core/db";
|
|
1
3
|
import { InferFieldsInputClient } from "../db/field.mjs";
|
|
2
4
|
import "../types/index.mjs";
|
|
3
5
|
import { StripEmptyObjects, UnionToIntersection } from "../types/helper.mjs";
|
|
4
6
|
import { Session as Session$1, User as User$1 } from "../types/models.mjs";
|
|
5
7
|
import { Auth } from "../types/auth.mjs";
|
|
6
8
|
import { InferRoutes } from "./path-to-object.mjs";
|
|
7
|
-
import { ClientAtomListener as ClientAtomListener$1, ClientStore as ClientStore$1, EntroAuthClientOptions as EntroAuthClientOptions$1, EntroAuthClientPlugin } from "@entro314labs/entro-auth-core";
|
|
8
|
-
import { DBFieldAttribute, InferDBFieldsOutput } from "@entro314labs/entro-auth-core/db";
|
|
9
9
|
type ClientPluginError<K extends string = string> = {
|
|
10
10
|
readonly code: K;
|
|
11
11
|
message: string;
|
|
@@ -15,15 +15,15 @@ type InferPluginEndpoints<Plugins> = Plugins extends Array<infer Pl> ? UnionToIn
|
|
|
15
15
|
} ? Plug extends {
|
|
16
16
|
endpoints?: infer Endpoints;
|
|
17
17
|
} ? Endpoints extends Record<string, unknown> ? Endpoints : {} : {} : {}> : {};
|
|
18
|
-
export type InferClientAPI<O extends EntroAuthClientOptions
|
|
19
|
-
export type InferActions<O extends EntroAuthClientOptions
|
|
18
|
+
export type InferClientAPI<O extends EntroAuthClientOptions> = InferRoutes<O["plugins"] extends Array<any> ? Omit<Auth["api"], keyof InferPluginEndpoints<O["plugins"]>> & InferPluginEndpoints<O["plugins"]> : Auth["api"], O>;
|
|
19
|
+
export type InferActions<O extends EntroAuthClientOptions> = (O["plugins"] extends Array<infer Plugin> ? UnionToIntersection<Plugin extends {
|
|
20
20
|
getActions?: infer GetActions;
|
|
21
21
|
} ? GetActions extends ((...args: any) => infer Actions) ? Actions : {} : {}> : {}) & InferRoutes<O["$InferAuth"] extends {
|
|
22
22
|
plugins: infer Plugins;
|
|
23
23
|
} ? Plugins extends Array<infer Plugin> ? Plugin extends {
|
|
24
24
|
endpoints?: infer Endpoints;
|
|
25
25
|
} ? Endpoints extends Record<string, unknown> ? Endpoints : {} : {} : {} : {}, O>;
|
|
26
|
-
export type InferErrorCodes<O extends EntroAuthClientOptions
|
|
26
|
+
export type InferErrorCodes<O extends EntroAuthClientOptions> = O["plugins"] extends Array<infer Plugin> ? UnionToIntersection<Plugin extends {
|
|
27
27
|
$InferServerPlugin?: infer ServerPlugin;
|
|
28
28
|
} ? ServerPlugin extends {
|
|
29
29
|
$ERROR_CODES?: infer E;
|
|
@@ -33,9 +33,9 @@ export type InferErrorCodes<O extends EntroAuthClientOptions$1> = O["plugins"] e
|
|
|
33
33
|
* as a convention they start with "$"
|
|
34
34
|
*/
|
|
35
35
|
export type IsSignal<T> = T extends `$${infer _}` ? true : false;
|
|
36
|
-
export type InferSessionFromClient<O extends EntroAuthClientOptions
|
|
37
|
-
export type InferUserFromClient<O extends EntroAuthClientOptions
|
|
38
|
-
export type InferAdditionalFromClient<Options extends EntroAuthClientOptions
|
|
36
|
+
export type InferSessionFromClient<O extends EntroAuthClientOptions> = StripEmptyObjects<Session$1 & UnionToIntersection<InferAdditionalFromClient<O, "session", "output">>>;
|
|
37
|
+
export type InferUserFromClient<O extends EntroAuthClientOptions> = StripEmptyObjects<User$1 & UnionToIntersection<InferAdditionalFromClient<O, "user", "output">>>;
|
|
38
|
+
export type InferAdditionalFromClient<Options extends EntroAuthClientOptions, Key extends string, Format extends "input" | "output" = "output"> = Options["plugins"] extends Array<infer Plugin> ? Plugin extends {
|
|
39
39
|
$InferServerPlugin?: infer ServerPlugin;
|
|
40
40
|
} ? ServerPlugin extends {
|
|
41
41
|
schema?: infer Schema;
|
|
@@ -46,4 +46,4 @@ export type SessionQueryParams = {
|
|
|
46
46
|
disableCookieCache?: boolean | undefined;
|
|
47
47
|
disableRefresh?: boolean | undefined;
|
|
48
48
|
};
|
|
49
|
-
export type { ClientAtomListener
|
|
49
|
+
export type { ClientAtomListener, ClientStore, EntroAuthClientOptions, EntroAuthClientPlugin };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getClientConfig } from "./config.mjs";
|
|
3
|
-
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "./types.mjs";
|
|
1
|
+
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
4
2
|
import { EntroAuthClientOptions } from "@entro314labs/entro-auth-core";
|
|
5
3
|
import { BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
6
4
|
import { Atom } from "nanostores";
|
|
7
|
-
import {
|
|
5
|
+
import { PrettifyDeep, UnionToIntersection } from "../types/helper.mjs";
|
|
6
|
+
import { getClientConfig } from "./config.mjs";
|
|
7
|
+
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "./types.mjs";
|
|
8
8
|
type InferResolvedHooks<O extends EntroAuthClientOptions> = O extends {
|
|
9
9
|
plugins: Array<infer Plugin>;
|
|
10
10
|
} ? UnionToIntersection<Plugin extends {
|
package/dist/client/vanilla.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { capitalizeFirstLetter } from "@entro314labs/entro-auth-core/utils/string";
|
|
1
2
|
import { getClientConfig } from "./config.mjs";
|
|
2
3
|
import { createDynamicPathProxy } from "./proxy.mjs";
|
|
3
|
-
import { capitalizeFirstLetter } from "@entro314labs/entro-auth-core/utils/string";
|
|
4
4
|
// src/client/vanilla.ts
|
|
5
5
|
function createAuthClient(options) {
|
|
6
6
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getClientConfig } from "../config.mjs";
|
|
3
|
-
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
1
|
+
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
4
2
|
import { EntroAuthClientOptions } from "@entro314labs/entro-auth-core";
|
|
5
3
|
import { BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
6
|
-
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
7
4
|
import { DeepReadonly, Ref, WatchSource } from "vue";
|
|
5
|
+
import { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection } from "../../types/helper.mjs";
|
|
6
|
+
import { getClientConfig } from "../config.mjs";
|
|
7
|
+
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
8
8
|
export type * from "nanostores";
|
|
9
9
|
export type * from "@better-fetch/fetch";
|
|
10
10
|
type InferResolvedHooks<O extends EntroAuthClientOptions> = O extends {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { capitalizeFirstLetter } from "@entro314labs/entro-auth-core/utils/string";
|
|
1
2
|
import { trimTrailingSlashes } from "../../utils/url.mjs";
|
|
2
3
|
import { getClientConfig } from "../config.mjs";
|
|
3
4
|
import { createDynamicPathProxy } from "../proxy.mjs";
|
|
4
5
|
import { useStore } from "./vue-store.mjs";
|
|
5
|
-
import { capitalizeFirstLetter } from "@entro314labs/entro-auth-core/utils/string";
|
|
6
6
|
// src/client/vue/index.ts
|
|
7
7
|
function getAtomKey(str) {
|
|
8
8
|
return `use${capitalizeFirstLetter(str)}`;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { getEntroAuthVersion } from "@entro314labs/entro-auth-core/context";
|
|
2
|
+
import { getAuthTables } from "@entro314labs/entro-auth-core/db";
|
|
3
|
+
import { runtimeSchemaCheckFor, schemaCheckFor } from "@entro314labs/entro-auth-core/db/internal";
|
|
4
|
+
import { createLogger, env, isProduction, isTest } from "@entro314labs/entro-auth-core/env";
|
|
5
|
+
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
6
|
+
import { socialProviders } from "@entro314labs/entro-auth-core/social-providers";
|
|
7
|
+
import { generateId } from "@entro314labs/entro-auth-core/utils/id";
|
|
8
|
+
import { findInvalidTrustedProxies } from "@entro314labs/entro-auth-core/utils/ip";
|
|
9
|
+
import defu from "defu";
|
|
1
10
|
import { checkEndpointConflicts } from "../api/index.mjs";
|
|
2
11
|
import { matchesOriginPattern } from "../auth/trusted-origins.mjs";
|
|
3
12
|
import { createCookieGetter, getCookies } from "../cookies/index.mjs";
|
|
@@ -10,15 +19,6 @@ import { getBaseURL, isDynamicBaseURLConfig } from "../utils/url.mjs";
|
|
|
10
19
|
import { getInternalPlugins, getTrustedOrigins, getTrustedProviders, runPluginInit } from "./helpers.mjs";
|
|
11
20
|
import { buildSecretConfig, parseSecretsEnv, validateSecretsArray } from "./secret-utils.mjs";
|
|
12
21
|
import { hasServerSessionStore } from "./store-capabilities.mjs";
|
|
13
|
-
import { getEntroAuthVersion } from "@entro314labs/entro-auth-core/context";
|
|
14
|
-
import { getAuthTables } from "@entro314labs/entro-auth-core/db";
|
|
15
|
-
import { createLogger, env, isProduction, isTest } from "@entro314labs/entro-auth-core/env";
|
|
16
|
-
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
17
|
-
import { generateId } from "@entro314labs/entro-auth-core/utils/id";
|
|
18
|
-
import { runtimeSchemaCheckFor, schemaCheckFor } from "@entro314labs/entro-auth-core/db/internal";
|
|
19
|
-
import { socialProviders } from "@entro314labs/entro-auth-core/social-providers";
|
|
20
|
-
import { findInvalidTrustedProxies } from "@entro314labs/entro-auth-core/utils/ip";
|
|
21
|
-
import defu from "defu";
|
|
22
22
|
// src/context/create-context.ts
|
|
23
23
|
/**
|
|
24
24
|
* Estimates the entropy of a string in bits.
|
package/dist/context/helpers.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { env } from "@entro314labs/entro-auth-core/env";
|
|
2
|
+
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
3
|
+
import { isLoopbackHost } from "@entro314labs/entro-auth-core/utils/host";
|
|
4
|
+
import { defu as defu$1 } from "defu";
|
|
1
5
|
import { createCookieGetter, getCookies } from "../cookies/index.mjs";
|
|
2
6
|
import { createInternalAdapter } from "../db/internal-adapter.mjs";
|
|
3
7
|
import { isPromise } from "../utils/is-promise.mjs";
|
|
4
8
|
import { getBaseURL, getOrigin, isDynamicBaseURLConfig, isRequestLike, resolveBaseURL } from "../utils/url.mjs";
|
|
5
|
-
import { env } from "@entro314labs/entro-auth-core/env";
|
|
6
|
-
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
7
|
-
import { defu as defu$1 } from "defu";
|
|
8
|
-
import { isLoopbackHost } from "@entro314labs/entro-auth-core/utils/host";
|
|
9
9
|
// src/context/helpers.ts
|
|
10
10
|
async function runPluginInit(context) {
|
|
11
11
|
let options = context.options;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
1
2
|
import { getBaseAdapter } from "../db/adapter-base.mjs";
|
|
2
3
|
import { createAuthContext } from "./create-context.mjs";
|
|
3
|
-
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
4
4
|
// src/context/init-minimal.ts
|
|
5
5
|
const initMinimal = async (options) => {
|
|
6
6
|
const adapter = await getBaseAdapter(options, async () => {
|
package/dist/context/init.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
1
2
|
import { getAdapter } from "../db/adapter-kysely.mjs";
|
|
2
3
|
import { getMigrations } from "../db/get-migration.mjs";
|
|
3
4
|
import { createAuthContext } from "./create-context.mjs";
|
|
4
|
-
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
5
5
|
// src/context/init.ts
|
|
6
6
|
const init = async (options) => {
|
|
7
7
|
const adapter = await getAdapter(options);
|
package/dist/cookies/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Session, User } from "../types/models.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
|
-
import { CookieAttributes, HOST_COOKIE_PREFIX, SECURE_COOKIE_PREFIX, applySetCookies, cookieNameRegex, parseCookies, parseSetCookieHeader, setCookieToHeader, setRequestCookie, splitSetCookieHeader, stripSecureCookiePrefix, toCookieOptions } from "./cookie-utils.mjs";
|
|
4
|
-
import { createSessionStore, getAccountCookie, getChunkedCookie, setAccountCookie } from "./session-store.mjs";
|
|
5
2
|
import { Awaitable, CookieCachePayload, EntroAuthCookie, EntroAuthCookies, EntroAuthOptions, GenericEndpointContext } from "@entro314labs/entro-auth-core";
|
|
6
3
|
import { CookieOptions } from "better-call";
|
|
7
4
|
import { JSONWebKeySet } from "jose";
|
|
5
|
+
import "../types/index.mjs";
|
|
6
|
+
import { CookieAttributes, HOST_COOKIE_PREFIX, SECURE_COOKIE_PREFIX, applySetCookies, cookieNameRegex, parseCookies, parseSetCookieHeader, setCookieToHeader, setRequestCookie, splitSetCookieHeader, stripSecureCookiePrefix, toCookieOptions } from "./cookie-utils.mjs";
|
|
7
|
+
import { createSessionStore, getAccountCookie, getChunkedCookie, setAccountCookie } from "./session-store.mjs";
|
|
8
8
|
export declare function createCookieGetter(options: EntroAuthOptions): (cookieName: string, overrideAttributes?: Partial<CookieOptions>) => {
|
|
9
9
|
name: string;
|
|
10
10
|
attributes: {
|
package/dist/cookies/index.mjs
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { base64Url } from "@better-auth/utils/base64";
|
|
2
|
+
import { binary } from "@better-auth/utils/binary";
|
|
3
|
+
import { createHMAC } from "@better-auth/utils/hmac";
|
|
4
|
+
import { env, isProduction } from "@entro314labs/entro-auth-core/env";
|
|
5
|
+
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
6
|
+
import { filterOutputFields } from "@entro314labs/entro-auth-core/utils/db";
|
|
7
|
+
import { safeJSONParse } from "@entro314labs/entro-auth-core/utils/json";
|
|
1
8
|
import { shouldBindAccountCookieToSessionUser } from "../context/store-capabilities.mjs";
|
|
2
9
|
import { signJWT, symmetricDecodeJWT, symmetricEncodeJWT, verifyJWT } from "../crypto/jwt.mjs";
|
|
3
10
|
import { parseUserOutput } from "../db/schema.mjs";
|
|
@@ -9,13 +16,6 @@ import { parseCompactCookieCache, parseCookieCachePayload } from "./cache.mjs";
|
|
|
9
16
|
import { HOST_COOKIE_PREFIX, SECURE_COOKIE_PREFIX, applySetCookies, cookieNameRegex, parseCookies, parseSetCookieHeader, setCookieToHeader, setRequestCookie, splitSetCookieHeader, stripSecureCookiePrefix, toCookieOptions } from "./cookie-utils.mjs";
|
|
10
17
|
import { verifySessionCookieJwtWithJwks } from "./jwt.mjs";
|
|
11
18
|
import { createAccountStore, createSessionStore, getAccountCookie, getChunkedCookie, setAccountCookie } from "./session-store.mjs";
|
|
12
|
-
import { env, isProduction } from "@entro314labs/entro-auth-core/env";
|
|
13
|
-
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
14
|
-
import { safeJSONParse } from "@entro314labs/entro-auth-core/utils/json";
|
|
15
|
-
import { base64Url } from "@better-auth/utils/base64";
|
|
16
|
-
import { binary } from "@better-auth/utils/binary";
|
|
17
|
-
import { createHMAC } from "@better-auth/utils/hmac";
|
|
18
|
-
import { filterOutputFields } from "@entro314labs/entro-auth-core/utils/db";
|
|
19
19
|
// src/cookies/index.ts
|
|
20
20
|
function createCookieGetter(options) {
|
|
21
21
|
const baseURLString = typeof options.baseURL === "string" ? options.baseURL : void 0;
|
package/dist/cookies/jwt.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { parseCookieCachePayload } from "./cache.mjs";
|
|
2
1
|
import { decodeProtectedHeader, importJWK, jwtVerify } from "jose";
|
|
2
|
+
import { parseCookieCachePayload } from "./cache.mjs";
|
|
3
3
|
// src/cookies/jwt.ts
|
|
4
4
|
const SESSION_COOKIE_JWT_TYPE = "entro-auth.session-cache+jwt";
|
|
5
5
|
const SESSION_COOKIE_JWT_AUDIENCE = "entro-auth:session-cache";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { symmetricDecodeJWT, symmetricEncodeJWT } from "../crypto/jwt.mjs";
|
|
2
|
-
import { parseCookies } from "./cookie-utils.mjs";
|
|
3
1
|
import { safeJSONParse } from "@entro314labs/entro-auth-core/utils/json";
|
|
4
2
|
import { serializeCookie } from "better-call";
|
|
5
3
|
import * as z from "zod";
|
|
4
|
+
import { symmetricDecodeJWT, symmetricEncodeJWT } from "../crypto/jwt.mjs";
|
|
5
|
+
import { parseCookies } from "./cookie-utils.mjs";
|
|
6
6
|
// src/cookies/session-store.ts
|
|
7
7
|
/**
|
|
8
8
|
* Per-cookie byte ceiling.
|
|
@@ -52,7 +52,7 @@ function readExistingChunks(cookieName, ctx) {
|
|
|
52
52
|
*/
|
|
53
53
|
function chunkCookie(storeName, cookie, chunks, logger) {
|
|
54
54
|
const chunkSize = getMaxCookieValueSize(`${cookie.name}.99`, cookie.attributes);
|
|
55
|
-
const chunkCount = chunkSize > 0 ? Math.ceil(cookie.value.length / chunkSize) :
|
|
55
|
+
const chunkCount = chunkSize > 0 ? Math.ceil(cookie.value.length / chunkSize) : 1e400;
|
|
56
56
|
if (chunkCount <= 1) {
|
|
57
57
|
chunks[cookie.name] = cookie.value;
|
|
58
58
|
return [cookie];
|
package/dist/crypto/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { SecretConfig } from "@entro314labs/entro-auth-core";
|
|
1
2
|
import { deriveEncryptionKey } from "./purpose.mjs";
|
|
2
3
|
import { constantTimeEqual } from "./buffer.mjs";
|
|
3
4
|
import { signJWT, symmetricDecodeJWT, symmetricEncodeJWT, verifyJWT } from "./jwt.mjs";
|
|
4
5
|
import { hashPassword, verifyPassword } from "./password.mjs";
|
|
5
6
|
import { generateRandomString } from "./random.mjs";
|
|
6
|
-
import { SecretConfig } from "@entro314labs/entro-auth-core";
|
|
7
7
|
export declare function parseEnvelope(data: string): {
|
|
8
8
|
version: number;
|
|
9
9
|
ciphertext: string;
|
package/dist/crypto/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { getWebcryptoSubtle } from "@better-auth/utils";
|
|
2
|
+
import { createHash } from "@better-auth/utils/hash";
|
|
3
|
+
import { xchacha20poly1305 } from "@noble/ciphers/chacha.js";
|
|
4
|
+
import { bytesToHex, hexToBytes, managedNonce, utf8ToBytes } from "@noble/ciphers/utils.js";
|
|
1
5
|
import { deriveEncryptionKey } from "./purpose.mjs";
|
|
2
6
|
import { constantTimeEqual } from "./buffer.mjs";
|
|
3
7
|
import { signJWT, symmetricDecodeJWT, symmetricEncodeJWT, verifyJWT } from "./jwt.mjs";
|
|
4
8
|
import { hashPassword, verifyPassword } from "./password.mjs";
|
|
5
9
|
import { generateRandomString } from "./random.mjs";
|
|
6
|
-
import { getWebcryptoSubtle } from "@better-auth/utils";
|
|
7
|
-
import { createHash } from "@better-auth/utils/hash";
|
|
8
|
-
import { xchacha20poly1305 } from "@noble/ciphers/chacha.js";
|
|
9
|
-
import { bytesToHex, hexToBytes, managedNonce, utf8ToBytes } from "@noble/ciphers/utils.js";
|
|
10
10
|
// src/crypto/index.ts
|
|
11
11
|
const algorithm = {
|
|
12
12
|
name: "HMAC",
|
package/dist/crypto/jwt.mjs
CHANGED
|
@@ -128,8 +128,7 @@ async function symmetricDecodeJWT(token, secret, salt) {
|
|
|
128
128
|
const secrets = getAllSecrets(secret);
|
|
129
129
|
if (secrets.length <= 1) return null;
|
|
130
130
|
for (let i = 1; i < secrets.length; i++) try {
|
|
131
|
-
const
|
|
132
|
-
const encryptionSecret = deriveEncryptionSecret(s.value, salt);
|
|
131
|
+
const encryptionSecret = deriveEncryptionSecret(secrets[i].value, salt);
|
|
133
132
|
const { payload } = await jwtDecrypt(token, encryptionSecret, jwtDecryptOpts);
|
|
134
133
|
return payload;
|
|
135
134
|
} catch {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `@better-auth/utils/password` uses the "node" export condition in package.json
|
|
3
|
+
* to automatically pick the right implementation:
|
|
4
|
+
* - Node.js / Bun / Deno → `node:crypto scrypt` (libuv thread pool, non-blocking)
|
|
5
|
+
* - Unsupported runtimes → `@noble/hashes scrypt` (pure JS fallback)
|
|
6
|
+
*/
|
|
7
|
+
import { hashPassword as hashPassword$1 } from "@better-auth/utils/password";
|
|
8
|
+
export declare const hashPassword: typeof hashPassword$1;
|
|
9
|
+
export declare const verifyPassword: ({ hash, password }: {
|
|
4
10
|
hash: string;
|
|
5
11
|
password: string;
|
|
6
|
-
}) => Promise<boolean>;
|
|
7
|
-
export { hashPassword$1 as hashPassword, verifyPassword$1 as verifyPassword };
|
|
12
|
+
}) => Promise<boolean>;
|
package/dist/crypto/password.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hashPassword, verifyPassword } from "@better-auth/utils/password";
|
|
1
|
+
import { hashPassword as hashPassword$1, verifyPassword as verifyPassword$1 } from "@better-auth/utils/password";
|
|
2
2
|
// src/crypto/password.ts
|
|
3
3
|
/**
|
|
4
4
|
* `@better-auth/utils/password` uses the "node" export condition in package.json
|
|
@@ -6,8 +6,8 @@ import { hashPassword, verifyPassword } from "@better-auth/utils/password";
|
|
|
6
6
|
* - Node.js / Bun / Deno → `node:crypto scrypt` (libuv thread pool, non-blocking)
|
|
7
7
|
* - Unsupported runtimes → `@noble/hashes scrypt` (pure JS fallback)
|
|
8
8
|
*/
|
|
9
|
-
const hashPassword
|
|
10
|
-
const verifyPassword
|
|
11
|
-
return verifyPassword(hash, password);
|
|
9
|
+
const hashPassword = hashPassword$1;
|
|
10
|
+
const verifyPassword = async ({ hash, password }) => {
|
|
11
|
+
return verifyPassword$1(hash, password);
|
|
12
12
|
};
|
|
13
|
-
export { hashPassword
|
|
13
|
+
export { hashPassword, verifyPassword };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getBaseAdapter } from "./adapter-base.mjs";
|
|
2
1
|
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
2
|
+
import { getBaseAdapter } from "./adapter-base.mjs";
|
|
3
3
|
// src/db/adapter-kysely.ts
|
|
4
4
|
async function getAdapter(options) {
|
|
5
5
|
return getBaseAdapter(options, async (opts) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EntroAuthOptions } from "@entro314labs/entro-auth-core";
|
|
2
2
|
import { DBFieldAttribute, DBFieldType } from "@entro314labs/entro-auth-core/db";
|
|
3
|
-
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
4
3
|
import { ResolvedDBTableIndex } from "@entro314labs/entro-auth-core/db/internal";
|
|
4
|
+
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
5
5
|
import { KyselyDatabaseType } from "@entro314labs/entro-auth-kysely-adapter";
|
|
6
6
|
/**
|
|
7
7
|
* Thrown when {@link getMigrations} refuses to add a required column with no
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { buildSchema } from "./get-schema.mjs";
|
|
2
|
-
import { createLogger } from "@entro314labs/entro-auth-core/env";
|
|
3
|
-
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
4
1
|
import { initGetFieldName, initGetModelName } from "@entro314labs/entro-auth-core/db/adapter";
|
|
5
2
|
import { diffSchema, formatSchemaFinding, getDatabaseFieldIndexName, getDatabaseIndexStringLength, getPortableDatabaseIdentifierKey, invalidateSchemaChecks } from "@entro314labs/entro-auth-core/db/internal";
|
|
3
|
+
import { createLogger } from "@entro314labs/entro-auth-core/env";
|
|
4
|
+
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
6
5
|
import { createKyselyAdapter, getMssqlSchema, getPostgresSchema, introspectPostgresTables, toIntrospectedTables, toPhysicalSchema } from "@entro314labs/entro-auth-kysely-adapter";
|
|
7
6
|
import { sql } from "kysely";
|
|
7
|
+
import { buildSchema } from "./get-schema.mjs";
|
|
8
8
|
// src/db/get-migration.ts
|
|
9
9
|
const map = {
|
|
10
10
|
postgres: {
|
|
@@ -448,9 +448,9 @@ async function getMigrations(config, { throwOnUnsafe = true } = {}) {
|
|
|
448
448
|
const tableData = {
|
|
449
449
|
table: key,
|
|
450
450
|
fields: value.fields,
|
|
451
|
-
order: value.order ||
|
|
451
|
+
order: value.order || 1e400
|
|
452
452
|
};
|
|
453
|
-
const insertIndex = toBeCreated.findIndex((t) => (t.order ||
|
|
453
|
+
const insertIndex = toBeCreated.findIndex((t) => (t.order || 1e400) > tableData.order);
|
|
454
454
|
if (insertIndex === -1) {
|
|
455
455
|
if (tIndex === -1) toBeCreated.push(tableData);
|
|
456
456
|
else toBeCreated[tIndex].fields = {
|
|
@@ -474,7 +474,7 @@ async function getMigrations(config, { throwOnUnsafe = true } = {}) {
|
|
|
474
474
|
if (Object.keys(toBeAddedFields).length > 0) toBeAdded.push({
|
|
475
475
|
table: key,
|
|
476
476
|
fields: toBeAddedFields,
|
|
477
|
-
order: value.order ||
|
|
477
|
+
order: value.order || 1e400
|
|
478
478
|
});
|
|
479
479
|
}
|
|
480
480
|
const migrations = [];
|
package/dist/db/get-schema.mjs
CHANGED
package/dist/db/index.mjs
CHANGED
|
@@ -28,7 +28,7 @@ var db_exports = /* @__PURE__ */ __exportAll({
|
|
|
28
28
|
parseUserOutput: () => parseUserOutput,
|
|
29
29
|
revokeUnprovenAccountAccess: () => revokeUnprovenAccountAccess,
|
|
30
30
|
toZodSchema: () => toZodSchema
|
|
31
|
-
});
|
|
31
|
+
}, 2);
|
|
32
32
|
import * as import__entro314labs_entro_auth_core_db from "@entro314labs/entro-auth-core/db";
|
|
33
33
|
__reExport(db_exports, import__entro314labs_entro_auth_core_db);
|
|
34
34
|
export { buildSyntheticUserOutput, convertFromDB, convertToDB, createInternalAdapter, db_exports, getSchema, getSessionDefaultFields, getWithHooks, mergeSchema, parseAccountInput, parseAccountOutput, parseAdditionalUserInput, parseAdditionalUserInputFromProviderProfile, parseInputData, parseSessionInput, parseSessionOutput, parseUserInput, parseUserOutput, revokeUnprovenAccountAccess, toZodSchema };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DatabaseHooksEntry } from "./with-hooks.mjs";
|
|
2
1
|
import { AuthContext, EntroAuthOptions, InternalAdapter } from "@entro314labs/entro-auth-core";
|
|
3
|
-
import { InternalLogger } from "@entro314labs/entro-auth-core/env";
|
|
4
2
|
import { DBAdapter } from "@entro314labs/entro-auth-core/db/adapter";
|
|
3
|
+
import { InternalLogger } from "@entro314labs/entro-auth-core/env";
|
|
4
|
+
import { DatabaseHooksEntry } from "./with-hooks.mjs";
|
|
5
5
|
export declare const createInternalAdapter: (adapter: DBAdapter<EntroAuthOptions>, ctx: {
|
|
6
6
|
options: Omit<EntroAuthOptions, "logger">;
|
|
7
7
|
logger: InternalLogger;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { assertValidUserInfo, assertValidUserInfoSource } from "../utils/validate-user-info.mjs";
|
|
3
|
-
import { getSessionDefaultFields, parseSessionOutput, parseUserOutput } from "./schema.mjs";
|
|
4
|
-
import { getStorageOption, processIdentifier } from "./verification-token-storage.mjs";
|
|
5
|
-
import { getWithHooks } from "./with-hooks.mjs";
|
|
1
|
+
import { createHash } from "@better-auth/utils/hash";
|
|
6
2
|
import { getCurrentAdapter, getCurrentAuthEndpointContext, queueAfterTransactionHook, runWithTransaction, tryGetCurrentAuthEndpointContext } from "@entro314labs/entro-auth-core/context";
|
|
3
|
+
import { encodeDeterministicId } from "@entro314labs/entro-auth-core/db/internal";
|
|
7
4
|
import { isWorkerd } from "@entro314labs/entro-auth-core/env";
|
|
8
5
|
import { APIError, BASE_ERROR_CODES, EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
9
6
|
import { generateId } from "@entro314labs/entro-auth-core/utils/id";
|
|
10
|
-
import { safeJSONParse } from "@entro314labs/entro-auth-core/utils/json";
|
|
11
|
-
import { encodeDeterministicId } from "@entro314labs/entro-auth-core/db/internal";
|
|
12
7
|
import { getIP } from "@entro314labs/entro-auth-core/utils/ip";
|
|
13
|
-
import {
|
|
8
|
+
import { safeJSONParse } from "@entro314labs/entro-auth-core/utils/json";
|
|
9
|
+
import { getDate } from "../utils/date.mjs";
|
|
10
|
+
import { assertValidUserInfo, assertValidUserInfoSource } from "../utils/validate-user-info.mjs";
|
|
11
|
+
import { getSessionDefaultFields, parseSessionOutput, parseUserOutput } from "./schema.mjs";
|
|
12
|
+
import { getStorageOption, processIdentifier } from "./verification-token-storage.mjs";
|
|
13
|
+
import { getWithHooks } from "./with-hooks.mjs";
|
|
14
14
|
// src/db/internal-adapter.ts
|
|
15
15
|
function getTTLSeconds(expiresAt, now = Date.now()) {
|
|
16
16
|
const expiresMs = typeof expiresAt === "number" ? expiresAt : expiresAt.getTime();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { User } from "../types/models.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
2
|
import { GenericEndpointContext } from "@entro314labs/entro-auth-core";
|
|
3
|
+
import "../types/index.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* Strip every account link and session a pre-existing account accrued before
|
|
6
6
|
* control of its email was proven.
|
package/dist/db/schema.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Account, Session as Session$1, User as User$1 } from "../types/models.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
2
|
import { EntroAuthOptions } from "@entro314labs/entro-auth-core";
|
|
4
3
|
import { DBFieldAttribute, EntroAuthPluginDBSchema } from "@entro314labs/entro-auth-core/db";
|
|
4
|
+
import "../types/index.mjs";
|
|
5
5
|
export declare function parseUserOutput<T extends User$1>(options: EntroAuthOptions, user: T): T;
|
|
6
6
|
/**
|
|
7
7
|
* Builds a synthetic user object that matches the shape of a real user
|
|
@@ -17,7 +17,7 @@ export declare function parseUserOutput<T extends User$1>(options: EntroAuthOpti
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function buildSyntheticUserOutput(options: EntroAuthOptions, data: Record<string, unknown>): Record<string, unknown>;
|
|
19
19
|
export declare function parseSessionOutput<T extends Session$1>(options: EntroAuthOptions, session: T): T;
|
|
20
|
-
export declare function parseAccountOutput<T extends Account>(options: EntroAuthOptions, account: T): Omit<T, "
|
|
20
|
+
export declare function parseAccountOutput<T extends Account>(options: EntroAuthOptions, account: T): Omit<T, "password" | "accessToken" | "refreshToken" | "idToken" | "accessTokenExpiresAt" | "refreshTokenExpiresAt">;
|
|
21
21
|
export declare function parseInputData<T extends Record<string, any>>(data: T, schema: {
|
|
22
22
|
fields: Record<string, DBFieldAttribute>;
|
|
23
23
|
action?: ("create" | "update") | undefined;
|