loginbase 0.1.0 → 0.1.1
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/config.d.ts +1 -1
- package/dist/handler.d.ts +2 -2
- package/dist/handler.js +7 -7
- package/dist/index.d.ts +11 -11
- package/dist/index.js +10 -10
- package/dist/middleware.d.ts +1 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
package/dist/handler.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AuthVariables } from "./middleware";
|
|
2
|
-
import type { LoginConfig } from "./config";
|
|
1
|
+
import { type AuthVariables } from "./middleware.js";
|
|
2
|
+
import type { LoginConfig } from "./config.js";
|
|
3
3
|
export declare function createAuthApp<TEnv>(getConfig: (env: TEnv) => LoginConfig, basePath: string): import("hono/hono-base").HonoBase<{
|
|
4
4
|
Variables: AuthVariables;
|
|
5
5
|
}, import("hono/types").BlankSchema, string, string>;
|
package/dist/handler.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
// 内联的用户 upsert / 90 天试用 / /me 端点为 Tono 业务语义,暂留库内,
|
|
4
4
|
// 第 2 步钩子化(onVerified)时移回 Tono。
|
|
5
5
|
import { Hono } from "hono";
|
|
6
|
-
import { generateCode, storeCode, readCode, deleteCode, incrementAttempts, MAX_ATTEMPTS, } from "./code";
|
|
7
|
-
import { sendCodeEmail } from "./email";
|
|
8
|
-
import { checkSendRateLimit, recordSend } from "./rate_limit";
|
|
9
|
-
import { createSession, hashRefreshToken, findSession, rotateSession, revokeFamily, tryRescueSession, revokeSession, revokeAllForUser, } from "./session";
|
|
10
|
-
import { signAccessToken } from "./token";
|
|
11
|
-
import { createAuthMiddleware } from "./middleware";
|
|
12
|
-
import { logEvent } from "./log";
|
|
6
|
+
import { generateCode, storeCode, readCode, deleteCode, incrementAttempts, MAX_ATTEMPTS, } from "./code.js";
|
|
7
|
+
import { sendCodeEmail } from "./email.js";
|
|
8
|
+
import { checkSendRateLimit, recordSend } from "./rate_limit.js";
|
|
9
|
+
import { createSession, hashRefreshToken, findSession, rotateSession, revokeFamily, tryRescueSession, revokeSession, revokeAllForUser, } from "./session.js";
|
|
10
|
+
import { signAccessToken } from "./token.js";
|
|
11
|
+
import { createAuthMiddleware } from "./middleware.js";
|
|
12
|
+
import { logEvent } from "./log.js";
|
|
13
13
|
// 新用户注册赠送的 Pro 试用时长(3 个月)
|
|
14
14
|
const TRIAL_PERIOD_MS = 90 * 24 * 60 * 60 * 1000;
|
|
15
15
|
export function createAuthApp(getConfig, basePath) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Hono } from "hono";
|
|
2
2
|
import type { MiddlewareHandler } from "hono";
|
|
3
|
-
import { type CreateLoginOptions, type LoginConfig } from "./config";
|
|
4
|
-
import { type AuthVariables } from "./middleware";
|
|
3
|
+
import { type CreateLoginOptions, type LoginConfig } from "./config.js";
|
|
4
|
+
import { type AuthVariables } from "./middleware.js";
|
|
5
5
|
export interface Login<TEnv> {
|
|
6
6
|
/** Hono 实例(已含 basePath)。Hono 消费方:app.route("/", login.app) */
|
|
7
7
|
app: Hono<{
|
|
@@ -15,12 +15,12 @@ export interface Login<TEnv> {
|
|
|
15
15
|
}>;
|
|
16
16
|
}
|
|
17
17
|
export declare function createLogin<TEnv = unknown>(resolve: (env: TEnv) => LoginConfig, options?: CreateLoginOptions): Login<TEnv>;
|
|
18
|
-
export type { LoginConfig, CreateLoginOptions } from "./config";
|
|
19
|
-
export type { AuthVariables } from "./middleware";
|
|
20
|
-
export { createAuthMiddleware } from "./middleware";
|
|
21
|
-
export * from "./code";
|
|
22
|
-
export * from "./email";
|
|
23
|
-
export * from "./rate_limit";
|
|
24
|
-
export * from "./session";
|
|
25
|
-
export * from "./token";
|
|
26
|
-
export { logEvent } from "./log";
|
|
18
|
+
export type { LoginConfig, CreateLoginOptions } from "./config.js";
|
|
19
|
+
export type { AuthVariables } from "./middleware.js";
|
|
20
|
+
export { createAuthMiddleware } from "./middleware.js";
|
|
21
|
+
export * from "./code.js";
|
|
22
|
+
export * from "./email.js";
|
|
23
|
+
export * from "./rate_limit.js";
|
|
24
|
+
export * from "./session.js";
|
|
25
|
+
export * from "./token.js";
|
|
26
|
+
export { logEvent } from "./log.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { memoizeResolver } from "./config";
|
|
2
|
-
import { createAuthApp } from "./handler";
|
|
3
|
-
import { createAuthMiddleware } from "./middleware";
|
|
1
|
+
import { memoizeResolver } from "./config.js";
|
|
2
|
+
import { createAuthApp } from "./handler.js";
|
|
3
|
+
import { createAuthMiddleware } from "./middleware.js";
|
|
4
4
|
export function createLogin(resolve, options = {}) {
|
|
5
5
|
const getConfig = memoizeResolver(resolve);
|
|
6
6
|
const app = createAuthApp(getConfig, options.basePath ?? "/auth");
|
|
@@ -10,12 +10,12 @@ export function createLogin(resolve, options = {}) {
|
|
|
10
10
|
middleware: createAuthMiddleware(getConfig),
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
export { createAuthMiddleware } from "./middleware";
|
|
13
|
+
export { createAuthMiddleware } from "./middleware.js";
|
|
14
14
|
// 底层模块出口:verifyAccessToken 供裸 Worker 的 requireAuth 双轨;
|
|
15
15
|
// session/code 等出口供消费方测试工具(如 Tono test/helpers)复用。
|
|
16
|
-
export * from "./code";
|
|
17
|
-
export * from "./email";
|
|
18
|
-
export * from "./rate_limit";
|
|
19
|
-
export * from "./session";
|
|
20
|
-
export * from "./token";
|
|
21
|
-
export { logEvent } from "./log";
|
|
16
|
+
export * from "./code.js";
|
|
17
|
+
export * from "./email.js";
|
|
18
|
+
export * from "./rate_limit.js";
|
|
19
|
+
export * from "./session.js";
|
|
20
|
+
export * from "./token.js";
|
|
21
|
+
export { logEvent } from "./log.js";
|
package/dist/middleware.d.ts
CHANGED
package/package.json
CHANGED