@holeauth/core 0.0.1-alpha.0

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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/cjs-error.cjs +8 -0
  4. package/dist/adapters/index.d.ts +1 -0
  5. package/dist/adapters/index.js +3 -0
  6. package/dist/adapters/index.js.map +1 -0
  7. package/dist/cookies/index.d.ts +3 -0
  8. package/dist/cookies/index.js +74 -0
  9. package/dist/cookies/index.js.map +1 -0
  10. package/dist/errors/index.d.ts +40 -0
  11. package/dist/errors/index.js +70 -0
  12. package/dist/errors/index.js.map +1 -0
  13. package/dist/events/index.d.ts +3 -0
  14. package/dist/events/index.js +52 -0
  15. package/dist/events/index.js.map +1 -0
  16. package/dist/flows/index.d.ts +4 -0
  17. package/dist/flows/index.js +835 -0
  18. package/dist/flows/index.js.map +1 -0
  19. package/dist/index-BIXESLma.d.ts +58 -0
  20. package/dist/index-BYtkmk9_.d.ts +18 -0
  21. package/dist/index-BbEXbI_k.d.ts +116 -0
  22. package/dist/index-BmYQquGs.d.ts +563 -0
  23. package/dist/index-BwEvEa8-.d.ts +20 -0
  24. package/dist/index-CHS-socJ.d.ts +97 -0
  25. package/dist/index-CNtnPdzk.d.ts +136 -0
  26. package/dist/index-CjEXpqaW.d.ts +22 -0
  27. package/dist/index-CotvcK_b.d.ts +42 -0
  28. package/dist/index-D57PvFMN.d.ts +105 -0
  29. package/dist/index-DRN-5E_H.d.ts +26 -0
  30. package/dist/index.d.ts +39 -0
  31. package/dist/index.js +1757 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/jwt/index.d.ts +2 -0
  34. package/dist/jwt/index.js +53 -0
  35. package/dist/jwt/index.js.map +1 -0
  36. package/dist/otp/index.d.ts +1 -0
  37. package/dist/otp/index.js +16 -0
  38. package/dist/otp/index.js.map +1 -0
  39. package/dist/password/index.d.ts +1 -0
  40. package/dist/password/index.js +75 -0
  41. package/dist/password/index.js.map +1 -0
  42. package/dist/plugins/index.d.ts +4 -0
  43. package/dist/plugins/index.js +480 -0
  44. package/dist/plugins/index.js.map +1 -0
  45. package/dist/registry-CZhM1tEB.d.ts +101 -0
  46. package/dist/session/index.d.ts +3 -0
  47. package/dist/session/index.js +346 -0
  48. package/dist/session/index.js.map +1 -0
  49. package/dist/sso/index.d.ts +3 -0
  50. package/dist/sso/index.js +475 -0
  51. package/dist/sso/index.js.map +1 -0
  52. package/package.json +121 -0
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Adapter interfaces. ORM/database-specific adapters live in separate packages
3
+ * (e.g. @holeauth/adapter-prisma, @holeauth/adapter-drizzle).
4
+ *
5
+ * Plugin-specific data (2FA credentials, passkeys, RBAC assignments, …)
6
+ * is owned by the plugin's own adapter interface — never carried on the
7
+ * User row.
8
+ */
9
+ interface AdapterUser {
10
+ id: string;
11
+ email: string;
12
+ emailVerified?: Date | null;
13
+ name?: string | null;
14
+ image?: string | null;
15
+ passwordHash?: string | null;
16
+ }
17
+ interface AdapterSession {
18
+ id: string;
19
+ userId: string;
20
+ /** Refresh-token family (all rotations in a login chain share this). */
21
+ familyId: string;
22
+ /** SHA-256(refreshToken) — never store the raw token. */
23
+ refreshTokenHash: string;
24
+ expiresAt: Date;
25
+ createdAt?: Date;
26
+ revokedAt?: Date | null;
27
+ userAgent?: string | null;
28
+ ip?: string | null;
29
+ }
30
+ interface AdapterAccount {
31
+ id: string;
32
+ userId: string;
33
+ provider: string;
34
+ providerAccountId: string;
35
+ email?: string | null;
36
+ accessToken?: string | null;
37
+ refreshToken?: string | null;
38
+ expiresAt?: Date | null;
39
+ tokenType?: string | null;
40
+ scope?: string | null;
41
+ idToken?: string | null;
42
+ }
43
+ interface AdapterVerificationToken {
44
+ identifier: string;
45
+ token: string;
46
+ expiresAt: Date;
47
+ }
48
+ interface AdapterAuditEvent {
49
+ id?: string;
50
+ type: string;
51
+ userId?: string | null;
52
+ sessionId?: string | null;
53
+ at?: Date;
54
+ ip?: string | null;
55
+ userAgent?: string | null;
56
+ data?: Record<string, unknown> | null;
57
+ }
58
+ interface UserAdapter {
59
+ getUserById(id: string): Promise<AdapterUser | null>;
60
+ getUserByEmail(email: string): Promise<AdapterUser | null>;
61
+ createUser(data: Omit<AdapterUser, 'id'>): Promise<AdapterUser>;
62
+ updateUser(id: string, patch: Partial<AdapterUser>): Promise<AdapterUser>;
63
+ deleteUser(id: string): Promise<void>;
64
+ }
65
+ interface SessionAdapter {
66
+ /** Persist a session using the provided id (so callers can bind tokens before write). */
67
+ createSession(data: AdapterSession): Promise<AdapterSession>;
68
+ getSession(id: string): Promise<AdapterSession | null>;
69
+ getByRefreshHash(hash: string): Promise<AdapterSession | null>;
70
+ findByFamily(familyId: string): Promise<AdapterSession[]>;
71
+ deleteSession(id: string): Promise<void>;
72
+ /** Replace hash+exp atomically; returns the updated session. */
73
+ rotateRefresh(id: string, newHash: string, expiresAt: Date): Promise<AdapterSession>;
74
+ /** Revoke all sessions in a family (reuse-detection response). */
75
+ revokeFamily(familyId: string): Promise<void>;
76
+ /** Revoke all sessions for a user (global signout). */
77
+ revokeUser?(userId: string): Promise<void>;
78
+ }
79
+ interface AccountAdapter {
80
+ linkAccount(data: Omit<AdapterAccount, 'id'>): Promise<AdapterAccount>;
81
+ getAccountByProvider(provider: string, providerAccountId: string): Promise<AdapterAccount | null>;
82
+ getByProviderEmail?(provider: string, email: string): Promise<AdapterAccount | null>;
83
+ listByUser(userId: string): Promise<AdapterAccount[]>;
84
+ unlinkAccount(id: string): Promise<void>;
85
+ }
86
+ interface VerificationTokenAdapter {
87
+ create(data: AdapterVerificationToken): Promise<AdapterVerificationToken>;
88
+ consume(identifier: string, token: string): Promise<AdapterVerificationToken | null>;
89
+ /** Optional: purge expired rows (maintenance). */
90
+ purgeExpired?(): Promise<number>;
91
+ /** Optional: list all rows whose identifier starts with the given prefix. */
92
+ listByIdentifierPrefix?(prefix: string): Promise<AdapterVerificationToken[]>;
93
+ /** Optional: delete all rows with the exact identifier. Returns number of rows removed. */
94
+ deleteByIdentifier?(identifier: string): Promise<number>;
95
+ }
96
+ interface AuditLogAdapter {
97
+ /** Persist an event. MUST be awaited by flows. */
98
+ record(event: AdapterAuditEvent): Promise<void>;
99
+ list?(filter: {
100
+ userId?: string;
101
+ type?: string;
102
+ limit?: number;
103
+ }): Promise<AdapterAuditEvent[]>;
104
+ }
105
+ /**
106
+ * Optional transaction primitive. When provided, multi-step writes
107
+ * (deleteUser, signout with family revoke, password-change with session
108
+ * revoke, sso.callback create+link) are wrapped in a transaction.
109
+ *
110
+ * Implementations SHOULD propagate the tx through all adapter method
111
+ * calls invoked inside `fn` (e.g. by returning a fresh adapter bundle
112
+ * bound to the tx, or by using async-local-storage).
113
+ *
114
+ * If no transaction adapter is supplied, core falls back to sequential
115
+ * execution without atomicity.
116
+ */
117
+ interface TransactionAdapter {
118
+ run<T>(fn: () => Promise<T>): Promise<T>;
119
+ }
120
+
121
+ type index_AccountAdapter = AccountAdapter;
122
+ type index_AdapterAccount = AdapterAccount;
123
+ type index_AdapterAuditEvent = AdapterAuditEvent;
124
+ type index_AdapterSession = AdapterSession;
125
+ type index_AdapterUser = AdapterUser;
126
+ type index_AdapterVerificationToken = AdapterVerificationToken;
127
+ type index_AuditLogAdapter = AuditLogAdapter;
128
+ type index_SessionAdapter = SessionAdapter;
129
+ type index_TransactionAdapter = TransactionAdapter;
130
+ type index_UserAdapter = UserAdapter;
131
+ type index_VerificationTokenAdapter = VerificationTokenAdapter;
132
+ declare namespace index {
133
+ export type { index_AccountAdapter as AccountAdapter, index_AdapterAccount as AdapterAccount, index_AdapterAuditEvent as AdapterAuditEvent, index_AdapterSession as AdapterSession, index_AdapterUser as AdapterUser, index_AdapterVerificationToken as AdapterVerificationToken, index_AuditLogAdapter as AuditLogAdapter, index_SessionAdapter as SessionAdapter, index_TransactionAdapter as TransactionAdapter, index_UserAdapter as UserAdapter, index_VerificationTokenAdapter as VerificationTokenAdapter };
134
+ }
135
+
136
+ export { type AdapterUser as A, type SessionAdapter as S, type TransactionAdapter as T, type UserAdapter as U, type VerificationTokenAdapter as V, type AdapterAuditEvent as a, type AuditLogAdapter as b, type AccountAdapter as c, type AdapterAccount as d, type AdapterSession as e, type AdapterVerificationToken as f, index as i };
@@ -0,0 +1,22 @@
1
+ import { JWTPayload } from 'jose';
2
+
3
+ interface SignOptions {
4
+ issuer?: string;
5
+ audience?: string;
6
+ subject?: string;
7
+ expiresIn?: string | number;
8
+ jti?: string;
9
+ }
10
+ declare function sign(payload: JWTPayload, secret: string | Uint8Array, opts?: SignOptions): Promise<string>;
11
+ declare function verify<T extends JWTPayload = JWTPayload>(token: string, secret: string | Uint8Array): Promise<T>;
12
+ declare function decode<T extends JWTPayload = JWTPayload>(token: string): T;
13
+
14
+ type index_SignOptions = SignOptions;
15
+ declare const index_decode: typeof decode;
16
+ declare const index_sign: typeof sign;
17
+ declare const index_verify: typeof verify;
18
+ declare namespace index {
19
+ export { type index_SignOptions as SignOptions, index_decode as decode, index_sign as sign, index_verify as verify };
20
+ }
21
+
22
+ export { type SignOptions as S, decode as d, index as i, sign as s, verify as v };
@@ -0,0 +1,42 @@
1
+ import { H as HoleauthPlugin, C as ChallengeResult, g as HoleauthHooks, w as PasswordChangeHookInput, x as PasswordResetHookInput, m as PluginContext, n as PluginCoreSurface, o as PluginEvents, p as PluginLogger, q as PluginRoute, r as PluginRouteContext, P as PluginsApi, y as RegisterHookInput, z as SessionIssueHookData, A as SessionRevokeHookData, D as SessionRotateHookData } from './index-BmYQquGs.js';
2
+ import { H as HookRunner, P as PluginRegistry, b as buildRegistry, e as emptyRegistry, r as runOnInit } from './registry-CZhM1tEB.js';
3
+
4
+ /**
5
+ * Identity helper that preserves the literal `id` on the plugin type so
6
+ * `PluginsApi<Plugins>` can index by it with full type safety.
7
+ *
8
+ * Usage:
9
+ * export const twofa = () => definePlugin({
10
+ * id: 'twofa' as const,
11
+ * api: (ctx) => ({ setup(userId) { ... } }),
12
+ * });
13
+ */
14
+ declare function definePlugin<const P extends HoleauthPlugin<string, unknown>>(p: P): P;
15
+
16
+ declare const index_ChallengeResult: typeof ChallengeResult;
17
+ declare const index_HoleauthHooks: typeof HoleauthHooks;
18
+ declare const index_HoleauthPlugin: typeof HoleauthPlugin;
19
+ declare const index_HookRunner: typeof HookRunner;
20
+ declare const index_PasswordChangeHookInput: typeof PasswordChangeHookInput;
21
+ declare const index_PasswordResetHookInput: typeof PasswordResetHookInput;
22
+ declare const index_PluginContext: typeof PluginContext;
23
+ declare const index_PluginCoreSurface: typeof PluginCoreSurface;
24
+ declare const index_PluginEvents: typeof PluginEvents;
25
+ declare const index_PluginLogger: typeof PluginLogger;
26
+ declare const index_PluginRegistry: typeof PluginRegistry;
27
+ declare const index_PluginRoute: typeof PluginRoute;
28
+ declare const index_PluginRouteContext: typeof PluginRouteContext;
29
+ declare const index_PluginsApi: typeof PluginsApi;
30
+ declare const index_RegisterHookInput: typeof RegisterHookInput;
31
+ declare const index_SessionIssueHookData: typeof SessionIssueHookData;
32
+ declare const index_SessionRevokeHookData: typeof SessionRevokeHookData;
33
+ declare const index_SessionRotateHookData: typeof SessionRotateHookData;
34
+ declare const index_buildRegistry: typeof buildRegistry;
35
+ declare const index_definePlugin: typeof definePlugin;
36
+ declare const index_emptyRegistry: typeof emptyRegistry;
37
+ declare const index_runOnInit: typeof runOnInit;
38
+ declare namespace index {
39
+ export { index_ChallengeResult as ChallengeResult, index_HoleauthHooks as HoleauthHooks, index_HoleauthPlugin as HoleauthPlugin, index_HookRunner as HookRunner, index_PasswordChangeHookInput as PasswordChangeHookInput, index_PasswordResetHookInput as PasswordResetHookInput, index_PluginContext as PluginContext, index_PluginCoreSurface as PluginCoreSurface, index_PluginEvents as PluginEvents, index_PluginLogger as PluginLogger, index_PluginRegistry as PluginRegistry, index_PluginRoute as PluginRoute, index_PluginRouteContext as PluginRouteContext, index_PluginsApi as PluginsApi, index_RegisterHookInput as RegisterHookInput, index_SessionIssueHookData as SessionIssueHookData, index_SessionRevokeHookData as SessionRevokeHookData, index_SessionRotateHookData as SessionRotateHookData, index_buildRegistry as buildRegistry, index_definePlugin as definePlugin, index_emptyRegistry as emptyRegistry, index_runOnInit as runOnInit };
40
+ }
41
+
42
+ export { definePlugin as d, index as i };
@@ -0,0 +1,105 @@
1
+ import { a as HoleauthConfig, k as IssuedTokens, S as SessionData, b as HoleauthInstance } from './index-BmYQquGs.js';
2
+
3
+ interface IssueInput {
4
+ userId: string;
5
+ /** Omit to start a fresh family (e.g. on a real login). */
6
+ familyId?: string;
7
+ ip?: string | null;
8
+ userAgent?: string | null;
9
+ }
10
+ /**
11
+ * Mint a brand new session row + JWT pair + CSRF token.
12
+ * Used by: fresh login, passkey login, SSO callback, 2FA verify.
13
+ */
14
+ declare function issueSession(cfg: HoleauthConfig, input: IssueInput): Promise<IssuedTokens>;
15
+
16
+ /**
17
+ * Rotate-on-use with reuse detection.
18
+ *
19
+ * 1. Decode refresh JWT → recover sid, fam, sub.
20
+ * 2. Hash presented token; look it up.
21
+ * - If not found, the token was already rotated away → reuse! Revoke family.
22
+ * 3. Issue new access + refresh, rotate hash in storage atomically.
23
+ *
24
+ * Returns a fresh IssuedTokens tuple. Session id + family stay stable.
25
+ */
26
+ declare function rotateRefresh(cfg: HoleauthConfig, presentedRefresh: string, meta?: {
27
+ ip?: string | null;
28
+ userAgent?: string | null;
29
+ }): Promise<IssuedTokens>;
30
+
31
+ /**
32
+ * Edge-compatible: verifies the access JWT only. Does not touch adapters.
33
+ * Use this in middleware / hot paths.
34
+ */
35
+ declare function validateSession(cfg: HoleauthConfig, token: string): Promise<SessionData | null>;
36
+
37
+ /** Revoke a single session by id (signout). */
38
+ declare function revokeSession(cfg: HoleauthConfig, sessionId: string, userId?: string): Promise<void>;
39
+ /** Revoke by presented refresh token (best-effort). */
40
+ declare function revokeByRefresh(cfg: HoleauthConfig, refreshToken: string): Promise<void>;
41
+ /** Global signout — all sessions for a user. */
42
+ declare function revokeAllForUser(cfg: HoleauthConfig, userId: string): Promise<void>;
43
+
44
+ /** SHA-256 → base64url. Works on Node 20+ and all Edge runtimes. */
45
+ declare function sha256b64url(input: string): Promise<string>;
46
+
47
+ interface GetSessionOrRefreshInput {
48
+ /** Current access token (if any). */
49
+ accessToken?: string | null;
50
+ /** Current refresh token (if any). When present, used to rotate on access miss. */
51
+ refreshToken?: string | null;
52
+ /** Request metadata, forwarded to refresh hooks/audit log. */
53
+ ip?: string;
54
+ userAgent?: string;
55
+ }
56
+ interface GetSessionOrRefreshResult {
57
+ /** Resolved session, or null if both validation and refresh failed. */
58
+ session: SessionData | null;
59
+ /** Freshly-issued token bundle when a refresh actually occurred. */
60
+ tokens: IssuedTokens | null;
61
+ /** True if this call rotated the refresh token. */
62
+ refreshed: boolean;
63
+ }
64
+ /**
65
+ * Validate the access token and, if invalid/missing, transparently rotate the
66
+ * refresh token to obtain a new session. Framework-agnostic — used by the
67
+ * Next.js middleware/server helpers and intended for consumption from API
68
+ * server middleware (tRPC, Hono, plain route handlers, …).
69
+ *
70
+ * Cookies are NOT touched here; the caller decides how to surface the new
71
+ * token bundle (Set-Cookie headers, in-memory store, etc.).
72
+ *
73
+ * Returns:
74
+ * - `session` the resolved session (or `null`),
75
+ * - `tokens` the newly-issued token bundle when a refresh occurred,
76
+ * - `refreshed` whether rotation happened.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const { session, tokens } = await getSessionOrRefresh(auth, {
81
+ * accessToken: req.cookies.get('holeauth.at')?.value,
82
+ * refreshToken: req.cookies.get('holeauth.rt')?.value,
83
+ * ip, userAgent,
84
+ * });
85
+ * if (tokens) writeAuthCookies(auth.config, res.headers, tokens);
86
+ * ```
87
+ */
88
+ declare function getSessionOrRefresh(instance: HoleauthInstance, input: GetSessionOrRefreshInput): Promise<GetSessionOrRefreshResult>;
89
+
90
+ type index_GetSessionOrRefreshInput = GetSessionOrRefreshInput;
91
+ type index_GetSessionOrRefreshResult = GetSessionOrRefreshResult;
92
+ type index_IssueInput = IssueInput;
93
+ declare const index_getSessionOrRefresh: typeof getSessionOrRefresh;
94
+ declare const index_issueSession: typeof issueSession;
95
+ declare const index_revokeAllForUser: typeof revokeAllForUser;
96
+ declare const index_revokeByRefresh: typeof revokeByRefresh;
97
+ declare const index_revokeSession: typeof revokeSession;
98
+ declare const index_rotateRefresh: typeof rotateRefresh;
99
+ declare const index_sha256b64url: typeof sha256b64url;
100
+ declare const index_validateSession: typeof validateSession;
101
+ declare namespace index {
102
+ export { type index_GetSessionOrRefreshInput as GetSessionOrRefreshInput, type index_GetSessionOrRefreshResult as GetSessionOrRefreshResult, type index_IssueInput as IssueInput, index_getSessionOrRefresh as getSessionOrRefresh, index_issueSession as issueSession, index_revokeAllForUser as revokeAllForUser, index_revokeByRefresh as revokeByRefresh, index_revokeSession as revokeSession, index_rotateRefresh as rotateRefresh, index_sha256b64url as sha256b64url, index_validateSession as validateSession };
103
+ }
104
+
105
+ export { type GetSessionOrRefreshInput as G, type IssueInput as I, type GetSessionOrRefreshResult as a, issueSession as b, revokeByRefresh as c, revokeSession as d, rotateRefresh as e, getSessionOrRefresh as g, index as i, revokeAllForUser as r, sha256b64url as s, validateSession as v };
@@ -0,0 +1,26 @@
1
+ import { a as HoleauthConfig, u as HoleauthEvent, v as HoleauthEventType } from './index-BmYQquGs.js';
2
+
3
+ type Handler = (e: HoleauthEvent) => void | Promise<void>;
4
+ /** Subscribe to an event type. Use '*' to match all events. Returns an unsubscribe fn. */
5
+ declare function subscribe(cfg: HoleauthConfig, type: string, handler: Handler): () => void;
6
+ declare function unsubscribe(cfg: HoleauthConfig, type: string, handler: Handler): void;
7
+ /**
8
+ * emit() persists the event via the mandatory AuditLogAdapter and
9
+ * additionally fans out to all subscribers (typed + wildcard) plus the
10
+ * legacy `cfg.onEvent` hook — all fire-and-forget so business flows are
11
+ * never blocked by observer failures.
12
+ *
13
+ * Callers MUST await emit(): audit persistence is a hard requirement.
14
+ */
15
+ declare function emit(cfg: HoleauthConfig, event: HoleauthEvent): Promise<void>;
16
+
17
+ declare const index_HoleauthEvent: typeof HoleauthEvent;
18
+ declare const index_HoleauthEventType: typeof HoleauthEventType;
19
+ declare const index_emit: typeof emit;
20
+ declare const index_subscribe: typeof subscribe;
21
+ declare const index_unsubscribe: typeof unsubscribe;
22
+ declare namespace index {
23
+ export { index_HoleauthEvent as HoleauthEvent, index_HoleauthEventType as HoleauthEventType, index_emit as emit, index_subscribe as subscribe, index_unsubscribe as unsubscribe };
24
+ }
25
+
26
+ export { emit as e, index as i, subscribe as s, unsubscribe as u };
@@ -0,0 +1,39 @@
1
+ import { H as HoleauthPlugin, a as HoleauthConfig, b as HoleauthInstance, P as PluginsApi } from './index-BmYQquGs.js';
2
+ export { B as BaseProviderConfig, C as ChallengeResult, c as ConsumeInviteInput, d as ConsumeInviteResult, e as CreateInviteResult, f as HoleauthAdapters, g as HoleauthHooks, h as HoleauthSecrets, I as InviteClaims, i as InviteInput, j as InviteListEntry, k as IssuedTokens, L as LoggerOptions, O as OAuth2ProviderConfig, l as OIDCProviderConfig, m as PluginContext, n as PluginCoreSurface, o as PluginEvents, p as PluginLogger, q as PluginRoute, r as PluginRouteContext, s as ProviderConfig, R as RegistrationConfig, S as SessionData, t as SignInResult, T as TokenPolicy } from './index-BmYQquGs.js';
3
+ export { AccountConflictError, AdapterError, CredentialsError, CsrfError, HoleauthError, InvalidTokenError, NotSupportedError, PendingChallengeError, ProviderError, RefreshReuseError, RegistrationDisabledError, SessionExpiredError } from './errors/index.js';
4
+ export { i as jwt } from './index-CjEXpqaW.js';
5
+ export { i as session } from './index-D57PvFMN.js';
6
+ export { i as password } from './index-BYtkmk9_.js';
7
+ export { i as otp } from './index-BwEvEa8-.js';
8
+ export { i as sso } from './index-CHS-socJ.js';
9
+ export { i as adapters } from './index-CNtnPdzk.js';
10
+ export { i as cookies } from './index-BIXESLma.js';
11
+ export { i as events } from './index-DRN-5E_H.js';
12
+ export { i as flows } from './index-BbEXbI_k.js';
13
+ export { d as definePlugin, i as plugins } from './index-CotvcK_b.js';
14
+ import { P as PluginRegistry } from './registry-CZhM1tEB.js';
15
+ import 'jose';
16
+
17
+ /** Framework-binding helper (not part of the public API surface). */
18
+ declare const INTERNAL_REGISTRY_KEY: symbol;
19
+ /** Internal: retrieve the registry attached to an instance. */
20
+ declare function getRegistry(instance: HoleauthInstance): PluginRegistry;
21
+ /**
22
+ * defineHoleauth — primary factory.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const auth = defineHoleauth({
27
+ * adapters: { … },
28
+ * secrets: { jwtSecret },
29
+ * plugins: [twofa(), rbac({ file: './holeauth.rbac.yml' })] as const,
30
+ * });
31
+ * auth.twofa.setup(userId); // inferred
32
+ * auth.rbac.can(userId, 'users.edit'); // inferred
33
+ * ```
34
+ */
35
+ declare function defineHoleauth<const Plugins extends readonly HoleauthPlugin<string, unknown>[] = []>(config: HoleauthConfig & {
36
+ plugins?: Plugins;
37
+ }): HoleauthInstance & PluginsApi<Plugins>;
38
+
39
+ export { HoleauthConfig, HoleauthInstance, HoleauthPlugin, INTERNAL_REGISTRY_KEY, PluginsApi, defineHoleauth, getRegistry };