@spfn/auth 0.3.0-beta.2 → 0.3.0-beta.20
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/README.md +1382 -23
- package/dist/client-proof.d.ts +45 -15
- package/dist/client-proof.js +198 -4
- package/dist/client-proof.js.map +1 -1
- package/dist/client.d.ts +92 -1
- package/dist/client.js +58 -0
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +302 -0
- package/dist/config.js +134 -4
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +370 -3
- package/dist/errors.js +245 -2
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +185 -2
- package/dist/index.js +256 -2
- package/dist/index.js.map +1 -1
- package/dist/machine-principals-BD4tnASp.d.ts +2739 -0
- package/dist/nextjs/api.js +350 -12
- package/dist/nextjs/api.js.map +1 -1
- package/dist/nextjs/client.d.ts +28 -1
- package/dist/nextjs/client.js +24 -3
- package/dist/nextjs/client.js.map +1 -1
- package/dist/nextjs/server.d.ts +173 -3
- package/dist/nextjs/server.js +372 -10
- package/dist/nextjs/server.js.map +1 -1
- package/dist/server.d.ts +3761 -414
- package/dist/server.js +5865 -1043
- package/dist/server.js.map +1 -1
- package/dist/{session-DTHahDQ9.d.ts → session-Dfwu5g2W.d.ts} +28 -1
- package/migrations/20260810112144_colorful_tomorrow_man/migration.sql +18 -0
- package/migrations/20260810112144_colorful_tomorrow_man/snapshot.json +3576 -0
- package/migrations/20260901091716_fine_arclight/migration.sql +21 -0
- package/migrations/20260901091716_fine_arclight/snapshot.json +3849 -0
- package/migrations/20260906155957_natural_moonstone/migration.sql +33 -0
- package/migrations/20260906155957_natural_moonstone/snapshot.json +4275 -0
- package/migrations/20260907020904_giant_eternals/migration.sql +21 -0
- package/migrations/20260907020904_giant_eternals/snapshot.json +4561 -0
- package/migrations/20260907044807_eminent_angel/migration.sql +2 -0
- package/migrations/20260907044807_eminent_angel/snapshot.json +4561 -0
- package/migrations/20260918083158_foamy_roughhouse/migration.sql +55 -0
- package/migrations/20260918083158_foamy_roughhouse/snapshot.json +5271 -0
- package/package.json +9 -6
- package/dist/authenticate-55LeXHqZ.d.ts +0 -1447
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
import { K as KeyAlgorithmType } from './types-DYyhze28.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @spfn/auth - Return-path validation
|
|
5
|
+
*
|
|
6
|
+
* One rule for every flow that hands a caller-supplied destination back to the
|
|
7
|
+
* browser: the verified-email signup link, the password reset link, and the
|
|
8
|
+
* OAuth start/callback seams. Apps that build their own destination before
|
|
9
|
+
* calling an auth route import the same function rather than writing a second
|
|
10
|
+
* rule that drifts from this one.
|
|
11
|
+
*
|
|
12
|
+
* The module imports nothing on purpose — it is part of the client bundle
|
|
13
|
+
* (`@spfn/auth/nextjs/client`), which must not pull server code in behind it.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Whether a return path can be handed back to the browser.
|
|
17
|
+
*
|
|
18
|
+
* Only a path within the app is allowed. The rejected shapes are the ones that
|
|
19
|
+
* turn a return path into an open redirect: an absolute URL, a protocol-relative
|
|
20
|
+
* `//host` that a browser reads as another origin, a backslash that some
|
|
21
|
+
* browsers normalize into a slash, any `..` traversal, and any character a URL
|
|
22
|
+
* parser strips before parsing (see above).
|
|
23
|
+
*
|
|
24
|
+
* The value is judged exactly as written: nothing is percent-decoded here. A
|
|
25
|
+
* `/a%0d%0a` is therefore a path containing those six literal characters and is
|
|
26
|
+
* accepted — no decoder downstream turns it back into header bytes.
|
|
27
|
+
*/
|
|
28
|
+
declare function isSafeReturnPath(returnPath: string): boolean;
|
|
29
|
+
|
|
3
30
|
/**
|
|
4
31
|
* @spfn/auth - Client Session Management
|
|
5
32
|
*
|
|
@@ -50,4 +77,4 @@ declare function getSessionInfo(jwt: string): Promise<{
|
|
|
50
77
|
*/
|
|
51
78
|
declare function shouldRefreshSession(jwt: string, thresholdHours?: number): Promise<boolean>;
|
|
52
79
|
|
|
53
|
-
export { type SessionData as S, shouldRefreshSession as a, getSessionInfo as g, sealSession as s, unsealSession as u };
|
|
80
|
+
export { type SessionData as S, shouldRefreshSession as a, getSessionInfo as g, isSafeReturnPath as i, sealSession as s, unsealSession as u };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
CREATE TABLE "spfn_auth"."signup_link_tokens" (
|
|
2
|
+
"id" bigserial PRIMARY KEY,
|
|
3
|
+
"email" text NOT NULL,
|
|
4
|
+
"token_hash" text NOT NULL,
|
|
5
|
+
"return_path" text,
|
|
6
|
+
"expires_at" timestamp with time zone NOT NULL,
|
|
7
|
+
"consumed_at" timestamp with time zone,
|
|
8
|
+
"superseded_at" timestamp with time zone,
|
|
9
|
+
"setup_secret_hash" text,
|
|
10
|
+
"setup_expires_at" timestamp with time zone,
|
|
11
|
+
"completed_at" timestamp with time zone,
|
|
12
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
13
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
14
|
+
);
|
|
15
|
+
--> statement-breakpoint
|
|
16
|
+
CREATE UNIQUE INDEX "signup_link_token_hash_idx" ON "spfn_auth"."signup_link_tokens" ("token_hash");--> statement-breakpoint
|
|
17
|
+
CREATE UNIQUE INDEX "signup_link_setup_secret_hash_idx" ON "spfn_auth"."signup_link_tokens" ("setup_secret_hash");--> statement-breakpoint
|
|
18
|
+
CREATE INDEX "signup_link_email_idx" ON "spfn_auth"."signup_link_tokens" ("email","expires_at");
|