@fonderie/auth 1.1.0 → 1.2.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.
- package/dist/index.cjs +95 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +98 -52
- package/dist/index.js.map +1 -1
- package/dist/middlewares/index.d.cts +2 -1
- package/dist/middlewares/index.d.ts +2 -1
- package/dist/{session-CLD1WPJs.d.cts → session-C54ksYE8.d.cts} +12 -1
- package/dist/{session-CLD1WPJs.d.ts → session-C54ksYE8.d.ts} +12 -1
- package/package.json +5 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _fonderie_core from '@fonderie/core';
|
|
2
|
-
import { w as withSession } from '../session-
|
|
2
|
+
import { w as withSession } from '../session-C54ksYE8.cjs';
|
|
3
3
|
import '@fonderie/store';
|
|
4
|
+
import '@fonderie/rate-limit';
|
|
4
5
|
|
|
5
6
|
declare const middlewares: {
|
|
6
7
|
requireAuth: _fonderie_core.Middleware;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _fonderie_core from '@fonderie/core';
|
|
2
|
-
import { w as withSession } from '../session-
|
|
2
|
+
import { w as withSession } from '../session-C54ksYE8.js';
|
|
3
3
|
import '@fonderie/store';
|
|
4
|
+
import '@fonderie/rate-limit';
|
|
4
5
|
|
|
5
6
|
declare const middlewares: {
|
|
6
7
|
requireAuth: _fonderie_core.Middleware;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { Middleware } from '@fonderie/core';
|
|
2
2
|
import { IStoreAdapter } from '@fonderie/store';
|
|
3
|
+
import { IRateLimitStore, IRateLimitRule } from '@fonderie/rate-limit';
|
|
4
|
+
|
|
5
|
+
interface IAuthRateLimitConfig {
|
|
6
|
+
store?: IRateLimitStore;
|
|
7
|
+
rules?: Partial<Record<AuthLimitedRoute, IRateLimitRule | false>>;
|
|
8
|
+
}
|
|
9
|
+
type AuthLimitedRoute = 'login' | 'register' | 'forgot' | 'mfaVerify';
|
|
10
|
+
declare function buildAuthIpLimiter(route: AuthLimitedRoute, store: IStoreAdapter, config: IAuthRateLimitConfig | false | undefined): Middleware | null;
|
|
11
|
+
declare function buildAuthAccountLimiter(route: AuthLimitedRoute, store: IStoreAdapter, config: IAuthRateLimitConfig | false | undefined): Middleware | null;
|
|
3
12
|
|
|
4
13
|
interface IAuthSecrets {
|
|
5
14
|
jwtSecret: string;
|
|
@@ -29,6 +38,8 @@ declare const MESSAGE_KEYS: {
|
|
|
29
38
|
};
|
|
30
39
|
type AuthMessageKey = (typeof MESSAGE_KEYS)[keyof typeof MESSAGE_KEYS];
|
|
31
40
|
interface IAuthConfig extends IAuthSecrets, IAuthRuntimeConfig {
|
|
41
|
+
secureCookies?: boolean;
|
|
42
|
+
rateLimit?: IAuthRateLimitConfig | false;
|
|
32
43
|
providers: ('email' | 'phone' | 'google' | 'github')[];
|
|
33
44
|
appName?: string;
|
|
34
45
|
resolve?: (ctx: {
|
|
@@ -38,4 +49,4 @@ interface IAuthConfig extends IAuthSecrets, IAuthRuntimeConfig {
|
|
|
38
49
|
|
|
39
50
|
declare function withSession(store: IStoreAdapter, config: IAuthConfig): Middleware;
|
|
40
51
|
|
|
41
|
-
export { AUTH_CONFIG_KEYS as A, type IAuthConfig as I, MESSAGE_KEYS as M, type
|
|
52
|
+
export { AUTH_CONFIG_KEYS as A, type IAuthConfig as I, MESSAGE_KEYS as M, type AuthLimitedRoute as a, type AuthMessageKey as b, type IAuthRateLimitConfig as c, type IAuthRuntimeConfig as d, type IAuthSecrets as e, buildAuthAccountLimiter as f, buildAuthIpLimiter as g, withSession as w };
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { Middleware } from '@fonderie/core';
|
|
2
2
|
import { IStoreAdapter } from '@fonderie/store';
|
|
3
|
+
import { IRateLimitStore, IRateLimitRule } from '@fonderie/rate-limit';
|
|
4
|
+
|
|
5
|
+
interface IAuthRateLimitConfig {
|
|
6
|
+
store?: IRateLimitStore;
|
|
7
|
+
rules?: Partial<Record<AuthLimitedRoute, IRateLimitRule | false>>;
|
|
8
|
+
}
|
|
9
|
+
type AuthLimitedRoute = 'login' | 'register' | 'forgot' | 'mfaVerify';
|
|
10
|
+
declare function buildAuthIpLimiter(route: AuthLimitedRoute, store: IStoreAdapter, config: IAuthRateLimitConfig | false | undefined): Middleware | null;
|
|
11
|
+
declare function buildAuthAccountLimiter(route: AuthLimitedRoute, store: IStoreAdapter, config: IAuthRateLimitConfig | false | undefined): Middleware | null;
|
|
3
12
|
|
|
4
13
|
interface IAuthSecrets {
|
|
5
14
|
jwtSecret: string;
|
|
@@ -29,6 +38,8 @@ declare const MESSAGE_KEYS: {
|
|
|
29
38
|
};
|
|
30
39
|
type AuthMessageKey = (typeof MESSAGE_KEYS)[keyof typeof MESSAGE_KEYS];
|
|
31
40
|
interface IAuthConfig extends IAuthSecrets, IAuthRuntimeConfig {
|
|
41
|
+
secureCookies?: boolean;
|
|
42
|
+
rateLimit?: IAuthRateLimitConfig | false;
|
|
32
43
|
providers: ('email' | 'phone' | 'google' | 'github')[];
|
|
33
44
|
appName?: string;
|
|
34
45
|
resolve?: (ctx: {
|
|
@@ -38,4 +49,4 @@ interface IAuthConfig extends IAuthSecrets, IAuthRuntimeConfig {
|
|
|
38
49
|
|
|
39
50
|
declare function withSession(store: IStoreAdapter, config: IAuthConfig): Middleware;
|
|
40
51
|
|
|
41
|
-
export { AUTH_CONFIG_KEYS as A, type IAuthConfig as I, MESSAGE_KEYS as M, type
|
|
52
|
+
export { AUTH_CONFIG_KEYS as A, type IAuthConfig as I, MESSAGE_KEYS as M, type AuthLimitedRoute as a, type AuthMessageKey as b, type IAuthRateLimitConfig as c, type IAuthRuntimeConfig as d, type IAuthSecrets as e, buildAuthAccountLimiter as f, buildAuthIpLimiter as g, withSession as w };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonderie/auth",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Drop-in auth for SaaS — email/password, phone OTP, Google OAuth, stateless JWT sessions, TOTP-based MFA with backup codes, and self-service password recovery.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fonderie-js",
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"bcryptjs": "^3.0.3",
|
|
58
58
|
"jsonwebtoken": "^9.0.3",
|
|
59
59
|
"qrcode": "^1.5.4",
|
|
60
|
-
"zod": "^4.4.3"
|
|
60
|
+
"zod": "^4.4.3",
|
|
61
|
+
"@fonderie/rate-limit": "^0.1.0"
|
|
61
62
|
},
|
|
62
63
|
"peerDependencies": {
|
|
63
64
|
"@fonderie/core": "^0.1.1",
|
|
@@ -79,7 +80,8 @@
|
|
|
79
80
|
"@types/qrcode": "^1.5.6",
|
|
80
81
|
"tsup": "^8.5.1",
|
|
81
82
|
"tsx": "^4.21.0",
|
|
82
|
-
"typescript": "^6.0.3"
|
|
83
|
+
"typescript": "^6.0.3",
|
|
84
|
+
"@fonderie/rate-limit": "../rate-limit"
|
|
83
85
|
},
|
|
84
86
|
"publishConfig": {
|
|
85
87
|
"access": "public"
|