@absolutejs/auth 0.56.4 → 0.56.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.
Files changed (219) hide show
  1. package/dist/abuse/captcha.d.ts +11 -0
  2. package/dist/abuse/config.d.ts +29 -0
  3. package/dist/actions.d.ts +27 -0
  4. package/dist/adaptive/config.d.ts +34 -0
  5. package/dist/adaptive/fingerprint.d.ts +2 -0
  6. package/dist/adaptive/inMemoryStores.d.ts +3 -0
  7. package/dist/adaptive/postgresStores.d.ts +245 -0
  8. package/dist/adaptive/types.d.ts +62 -0
  9. package/dist/agents/config.d.ts +44 -0
  10. package/dist/agents/context.d.ts +46 -0
  11. package/dist/agents/idJag.d.ts +49 -0
  12. package/dist/agents/inMemoryStores.d.ts +4 -0
  13. package/dist/agents/oidcAdapter.d.ts +12 -0
  14. package/dist/agents/postgresStores.d.ts +569 -0
  15. package/dist/agents/principal.d.ts +4 -0
  16. package/dist/agents/registration.d.ts +162 -0
  17. package/dist/agents/registrationClient.d.ts +50 -0
  18. package/dist/agents/routes.d.ts +321 -0
  19. package/dist/agents/types.d.ts +129 -0
  20. package/dist/apikeys/config.d.ts +64 -0
  21. package/dist/apikeys/inMemoryStores.d.ts +4 -0
  22. package/dist/apikeys/postgresStores.d.ts +359 -0
  23. package/dist/apikeys/routes.d.ts +83 -0
  24. package/dist/apikeys/types.d.ts +53 -0
  25. package/dist/audit/config.d.ts +9 -0
  26. package/dist/audit/export.d.ts +2 -0
  27. package/dist/audit/inMemoryAuditStore.d.ts +2 -0
  28. package/dist/audit/integrity.d.ts +19 -0
  29. package/dist/audit/postgresAuditStore.d.ts +116 -0
  30. package/dist/audit/siem.d.ts +11 -0
  31. package/dist/audit/types.d.ts +19 -0
  32. package/dist/audit/wrap.d.ts +9 -0
  33. package/dist/authContext.d.ts +193 -0
  34. package/dist/authorization/config.d.ts +19 -0
  35. package/dist/authorization/protectPermission.d.ts +52 -0
  36. package/dist/cli/migrate.js.map +1 -1
  37. package/dist/compliance/cipher.d.ts +11 -0
  38. package/dist/compliance/config.d.ts +18 -0
  39. package/dist/compliance/redaction.d.ts +8 -0
  40. package/dist/compliance/routes.d.ts +89 -0
  41. package/dist/constants.d.ts +10 -0
  42. package/dist/credentials/backgroundOps.d.ts +45 -0
  43. package/dist/credentials/config.d.ts +68 -0
  44. package/dist/credentials/emailValidation.d.ts +9 -0
  45. package/dist/credentials/emailVerification.d.ts +83 -0
  46. package/dist/credentials/import.d.ts +34 -0
  47. package/dist/credentials/inMemoryCredentialStore.d.ts +2 -0
  48. package/dist/credentials/legacyHashers.d.ts +3 -0
  49. package/dist/credentials/login.d.ts +76 -0
  50. package/dist/credentials/passwordPolicy.d.ts +15 -0
  51. package/dist/credentials/passwordReset.d.ts +87 -0
  52. package/dist/credentials/postgresCredentialStore.d.ts +235 -0
  53. package/dist/credentials/register.d.ts +54 -0
  54. package/dist/credentials/routes.d.ts +201 -0
  55. package/dist/credentials/types.d.ts +26 -0
  56. package/dist/crypto.d.ts +32 -0
  57. package/dist/errors.d.ts +12 -0
  58. package/dist/federation/tokenStore.d.ts +29 -0
  59. package/dist/fga/config.d.ts +53 -0
  60. package/dist/fga/inMemoryStores.d.ts +3 -0
  61. package/dist/fga/postgresStores.d.ts +116 -0
  62. package/dist/fga/redisCheckCache.d.ts +11 -0
  63. package/dist/fga/schema.d.ts +2 -0
  64. package/dist/fga/types.d.ts +28 -0
  65. package/dist/htmx/configuredRoutes.d.ts +542 -0
  66. package/dist/htmx/renderers.d.ts +8 -0
  67. package/dist/htmx/routes.d.ts +514 -0
  68. package/dist/htmx/types.d.ts +129 -0
  69. package/dist/index.js +22 -1
  70. package/dist/index.js.map +5 -5
  71. package/dist/linkedProviders/inMemoryStores.d.ts +9 -0
  72. package/dist/linkedProviders/neonStores.d.ts +484 -0
  73. package/dist/linkedProviders/oauthAccountResolver.d.ts +28 -0
  74. package/dist/linkedProviders/oauthResolver.d.ts +9 -0
  75. package/dist/linkedProviders/resolver.d.ts +22 -0
  76. package/dist/lockout/config.d.ts +17 -0
  77. package/dist/lockout/inMemoryLockoutStore.d.ts +2 -0
  78. package/dist/lockout/postgresLockoutStore.d.ts +71 -0
  79. package/dist/lockout/redisLockoutStore.d.ts +3 -0
  80. package/dist/lockout/types.d.ts +12 -0
  81. package/dist/mfa/backupCodes.d.ts +5 -0
  82. package/dist/mfa/challenge.d.ts +70 -0
  83. package/dist/mfa/config.d.ts +50 -0
  84. package/dist/mfa/gate.d.ts +2 -0
  85. package/dist/mfa/inMemoryMfaStore.d.ts +2 -0
  86. package/dist/mfa/management.d.ts +106 -0
  87. package/dist/mfa/postgresMfaStore.d.ts +206 -0
  88. package/dist/mfa/rotation.d.ts +17 -0
  89. package/dist/mfa/routes.d.ts +234 -0
  90. package/dist/mfa/secret.d.ts +2 -0
  91. package/dist/mfa/sms.d.ts +105 -0
  92. package/dist/mfa/totp.d.ts +91 -0
  93. package/dist/mfa/types.d.ts +23 -0
  94. package/dist/migrations/generate.d.ts +2 -0
  95. package/dist/migrations/index.d.ts +5 -0
  96. package/dist/migrations/runner.d.ts +13 -0
  97. package/dist/migrations/types.d.ts +14 -0
  98. package/dist/oidc/clientAuth.d.ts +19 -0
  99. package/dist/oidc/clientIdMetadata.d.ts +32 -0
  100. package/dist/oidc/config.d.ts +296 -0
  101. package/dist/oidc/dpop.d.ts +23 -0
  102. package/dist/oidc/inMemoryStores.d.ts +11 -0
  103. package/dist/oidc/inMemoryVciStores.d.ts +3 -0
  104. package/dist/oidc/index.d.ts +1 -1
  105. package/dist/oidc/index.js +8 -1
  106. package/dist/oidc/index.js.map +3 -3
  107. package/dist/oidc/jar.d.ts +14 -0
  108. package/dist/oidc/keys.d.ts +35 -0
  109. package/dist/oidc/logout.d.ts +38 -0
  110. package/dist/oidc/mtls.d.ts +11 -0
  111. package/dist/oidc/par.d.ts +28 -0
  112. package/dist/oidc/postgresStores.d.ts +1217 -0
  113. package/dist/oidc/registration.d.ts +138 -0
  114. package/dist/oidc/routes.d.ts +569 -0
  115. package/dist/oidc/types.d.ts +153 -0
  116. package/dist/oidc/userinfo.d.ts +21 -0
  117. package/dist/oidc/vci.d.ts +159 -0
  118. package/dist/oidc/vciRoutes.d.ts +92 -0
  119. package/dist/organizations/config.d.ts +46 -0
  120. package/dist/organizations/inMemoryOrganizationStore.d.ts +2 -0
  121. package/dist/organizations/operations.d.ts +39 -0
  122. package/dist/organizations/postgresOrganizationStore.d.ts +340 -0
  123. package/dist/organizations/routes.d.ts +299 -0
  124. package/dist/organizations/types.d.ts +45 -0
  125. package/dist/passwordless/config.d.ts +43 -0
  126. package/dist/passwordless/inMemoryPasswordlessTokenStore.d.ts +2 -0
  127. package/dist/passwordless/postgresPasswordlessTokenStore.d.ts +56 -0
  128. package/dist/passwordless/routes.d.ts +163 -0
  129. package/dist/passwordless/types.d.ts +9 -0
  130. package/dist/pluginIdentity.d.ts +2 -0
  131. package/dist/portal/config.d.ts +34 -0
  132. package/dist/portal/inMemorySetupSessionStore.d.ts +2 -0
  133. package/dist/portal/operations.d.ts +10 -0
  134. package/dist/portal/postgresSetupSessionStore.d.ts +116 -0
  135. package/dist/portal/routes.d.ts +160 -0
  136. package/dist/portal/types.d.ts +16 -0
  137. package/dist/providers/clients.d.ts +1818 -0
  138. package/dist/providersFromEnv.d.ts +19 -0
  139. package/dist/roles/config.d.ts +27 -0
  140. package/dist/roles/inMemoryRoleStore.d.ts +2 -0
  141. package/dist/roles/operations.d.ts +8 -0
  142. package/dist/roles/postgresRoleStore.d.ts +86 -0
  143. package/dist/roles/resolver.d.ts +17 -0
  144. package/dist/roles/routes.d.ts +106 -0
  145. package/dist/roles/types.d.ts +14 -0
  146. package/dist/routes/authorize.d.ts +102 -0
  147. package/dist/routes/callback.d.ts +64 -0
  148. package/dist/routes/profile.d.ts +70 -0
  149. package/dist/routes/protectRoute.d.ts +51 -0
  150. package/dist/routes/refresh.d.ts +74 -0
  151. package/dist/routes/revoke.d.ts +73 -0
  152. package/dist/routes/sessions.d.ts +103 -0
  153. package/dist/routes/signout.d.ts +70 -0
  154. package/dist/routes/stepUp.d.ts +48 -0
  155. package/dist/routes/userStatus.d.ts +72 -0
  156. package/dist/scim/config.d.ts +57 -0
  157. package/dist/scim/extensions.d.ts +30 -0
  158. package/dist/scim/inMemoryScimTokenStore.d.ts +2 -0
  159. package/dist/scim/postgresScimTokenStore.d.ts +86 -0
  160. package/dist/scim/routes.d.ts +366 -0
  161. package/dist/scim/serialize.d.ts +83 -0
  162. package/dist/scim/types.d.ts +54 -0
  163. package/dist/server.js +22 -1
  164. package/dist/server.js.map +5 -5
  165. package/dist/session/access.d.ts +33 -0
  166. package/dist/session/anonymous.d.ts +12 -0
  167. package/dist/session/cleanup.d.ts +45 -0
  168. package/dist/session/impersonation.d.ts +34 -0
  169. package/dist/session/inMemoryStore.d.ts +7 -0
  170. package/dist/session/multiSession.d.ts +27 -0
  171. package/dist/session/neonStore.d.ts +513 -0
  172. package/dist/session/promote.d.ts +23 -0
  173. package/dist/session/redisStore.d.ts +6 -0
  174. package/dist/session/sessionsConfig.d.ts +9 -0
  175. package/dist/session/state.d.ts +33 -0
  176. package/dist/session/types.d.ts +21 -0
  177. package/dist/session/userSessions.d.ts +19 -0
  178. package/dist/sso/config.d.ts +149 -0
  179. package/dist/sso/discoveryRoute.d.ts +63 -0
  180. package/dist/sso/inMemorySamlServiceProviderStore.d.ts +2 -0
  181. package/dist/sso/inMemorySsoConnectionStore.d.ts +2 -0
  182. package/dist/sso/oidcRoutes.d.ts +98 -0
  183. package/dist/sso/postgresSamlServiceProviderStore.d.ts +101 -0
  184. package/dist/sso/postgresSsoConnectionStore.d.ts +116 -0
  185. package/dist/sso/samlIdpRoutes.d.ts +139 -0
  186. package/dist/sso/samlRoutes.d.ts +179 -0
  187. package/dist/sso/types.d.ts +53 -0
  188. package/dist/stores/postgres.d.ts +5 -0
  189. package/dist/stores/redis.d.ts +5 -0
  190. package/dist/telemetry/tracing.d.ts +15 -0
  191. package/dist/tenancy.d.ts +9 -0
  192. package/dist/typeGuards.d.ts +6 -0
  193. package/dist/typebox.d.ts +4 -0
  194. package/dist/types.d.ts +421 -0
  195. package/dist/utils.d.ts +45 -0
  196. package/dist/vault/config.d.ts +20 -0
  197. package/dist/vault/inMemoryVaultStore.d.ts +2 -0
  198. package/dist/vault/postgresVaultStore.d.ts +86 -0
  199. package/dist/vault/types.d.ts +14 -0
  200. package/dist/vc/inMemoryVpStores.d.ts +2 -0
  201. package/dist/vc/openid4vp.d.ts +82 -0
  202. package/dist/vc/postgresVcStores.d.ts +300 -0
  203. package/dist/vc/sdJwt.d.ts +37 -0
  204. package/dist/vc/statusList.d.ts +29 -0
  205. package/dist/vc/statusListRoutes.d.ts +63 -0
  206. package/dist/vc/vpRoutes.d.ts +120 -0
  207. package/dist/webauthn/adapter.d.ts +59 -0
  208. package/dist/webauthn/config.d.ts +36 -0
  209. package/dist/webauthn/inMemoryWebAuthnCredentialStore.d.ts +2 -0
  210. package/dist/webauthn/postgresWebAuthnCredentialStore.d.ts +146 -0
  211. package/dist/webauthn/routes.d.ts +155 -0
  212. package/dist/webauthn/types.d.ts +17 -0
  213. package/dist/webhooks/config.d.ts +34 -0
  214. package/dist/webhooks/dispatcher.d.ts +3 -0
  215. package/dist/webhooks/inMemoryStore.d.ts +2 -0
  216. package/dist/webhooks/postgresStore.d.ts +116 -0
  217. package/dist/webhooks/sign.d.ts +11 -0
  218. package/dist/webhooks/types.d.ts +25 -0
  219. package/package.json +3 -3
@@ -0,0 +1,421 @@
1
+ import { CredentialsFor, CustomProviderCredentials, NonEmptyArray, OAuth2Client, OAuth2TokenResponse, ProviderConfig, ProviderOption, ProvidersMap } from 'citra';
2
+ import { Cookie, status as statusType, redirect as redirectType } from 'elysia';
3
+ import { ElysiaCustomStatusResponse } from 'elysia/error';
4
+ import type { ApiKeysConfig } from './apikeys/config';
5
+ import type { AgentAuthConfig } from './agents/config';
6
+ import type { AuditConfig } from './audit/config';
7
+ import type { AuthorizationConfig } from './authorization/config';
8
+ import type { ComplianceConfig } from './compliance/config';
9
+ import type { CredentialsConfig } from './credentials/config';
10
+ import type { AuthIdentityConflict } from './errors';
11
+ import type { AuthHtmxConfig, AuthHtmxUser } from './htmx/types';
12
+ import type { LockoutConfig } from './lockout/config';
13
+ import type { MfaConfig } from './mfa/config';
14
+ import type { OidcProviderConfig } from './oidc/config';
15
+ import type { OrganizationsConfig } from './organizations/config';
16
+ import type { PasswordlessConfig } from './passwordless/config';
17
+ import type { PortalConfig } from './portal/config';
18
+ import type { RolesConfig } from './roles/config';
19
+ import type { ScimConfig } from './scim/config';
20
+ import type { SessionsConfig } from './session/sessionsConfig';
21
+ import type { AuthSessionStore } from './session/types';
22
+ import type { SSOConfig } from './sso/config';
23
+ import type { TracingConfig } from './telemetry/tracing';
24
+ import type { WebAuthnConfig } from './webauthn/config';
25
+ import type { WebhooksConfig } from './webhooks/config';
26
+ export type AuthIntent = 'login' | 'link_identity' | 'link_connector';
27
+ export type OAuth2ProviderClientConfiguration<Provider extends ProviderOption> = {
28
+ credentials: CredentialsFor<Provider>;
29
+ searchParams?: [string, string][];
30
+ } & (ProvidersMap[Provider]['scopeRequired'] extends true ? {
31
+ scope: NonEmptyArray<string>;
32
+ } : {
33
+ scope?: string[];
34
+ });
35
+ export type OAuth2ProviderConfiguration<Provider extends ProviderOption> = OAuth2ProviderClientConfiguration<Provider> | Record<string, OAuth2ProviderClientConfiguration<Provider>>;
36
+ export type OAuth2ConfigurationOptions = {
37
+ [Provider in ProviderOption]?: OAuth2ProviderConfiguration<Provider>;
38
+ };
39
+ /** One client of a caller-defined (custom) OAuth provider: the full citra
40
+ * ProviderConfig plus this app's credentials. Same optional scope /
41
+ * searchParams knobs as built-in provider clients. */
42
+ export type CustomProviderClientConfiguration = {
43
+ credentials: CustomProviderCredentials;
44
+ providerConfig: ProviderConfig;
45
+ scope?: string[];
46
+ searchParams?: [string, string][];
47
+ };
48
+ /** Caller-defined providers keyed by YOUR provider name (any key that isn't a
49
+ * built-in citra provider). Single client or named client variants — the same
50
+ * shape as providersConfiguration. Registered providers get the full route
51
+ * set (authorize/callback/refresh/revoke/linked-providers) like built-ins. */
52
+ export type CustomProvidersConfiguration = Record<string, CustomProviderClientConfiguration | Record<string, CustomProviderClientConfiguration>>;
53
+ export type UserSessionId = `${string}-${string}-${string}-${string}-${string}`;
54
+ /** Stamped on a session created via admin impersonation (`startImpersonation`). RFC 8693
55
+ * actor semantics: `actorId`/`actorEmail` are the admin acting as the user, `reason` is
56
+ * required and audited, `returnToSessionId` is the admin's own session to restore on exit.
57
+ * Surfaced by userStatus so your UI can show an "impersonating" banner.
58
+ *
59
+ * `readOnly` is the RFC 8693 §6 "down-scope the delegated session" lever, surfaced for the
60
+ * app to enforce: when true this is a GHOST/observe-only session — the app should reject
61
+ * writes (and suppress side-effects) so an admin can watch a member's account without
62
+ * disturbing them. The package only CARRIES the flag (it can't know your routes); enforce
63
+ * it in your own request guard. Absent/false = full-access acting session. */
64
+ export type Impersonator = {
65
+ actorEmail?: string;
66
+ actorId: string;
67
+ readOnly?: boolean;
68
+ reason: string;
69
+ returnToSessionId?: UserSessionId;
70
+ startedAt: number;
71
+ /** Sandbox lever, surfaced for the app to enforce: when true, the app should
72
+ * suppress outbound side-effects (emails / SMS / push / notifications)
73
+ * triggered while acting as the member — so an admin can run a flow and watch
74
+ * the behavior WITHOUT the member or their partners being contacted. Like
75
+ * `readOnly`, the package only carries it; enforce it at your emitters.
76
+ * Independent of `readOnly` (a session can act AND suppress = "sandbox"). */
77
+ suppressSideEffects?: boolean;
78
+ };
79
+ export type SessionData<UserType> = {
80
+ /** Snapshot of your user, serialized into the session at login and handed to
81
+ * `protectRoute`/`userStatus` as-is — it is NOT re-read from your user table per
82
+ * request. Mutations made after login (role grants, bans, tier changes) stay
83
+ * invisible to existing sessions until you rewrite the snapshot with
84
+ * `refreshUserSessions`. */
85
+ user: UserType;
86
+ /** OAuth provider access token. Optional: credential / SSO sessions are not backed
87
+ * by a provider token, so they omit it. Only the OAuth routes (profile, refresh,
88
+ * revoke) read it, and they are all gated on an `auth_provider`. */
89
+ accessToken?: string;
90
+ refreshToken?: string;
91
+ expiresAt: number;
92
+ /** When the session was last established by an actual authentication (login, OAuth
93
+ * callback, or MFA challenge — NOT a token refresh). Drives step-up `requireRecentAuth`. */
94
+ authenticatedAt?: number;
95
+ /** SAML SP-initiated Single Logout context, captured at the SAML ACS. Lets
96
+ * `{ssoRoute}/saml/:org/logout` build a signed LogoutRequest (the IdP needs the original
97
+ * NameID + SessionIndex) for the connection the session was created from. */
98
+ samlLogout?: {
99
+ connectionId: string;
100
+ nameId: string;
101
+ sessionIndex?: string;
102
+ };
103
+ /** Present only when this session was created via admin impersonation. */
104
+ impersonator?: Impersonator;
105
+ /** True for a guest/anonymous session (createAnonymousSession) that can later be
106
+ * upgraded by a real login. */
107
+ anonymous?: boolean;
108
+ };
109
+ export type SessionRecord<UserType> = Record<UserSessionId, SessionData<UserType>>;
110
+ export type UnregisteredSessionData = {
111
+ userIdentity?: Record<string, unknown>;
112
+ sessionInformation?: Record<string, unknown>;
113
+ expiresAt: number;
114
+ accessToken?: string;
115
+ refreshToken?: string;
116
+ };
117
+ export type UnregisteredSessionRecord = Record<UserSessionId, UnregisteredSessionData>;
118
+ export type ResolvedOAuthAuthorization = {
119
+ userIdentity: Record<string, unknown>;
120
+ accessToken: string;
121
+ refreshToken?: string;
122
+ expiresAt?: number;
123
+ tokenType?: string;
124
+ };
125
+ export type StatusReturn = ElysiaCustomStatusResponse<any, any, any>;
126
+ export type OnNewUser<UserType> = (userIdentity: Record<string, unknown>) => UserType | StatusReturn | Response | Promise<UserType | StatusReturn | Response>;
127
+ export type GetUser<UserType> = (userIdentity: Record<string, unknown>) => UserType | null | undefined | Promise<UserType | null | undefined>;
128
+ export type CallbackCookie = Record<string, Cookie<unknown>> & {
129
+ auth_client: Cookie<string | undefined>;
130
+ auth_intent: Cookie<AuthIntent | undefined>;
131
+ user_session_id: Cookie<UserSessionId | undefined>;
132
+ };
133
+ export type CallbackContext<UserType> = {
134
+ providerInstance: OAuth2Client<ProviderOption>;
135
+ /** Configured provider name — a built-in citra key or a customProviders key. */
136
+ authProvider: string;
137
+ /** The provider's citra config — pass to instantiateUserSession so identity
138
+ * extraction works for custom providers too. */
139
+ providerConfiguration: ProviderConfig;
140
+ authClient?: string;
141
+ authIntent: AuthIntent;
142
+ tokenResponse: OAuth2TokenResponse;
143
+ session: SessionRecord<UserType>;
144
+ unregisteredSession: UnregisteredSessionRecord;
145
+ userSessionId: UserSessionId;
146
+ originUrl: string;
147
+ cookie: CallbackCookie;
148
+ currentUser?: UserType;
149
+ status: typeof statusType;
150
+ redirect: typeof redirectType;
151
+ };
152
+ export type ResolveAuthIntent<UserType> = (({ authProvider, authClient, originUrl, session, userSessionId, currentUser }: {
153
+ authProvider: string;
154
+ authClient?: string;
155
+ originUrl: string;
156
+ session: SessionRecord<UserType>;
157
+ userSessionId?: UserSessionId;
158
+ currentUser?: UserType;
159
+ }) => AuthIntent | Promise<AuthIntent>) | undefined;
160
+ export type OnCallbackSuccess<UserType> = ((context: CallbackContext<UserType>) => void | Response | StatusReturn | Promise<void | Response | StatusReturn>) | undefined;
161
+ export type OnLinkIdentity<UserType> = ((context: CallbackContext<UserType>) => void | Response | StatusReturn | Promise<void | Response | StatusReturn>) | undefined;
162
+ export type OnLinkIdentityConflict<UserType> = ((context: CallbackContext<UserType> & {
163
+ conflict: AuthIdentityConflict;
164
+ }) => void | Response | StatusReturn | Promise<void | Response | StatusReturn>) | undefined;
165
+ export type OnLinkConnector<UserType> = ((context: CallbackContext<UserType>) => void | Response | StatusReturn | Promise<void | Response | StatusReturn>) | undefined;
166
+ export type OnCallbackError = (({ error, authProvider, originUrl }: {
167
+ authProvider: string;
168
+ authClient?: string;
169
+ error: unknown;
170
+ originUrl: string;
171
+ }) => void | Promise<void>) | undefined;
172
+ export type OnAuthorizeSuccess = (({ authProvider, authClient, authIntent, authorizationUrl }: {
173
+ authProvider: string;
174
+ authClient?: string;
175
+ authIntent?: AuthIntent;
176
+ authorizationUrl: URL;
177
+ }) => void | Promise<void>) | undefined;
178
+ export type OnAuthorizeError = (({ error, authProvider }: {
179
+ authProvider: string;
180
+ authClient?: string;
181
+ error: unknown;
182
+ }) => void | Promise<void>) | undefined;
183
+ export type OnRefreshSuccess = (({ tokenResponse, authProvider }: {
184
+ tokenResponse: OAuth2TokenResponse;
185
+ authProvider: string;
186
+ authClient?: string;
187
+ }) => void | Promise<void>) | undefined;
188
+ export type OnRefreshError = (({ error, authProvider }: {
189
+ authProvider: string;
190
+ authClient?: string;
191
+ error: unknown;
192
+ }) => void | Promise<void>) | undefined;
193
+ export type OnProfileSuccess = (({ userProfile, authProvider }: {
194
+ userProfile: Record<string, unknown>;
195
+ authProvider: string;
196
+ authClient?: string;
197
+ }) => void | Promise<void>) | undefined;
198
+ export type OnProfileError = (({ error, authProvider }: {
199
+ authProvider: string;
200
+ authClient?: string;
201
+ error: unknown;
202
+ }) => void | Promise<void>) | undefined;
203
+ export type OnRevocationSuccess = (({ tokenToRevoke, authProvider }: {
204
+ tokenToRevoke: string;
205
+ authProvider: string;
206
+ authClient?: string;
207
+ }) => void | Promise<void>) | undefined;
208
+ export type OnRevocationError = (({ error, authProvider }: {
209
+ authProvider: string;
210
+ authClient?: string;
211
+ error: unknown;
212
+ }) => void | Promise<void>) | undefined;
213
+ export type OnStatus<UserType> = (({ impersonator, user }: {
214
+ impersonator?: Impersonator;
215
+ user: UserType | null;
216
+ }) => void | Promise<void>) | undefined;
217
+ export type OnSignOut<UserType> = (({ authProvider, userSessionId, session }: {
218
+ /** Set only when the session was minted by the OAuth2 `/authorize` flow —
219
+ * credentials, MFA, passwordless, SSO, WebAuthn, and impersonation-minted
220
+ * sessions sign out without one. Use it to revoke the upstream provider
221
+ * token when present; ignore when undefined. */
222
+ authProvider: string | undefined;
223
+ userSessionId: UserSessionId;
224
+ session: SessionRecord<UserType>;
225
+ }) => void | Promise<void>) | undefined;
226
+ export type OnSessionCleanup<UserType> = (({ removedSessionCount, removedSessions, removedUnregisteredSessionCount, removedUnregisteredSessions }: {
227
+ /** Total removed, including SQL fast-path rows whose values were never loaded. */
228
+ removedSessionCount: number;
229
+ removedSessions: Map<UserSessionId, SessionData<UserType>>;
230
+ /** Total unregistered sessions removed, including SQL fast-path rows. */
231
+ removedUnregisteredSessionCount: number;
232
+ removedUnregisteredSessions: Map<UserSessionId, UnregisteredSessionData>;
233
+ }) => void | Promise<void>) | undefined;
234
+ export type RouteString = `/${string}`;
235
+ export type AuthorizeRoute = `${string}/:provider${'' | `/${string}`}`;
236
+ export type AuthConfig<UserType> = {
237
+ /** Canonical user resolver: load the application user for a session subject
238
+ * (`sub`). REQUIRED, and the single source of truth for `UserType` — every
239
+ * other user-typed callback (`credentials.getUserByEmail`,
240
+ * `sso.getSsoUser`, `onCallbackSuccess`, …) is checked against the shape
241
+ * `getUser` returns (via `NoInfer`), so they cannot disagree. This is also
242
+ * the resolver the package uses to hydrate the typed `user` in
243
+ * `protectRoute`'s context. */
244
+ getUser: (sub: string) => UserType | null | Promise<UserType | null>;
245
+ providersConfiguration: OAuth2ConfigurationOptions;
246
+ /** Bring-your-own OAuth providers (citra createCustomOAuth2Client) — keys
247
+ * must not collide with built-in provider names. */
248
+ customProviders?: CustomProvidersConfiguration;
249
+ /** Override the `Secure` attribute on every cookie the package sets (session, OAuth state,
250
+ * code_verifier, SSO nonce, ring, etc.). When omitted, defaults to
251
+ * `process.env.NODE_ENV === 'production'` — matching the convention used by
252
+ * express-session / iron-session / lucia / better-auth, and the only way non-browser
253
+ * HTTP clients (curl, SSR fetch, test runners) can round-trip cookies on a plain-HTTP
254
+ * dev server. If you run prod without setting `NODE_ENV=production`, set
255
+ * `cookieSecure: true` explicitly. */
256
+ cookieSecure?: boolean;
257
+ /** OpenTelemetry instrumentation. Pass your configured `TracerProvider` (from
258
+ * `@opentelemetry/sdk-trace-node` / `-web` / `-bun`) and the package emits spans for
259
+ * every key flow: `auth.credentials.login`, `auth.oauth.callback`, `auth.mfa.challenge`,
260
+ * `auth.webhook.deliver`, etc. Pipe the spans into Datadog / Honeycomb / Grafana Tempo /
261
+ * Sentry / Jaeger / whichever APM you already pay for. `@opentelemetry/api` is an
262
+ * OPTIONAL peer dep — consumers that leave `tracing` unset never load it. */
263
+ tracing?: TracingConfig;
264
+ authorizeRoute?: AuthorizeRoute;
265
+ profileRoute?: RouteString;
266
+ callbackRoute?: RouteString;
267
+ refreshRoute?: RouteString;
268
+ revokeRoute?: RouteString;
269
+ signoutRoute?: RouteString;
270
+ statusRoute?: RouteString;
271
+ cleanupIntervalMs?: number;
272
+ maxSessions?: number;
273
+ sessionDurationMs?: number;
274
+ authSessionStore?: AuthSessionStore<NoInfer<UserType>>;
275
+ /** Append-only audit logging. When present, `auth()` emits structured events
276
+ * (register, login, mfa_*, password_reset, logout, …) from every flow into the
277
+ * `auditStore` and/or `onAuditEvent` hook. SOC 2 prerequisite. */
278
+ audit?: AuditConfig<NoInfer<UserType>>;
279
+ /** Local email/password (credentials) block. Additive and optional — when present,
280
+ * mounts register / verify-email / login / reset-password routes that produce the
281
+ * same `SessionData<UserType>` as OAuth, transparent to `protectRoute`. */
282
+ credentials?: CredentialsConfig<NoInfer<UserType>>;
283
+ /** Passwordless login: magic links + email/SMS OTP. When present, mounts the magic-link flow
284
+ * (if `onSendMagicLink` is set) and/or the OTP flow (if `onSendOtp` is set) under
285
+ * `{passwordlessRoute}`; each verify route resolves the email to a user and mints the same
286
+ * `SessionData<UserType>` as every other flow. */
287
+ passwordless?: PasswordlessConfig<NoInfer<UserType>>;
288
+ /** Multi-factor auth (TOTP + backup codes). When present alongside `credentials`,
289
+ * `auth()` auto-wires the login MFA gate, mounts the enroll/challenge routes, and
290
+ * promotes the parked session once a factor is verified. */
291
+ mfa?: MfaConfig<NoInfer<UserType>>;
292
+ /** Per-identity attempt throttling + account lockout on the credential login route
293
+ * (progressive: locks after `maxAttempts` failures within `windowMs`). */
294
+ lockout?: LockoutConfig;
295
+ /** Self-service session management: `GET /auth/sessions` (list the caller's active
296
+ * sessions) and `DELETE /auth/sessions/:id` (remote revoke). Requires an
297
+ * `authSessionStore` that can enumerate sessions. */
298
+ sessions?: SessionsConfig<NoInfer<UserType>>;
299
+ /** Per-organization enterprise SSO (the WorkOS-style model). When present, mounts
300
+ * `GET {ssoRoute}/oidc/:organizationId/authorize` + `.../callback`, resolves the org's
301
+ * OIDC connection from `ssoConnectionStore`, verifies the id_token in-house against the
302
+ * issuer's JWKS, and mints the same `SessionData<UserType>` as every other flow. */
303
+ sso?: SSOConfig<NoInfer<UserType>>;
304
+ /** SCIM 2.0 auto-provisioning for enterprise directory sync (Okta / Azure AD). When present,
305
+ * mounts `{scimRoute}/Users` (+ `/ServiceProviderConfig`) with per-org bearer-token auth via
306
+ * `scimTokenStore`, and maps SCIM resources to the consumer's user store through hooks. */
307
+ scim?: ScimConfig;
308
+ /** Machine-to-machine authentication: static API keys (`sk_…`) + the OAuth2
309
+ * client_credentials grant. When `apiClientStore` + `accessTokenStore` are set,
310
+ * mounts `{tokenRoute}` (defaults `/oauth2/token`) so registered clients can
311
+ * exchange `client_id`/`client_secret` for short-lived `at_…` access tokens.
312
+ * Pair with the exported `createApiKey` / `resolveApiPrincipal` / `hasScopes`
313
+ * helpers to issue and guard with static keys. */
314
+ apikeys?: ApiKeysConfig;
315
+ /** Standards-first delegated agent authorization. Mounts RFC 9728 protected-resource
316
+ * metadata and contributes `protectAgent`, while protocol adapters normalize verified
317
+ * credentials into durable agent registrations + user delegations. */
318
+ agentAuth?: AgentAuthConfig;
319
+ /** OAuth2 / OIDC provider — makes your app an identity provider ("Sign in with
320
+ * <yourapp>"). Mounts `{oidcRoute}/authorize` + `/token` + `/jwks` and
321
+ * `/.well-known/openid-configuration`: authorization_code + mandatory PKCE, ES256
322
+ * JWTs signed by a key you own (self-hosted JWKS), refresh-token rotation, and
323
+ * optional DPoP (RFC 9449) sender-constrained tokens. The authorize endpoint reuses
324
+ * the package session, so the IdP login gets passkeys / MFA / SSO for free. */
325
+ oidc?: OidcProviderConfig<NoInfer<UserType>>;
326
+ /** First-class multi-tenancy (the WorkOS model). When present, mounts organization +
327
+ * membership + invitation routes under `{organizationsRoute}`: list the caller's orgs, create
328
+ * one (caller becomes owner), invite/accept/revoke by email, and list/remove members. Ties the
329
+ * bare `organizationId` used by SSO/SCIM/RBAC into a real tenant model with org-scoped roles. */
330
+ organizations?: OrganizationsConfig<NoInfer<UserType>>;
331
+ /** Admin portal — the WorkOS self-serve "setup link" model, headless. When present, mounts
332
+ * `{portalRoute}` endpoints a customer's IT admin (holding a scoped setup token from
333
+ * `createSetupSession`) calls to read the service-provider URLs and configure their own SSO
334
+ * connection / SCIM token. JSON contract, so the portal UI can be built in any framework. */
335
+ portal?: PortalConfig;
336
+ /** Org-scoped roles & permissions (builds on `organizations`). When present, mounts routes to
337
+ * list an org's role definitions and set a member's roles. Pair with
338
+ * `createMembershipPermissionResolver` to make `authorization.hasPermission` turnkey. */
339
+ roles?: RolesConfig<NoInfer<UserType>>;
340
+ /** Role-based / attribute-based access control (E4). When present, `auth()` exposes a
341
+ * `protectPermission(check, handler)` derive (alongside `protectRoute`) that delegates the
342
+ * decision to your `hasPermission` hook — the package stays schema-agnostic about roles. */
343
+ authorization?: AuthorizationConfig<NoInfer<UserType>>;
344
+ /** GDPR/CCPA self-service compliance (E5). When present, mounts `GET {complianceRoute}/export`
345
+ * (right to access) and `DELETE {complianceRoute}` (right to erasure — runs your delete hook,
346
+ * revokes the user's sessions, clears the cookie). Pair with `audit.redact` for PII redaction. */
347
+ compliance?: ComplianceConfig<NoInfer<UserType>>;
348
+ /** Passwordless / passkey auth (WebAuthn). When present, mounts the registration ceremony
349
+ * (`{webauthnRoute}/register/options` + `/verify`, adds a passkey to the authenticated caller)
350
+ * and the authentication ceremony (`.../authenticate/options` + `/verify`, passwordless sign-in
351
+ * → mints the same `SessionData<UserType>`). A `webauthnAdapter` wraps a vetted library (e.g.
352
+ * `@simplewebauthn/server`); the package never bundles the WebAuthn crypto. */
353
+ webauthn?: WebAuthnConfig<NoInfer<UserType>>;
354
+ /** Signed outbound webhooks. When present, every emitted auth event (the audit taxonomy) is
355
+ * HMAC-signed (Standard Webhooks scheme) and POSTed to each endpoint. Delivery is best-effort
356
+ * and isolated per endpoint; configuring this alone (without `audit`) is enough to turn on
357
+ * event emission. PII redaction (`audit.redact`) applies before delivery. */
358
+ webhooks?: WebhooksConfig;
359
+ /** Enable the built-in HTMX fragment routes (login, identities, connectors,
360
+ * account, signout, delete-account). Supply provider display data + the
361
+ * identity/connector data actions; the package owns the route wiring and
362
+ * renderers. See @absolutejs/auth/ui to override individual fragments.
363
+ *
364
+ * Only available when `UserType` has the fields the fragments render
365
+ * (`sub` + optional email/name); users that don't enable HTMX are never
366
+ * constrained. */
367
+ htmx?: NoInfer<UserType> extends AuthHtmxUser ? AuthHtmxConfig : never;
368
+ unregisteredSessionDurationMs?: number;
369
+ resolveAuthIntent?: ResolveAuthIntent<NoInfer<UserType>>;
370
+ onAuthorizeSuccess?: OnAuthorizeSuccess;
371
+ onAuthorizeError?: OnAuthorizeError;
372
+ onCallbackSuccess?: OnCallbackSuccess<NoInfer<UserType>>;
373
+ onLinkIdentity?: OnLinkIdentity<NoInfer<UserType>>;
374
+ onLinkIdentityConflict?: OnLinkIdentityConflict<NoInfer<UserType>>;
375
+ onLinkConnector?: OnLinkConnector<NoInfer<UserType>>;
376
+ onCallbackError?: OnCallbackError;
377
+ onStatus?: OnStatus<NoInfer<UserType>>;
378
+ onRefreshSuccess?: OnRefreshSuccess;
379
+ onRefreshError?: OnRefreshError;
380
+ onSignOut?: OnSignOut<NoInfer<UserType>>;
381
+ onRevocationSuccess?: OnRevocationSuccess;
382
+ onRevocationError?: OnRevocationError;
383
+ onProfileSuccess?: OnProfileSuccess;
384
+ onProfileError?: OnProfileError;
385
+ onSessionCleanup?: OnSessionCleanup<NoInfer<UserType>>;
386
+ };
387
+ /** The serializable subset of `AuthConfig` — the route paths, session durations, and
388
+ * limits that can live in a data file (`auth.config.ts` via `defineAuthSettings`) and
389
+ * be edited from tooling, separate from the code wiring (stores, hooks, callbacks)
390
+ * that stays in the `auth()` call. Spread alongside the rest:
391
+ * `auth({ ...defineAuthSettings({...}), authSessionStore, providersConfiguration })`. */
392
+ export type AuthSettings = Pick<AuthConfig<unknown>, 'authorizeRoute' | 'callbackRoute' | 'cleanupIntervalMs' | 'maxSessions' | 'profileRoute' | 'refreshRoute' | 'revokeRoute' | 'sessionDurationMs' | 'signoutRoute' | 'statusRoute' | 'unregisteredSessionDurationMs'>;
393
+ export type ClientProviderEntry = {
394
+ providerConfiguration: ProviderConfig;
395
+ requiresPKCE: boolean;
396
+ clientName?: string;
397
+ providerInstance: OAuth2Client<ProviderOption>;
398
+ scope?: string[];
399
+ searchParams?: [string, string][];
400
+ };
401
+ export type ClientProviderGroup = {
402
+ entries: Record<string, ClientProviderEntry>;
403
+ isSingleClient: boolean;
404
+ };
405
+ export type ClientProviders = Record<string, ClientProviderGroup>;
406
+ export type InsantiateUserSessionProps<UserType> = {
407
+ authProvider: string;
408
+ /** Required for custom providers (names outside the citra registry). */
409
+ providerConfiguration?: ProviderConfig;
410
+ tokenResponse: OAuth2TokenResponse;
411
+ session: SessionRecord<UserType>;
412
+ unregisteredSession: UnregisteredSessionRecord;
413
+ providerInstance: OAuth2Client<ProviderOption>;
414
+ user_session_id: Cookie<UserSessionId | undefined>;
415
+ onNewUser: OnNewUser<UserType>;
416
+ getUser: GetUser<UserType>;
417
+ cookieSecure?: boolean;
418
+ resolvedAuthorization?: ResolvedOAuthAuthorization;
419
+ sessionDurationMs?: number;
420
+ unregisteredSessionDurationMs?: number;
421
+ };
@@ -0,0 +1,45 @@
1
+ import { OAuth2Client, OAuth2TokenResponse, ProviderConfig, ProviderOption } from 'citra';
2
+ import { Cookie } from 'elysia';
3
+ import { AuthHtmxConfig } from './htmx/types';
4
+ import { AuthConfig, AuthSettings, InsantiateUserSessionProps, OAuth2ConfigurationOptions, ResolvedOAuthAuthorization, SessionRecord, UnregisteredSessionRecord, UserSessionId } from './types';
5
+ export declare const defineAuthConfig: <UserType>(configuration: AuthConfig<UserType>) => AuthConfig<UserType>;
6
+ export declare const defineAuthHtmxConfig: (htmxConfig: AuthHtmxConfig) => AuthHtmxConfig;
7
+ export declare const defineAuthSettings: (settings: AuthSettings) => AuthSettings;
8
+ export declare const defineProvidersConfiguration: (providersConfiguration: OAuth2ConfigurationOptions) => OAuth2ConfigurationOptions;
9
+ export declare const getStatus: <UserType>(session: SessionRecord<UserType>, user_session_id: Cookie<UserSessionId | undefined>) => Promise<{
10
+ error: {
11
+ readonly code: "Bad Request";
12
+ readonly message: "Cookies are missing";
13
+ };
14
+ user: null;
15
+ } | {
16
+ error: null;
17
+ user: NonNullable<UserType> | null;
18
+ }>;
19
+ export declare const instantiateUserSession: <UserType>({ authProvider, providerConfiguration, cookieSecure, session, user_session_id, unregisteredSession, tokenResponse, providerInstance, getUser, onNewUser, resolvedAuthorization, sessionDurationMs, unregisteredSessionDurationMs }: InsantiateUserSessionProps<UserType>) => Promise<Response | import("./types").StatusReturn | undefined>;
20
+ export declare const resolveCookieSecure: (override?: boolean) => boolean;
21
+ export declare const resolveOAuthAuthorization: ({ authProvider, providerConfiguration, providerInstance, tokenResponse, now }: {
22
+ authProvider: string;
23
+ providerConfiguration?: ProviderConfig;
24
+ providerInstance: Pick<OAuth2Client<ProviderOption>, "fetchUserProfile">;
25
+ tokenResponse: OAuth2TokenResponse;
26
+ now?: number;
27
+ }) => Promise<ResolvedOAuthAuthorization>;
28
+ export declare const resolveOAuthTokenExpiresAt: (tokenResponse: OAuth2TokenResponse, now?: number) => number | undefined;
29
+ type ValidateSessionProps<SessionType extends Record<string, unknown> & {
30
+ expiresAt: number;
31
+ }> = {
32
+ user_session_id: Cookie<UserSessionId | undefined>;
33
+ session: Record<UserSessionId, SessionType>;
34
+ };
35
+ export declare const validateSession: <SessionType extends Record<string, unknown> & {
36
+ expiresAt: number;
37
+ }>({ user_session_id, session }: ValidateSessionProps<SessionType>) => SessionType | undefined;
38
+ type GetUserSessionIdProps<UserType> = {
39
+ cookieSecure?: boolean;
40
+ user_session_id: Cookie<UserSessionId | undefined>;
41
+ session?: SessionRecord<UserType>;
42
+ unregisteredSession?: UnregisteredSessionRecord;
43
+ };
44
+ export declare const getUserSessionId: <UserType>({ cookieSecure, user_session_id, session, unregisteredSession }: GetUserSessionIdProps<UserType>) => `${string}-${string}-${string}-${string}-${string}`;
45
+ export {};
@@ -0,0 +1,20 @@
1
+ import { type SecretCipher } from '../compliance/cipher';
2
+ import type { VaultStore } from './types';
3
+ export type Vault = {
4
+ delete: (ownerId: string, name: string) => Promise<void>;
5
+ get: (ownerId: string, name: string) => Promise<string | undefined>;
6
+ list: (ownerId: string) => Promise<string[]>;
7
+ put: (ownerId: string, name: string, value: string) => Promise<void>;
8
+ };
9
+ export declare const createVault: ({ cipher, store }: {
10
+ cipher: SecretCipher;
11
+ store: VaultStore;
12
+ }) => Vault;
13
+ export type VaultKeyRotationResult = {
14
+ rotated: number;
15
+ };
16
+ export declare const rotateVaultKey: ({ newKey, oldKey, store }: {
17
+ newKey: string;
18
+ oldKey: string;
19
+ store: VaultStore;
20
+ }) => Promise<VaultKeyRotationResult>;
@@ -0,0 +1,2 @@
1
+ import type { VaultStore } from './types';
2
+ export declare const createInMemoryVaultStore: () => VaultStore;
@@ -0,0 +1,86 @@
1
+ import { type AnyPgDatabase } from '../stores/postgres';
2
+ import type { VaultStore } from './types';
3
+ export declare const vaultEntriesTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
4
+ name: "auth_vault_entries";
5
+ schema: undefined;
6
+ columns: {
7
+ created_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_vault_entries", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
8
+ name: string;
9
+ tableName: "auth_vault_entries";
10
+ dataType: "number int53";
11
+ data: number;
12
+ driverParam: string | number;
13
+ notNull: true;
14
+ hasDefault: false;
15
+ isPrimaryKey: false;
16
+ isAutoincrement: false;
17
+ hasRuntimeDefault: false;
18
+ enumValues: undefined;
19
+ identity: undefined;
20
+ generated: undefined;
21
+ }>;
22
+ encrypted_value: import("drizzle-orm/pg-core").PgBuildColumn<"auth_vault_entries", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>>, {
23
+ name: string;
24
+ tableName: "auth_vault_entries";
25
+ dataType: "string";
26
+ data: string;
27
+ driverParam: string;
28
+ notNull: true;
29
+ hasDefault: false;
30
+ isPrimaryKey: false;
31
+ isAutoincrement: false;
32
+ hasRuntimeDefault: false;
33
+ enumValues: undefined;
34
+ identity: undefined;
35
+ generated: undefined;
36
+ }>;
37
+ name: import("drizzle-orm/pg-core").PgBuildColumn<"auth_vault_entries", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
38
+ name: string;
39
+ tableName: "auth_vault_entries";
40
+ dataType: "string";
41
+ data: string;
42
+ driverParam: string;
43
+ notNull: true;
44
+ hasDefault: false;
45
+ isPrimaryKey: false;
46
+ isAutoincrement: false;
47
+ hasRuntimeDefault: false;
48
+ enumValues: undefined;
49
+ identity: undefined;
50
+ generated: undefined;
51
+ }>;
52
+ owner_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_vault_entries", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
53
+ name: string;
54
+ tableName: "auth_vault_entries";
55
+ dataType: "string";
56
+ data: string;
57
+ driverParam: string;
58
+ notNull: true;
59
+ hasDefault: false;
60
+ isPrimaryKey: false;
61
+ isAutoincrement: false;
62
+ hasRuntimeDefault: false;
63
+ enumValues: undefined;
64
+ identity: undefined;
65
+ generated: undefined;
66
+ }>;
67
+ updated_at_ms: import("drizzle-orm/pg-core").PgBuildColumn<"auth_vault_entries", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
68
+ name: string;
69
+ tableName: "auth_vault_entries";
70
+ dataType: "number int53";
71
+ data: number;
72
+ driverParam: string | number;
73
+ notNull: true;
74
+ hasDefault: false;
75
+ isPrimaryKey: false;
76
+ isAutoincrement: false;
77
+ hasRuntimeDefault: false;
78
+ enumValues: undefined;
79
+ identity: undefined;
80
+ generated: undefined;
81
+ }>;
82
+ };
83
+ dialect: "pg";
84
+ }>;
85
+ export declare const createNeonVaultStore: (databaseUrl: string) => VaultStore;
86
+ export declare const createPostgresVaultStore: <DB extends AnyPgDatabase>(db: DB) => VaultStore;
@@ -0,0 +1,14 @@
1
+ export type VaultEntry = {
2
+ createdAt: number;
3
+ encryptedValue: string;
4
+ name: string;
5
+ ownerId: string;
6
+ updatedAt: number;
7
+ };
8
+ export type VaultStore = {
9
+ deleteEntry: (ownerId: string, name: string) => Promise<void>;
10
+ getEntry: (ownerId: string, name: string) => Promise<VaultEntry | undefined>;
11
+ listAllEntries: () => Promise<VaultEntry[]>;
12
+ listEntries: (ownerId: string) => Promise<VaultEntry[]>;
13
+ saveEntry: (entry: VaultEntry) => Promise<void>;
14
+ };
@@ -0,0 +1,2 @@
1
+ import type { PresentationRequestStore } from './openid4vp';
2
+ export declare const createInMemoryPresentationRequestStore: () => PresentationRequestStore;