@runlot/auth 0.1.0-rc.73 → 0.1.0-rc.74
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/client.d.ts +19 -15
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +27 -21
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +22 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -2,34 +2,38 @@ import { type User } from "./index.js";
|
|
|
2
2
|
export interface NextOpts {
|
|
3
3
|
next?: string;
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
5
|
+
/** The social providers a project can register (docs/auth.md §9). */
|
|
6
6
|
export type AuthProvider = "github" | "google" | "kakao";
|
|
7
|
-
/**
|
|
7
|
+
/** The sign-in page. Given a provider, it goes straight to that provider's
|
|
8
|
+
* authorize. */
|
|
8
9
|
export declare function signInUrl(provider?: AuthProvider, opts?: NextOpts): string;
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* The sign-up page.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
* (docs/auth.md §5 — `GET sign-in/{provider}
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* **There is no provider argument.** For social logins, signing up and signing
|
|
14
|
+
* in are one path (docs/auth.md §5 — there is only `GET sign-in/{provider}`,
|
|
15
|
+
* and the identity upsert rides the linking rules of §6), so a URL like
|
|
16
|
+
* `signUpUrl("github")` does not exist on the server. To sign somebody up with
|
|
17
|
+
* a social provider, use `signInUrl(provider)`.
|
|
16
18
|
*/
|
|
17
19
|
export declare function signUpUrl(opts?: NextOpts): string;
|
|
18
20
|
/**
|
|
19
|
-
*
|
|
21
|
+
* Sign-out.
|
|
20
22
|
*
|
|
21
|
-
*
|
|
22
|
-
* action={signOutUrl()}>`
|
|
23
|
-
* `<img>`
|
|
23
|
+
* **It is a POST target, not a link** (docs/auth.md §5). Use it as `<form
|
|
24
|
+
* method="post" action={signOutUrl()}>` — if a GET could sign somebody out, a
|
|
25
|
+
* single `<img>` embedded in somebody else's page could throw the user out.
|
|
24
26
|
*/
|
|
25
27
|
export declare function signOutUrl(opts?: NextOpts): string;
|
|
26
28
|
/**
|
|
27
|
-
*
|
|
29
|
+
* Who is signed in right now. This is what a client-rendered app calls while
|
|
30
|
+
* booting.
|
|
28
31
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
32
|
+
* Anything other than a 200 gives `{ user: null }` — being signed out is an
|
|
33
|
+
* answer, not an exception (a 401 is an answer too), and throwing would turn
|
|
34
|
+
* every page into a try/catch.
|
|
31
35
|
*
|
|
32
|
-
* `fetchImpl`
|
|
36
|
+
* `fetchImpl` is the hole through which the tests inject a fake.
|
|
33
37
|
*/
|
|
34
38
|
export declare function session(fetchImpl?: typeof fetch): Promise<{
|
|
35
39
|
user: User | null;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qEAAqE;AACrE,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAsBzD;iBACiB;AACjB,wBAAgB,SAAS,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAE1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAEjD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAElD;AAED;;;;;;;;;GASG;AACH,wBAAsB,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,CAAC,CAKtF"}
|
package/dist/client.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
1
|
+
// Browser helpers (docs/auth.md §10). Building links and one `GET /session` is
|
|
2
|
+
// all there is, so it has zero dependencies, and it does not claim to know
|
|
3
|
+
// again what the server already knows.
|
|
3
4
|
import { AUTH_BASE } from "./index.js";
|
|
4
|
-
// `next`
|
|
5
|
-
//
|
|
6
|
-
//
|
|
5
|
+
// `next` lets through only a same-origin relative path — the same rule as
|
|
6
|
+
// `safeNext` in docs/auth.md §5. It has to start with `/` and must not start
|
|
7
|
+
// with `//`: the browser reads `//evil.example` as an absolute URL, which makes
|
|
8
|
+
// it an open redirect.
|
|
7
9
|
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
+
// Filtering here is a convenience, not a security boundary. A link can also be
|
|
11
|
+
// made by hand, so the server runs the same check again.
|
|
10
12
|
function safeNext(next) {
|
|
11
13
|
if (next === undefined || next === "")
|
|
12
14
|
return null;
|
|
@@ -21,38 +23,42 @@ function authUrl(path, provider, opts) {
|
|
|
21
23
|
const next = safeNext(opts?.next);
|
|
22
24
|
return next === null ? base : `${base}?next=${encodeURIComponent(next)}`;
|
|
23
25
|
}
|
|
24
|
-
/**
|
|
26
|
+
/** The sign-in page. Given a provider, it goes straight to that provider's
|
|
27
|
+
* authorize. */
|
|
25
28
|
export function signInUrl(provider, opts) {
|
|
26
29
|
return authUrl("sign-in", provider, opts);
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
32
|
+
* The sign-up page.
|
|
30
33
|
*
|
|
31
|
-
*
|
|
32
|
-
* (docs/auth.md §5 — `GET sign-in/{provider}
|
|
33
|
-
*
|
|
34
|
-
*
|
|
34
|
+
* **There is no provider argument.** For social logins, signing up and signing
|
|
35
|
+
* in are one path (docs/auth.md §5 — there is only `GET sign-in/{provider}`,
|
|
36
|
+
* and the identity upsert rides the linking rules of §6), so a URL like
|
|
37
|
+
* `signUpUrl("github")` does not exist on the server. To sign somebody up with
|
|
38
|
+
* a social provider, use `signInUrl(provider)`.
|
|
35
39
|
*/
|
|
36
40
|
export function signUpUrl(opts) {
|
|
37
41
|
return authUrl("sign-up", undefined, opts);
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
40
|
-
*
|
|
44
|
+
* Sign-out.
|
|
41
45
|
*
|
|
42
|
-
*
|
|
43
|
-
* action={signOutUrl()}>`
|
|
44
|
-
* `<img>`
|
|
46
|
+
* **It is a POST target, not a link** (docs/auth.md §5). Use it as `<form
|
|
47
|
+
* method="post" action={signOutUrl()}>` — if a GET could sign somebody out, a
|
|
48
|
+
* single `<img>` embedded in somebody else's page could throw the user out.
|
|
45
49
|
*/
|
|
46
50
|
export function signOutUrl(opts) {
|
|
47
51
|
return authUrl("sign-out", undefined, opts);
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
|
-
*
|
|
54
|
+
* Who is signed in right now. This is what a client-rendered app calls while
|
|
55
|
+
* booting.
|
|
51
56
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
57
|
+
* Anything other than a 200 gives `{ user: null }` — being signed out is an
|
|
58
|
+
* answer, not an exception (a 401 is an answer too), and throwing would turn
|
|
59
|
+
* every page into a try/catch.
|
|
54
60
|
*
|
|
55
|
-
* `fetchImpl`
|
|
61
|
+
* `fetchImpl` is the hole through which the tests inject a fake.
|
|
56
62
|
*/
|
|
57
63
|
export async function session(fetchImpl) {
|
|
58
64
|
const f = fetchImpl ?? fetch;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AA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,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,IAAe;IACxC,OAAO,OAAO,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,SAAwB;IACpD,MAAM,CAAC,GAAG,SAAS,IAAI,KAAK,CAAC;IAC7B,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,GAAG,SAAS,UAAU,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC;IAC5E,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAA0B,CAAC;AACrD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** The path prefix the system worker terminates (docs/auth.md §5). */
|
|
2
2
|
export declare const AUTH_BASE = "/__runlot/auth";
|
|
3
3
|
export interface User {
|
|
4
|
-
/** uuid — `runlot_auth.users`
|
|
4
|
+
/** uuid — the PK of `runlot_auth.users` and the value RLS looks at. */
|
|
5
5
|
id: string;
|
|
6
6
|
email: string | null;
|
|
7
7
|
emailVerified: boolean;
|
|
8
8
|
name: string | null;
|
|
9
9
|
avatarUrl: string | null;
|
|
10
|
-
/**
|
|
10
|
+
/** The sign-in methods linked to this user. For example:
|
|
11
|
+
* `["password", "github"]`. */
|
|
11
12
|
providers: string[];
|
|
12
13
|
/** ISO 8601. */
|
|
13
14
|
createdAt: string;
|
|
14
|
-
/** ISO 8601.
|
|
15
|
+
/** ISO 8601. `null` if they have never signed in. */
|
|
15
16
|
lastSignInAt: string | null;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
|
-
* `signOut`
|
|
19
|
+
* The one deletion-cookie line `signOut` returns. Used as a `HeadersInit` as
|
|
20
|
+
* is.
|
|
19
21
|
*/
|
|
20
22
|
export interface SignOutHeaders {
|
|
21
23
|
"set-cookie": string;
|
|
22
24
|
}
|
|
23
|
-
/** `users.list
|
|
25
|
+
/** One page of `users.list`. A `null` `cursor` means it is the last page. */
|
|
24
26
|
export interface UserPage {
|
|
25
27
|
users: User[];
|
|
26
28
|
cursor: string | null;
|
|
@@ -28,10 +30,11 @@ export interface UserPage {
|
|
|
28
30
|
export interface UserUpdate {
|
|
29
31
|
name?: string | null;
|
|
30
32
|
avatarUrl?: string | null;
|
|
31
|
-
/** `true`
|
|
33
|
+
/** `true` also revokes every session of that user (docs/auth.md §4). */
|
|
32
34
|
banned?: boolean;
|
|
33
35
|
}
|
|
34
|
-
/**
|
|
36
|
+
/** Administrative reads and writes. They do not go through the gateway; they
|
|
37
|
+
* read directly through the `DB` binding. */
|
|
35
38
|
export interface AuthUsers {
|
|
36
39
|
get(id: string): Promise<User | null>;
|
|
37
40
|
getByEmail(email: string): Promise<User | null>;
|
|
@@ -40,29 +43,31 @@ export interface AuthUsers {
|
|
|
40
43
|
limit?: number;
|
|
41
44
|
}): Promise<UserPage>;
|
|
42
45
|
update(id: string, patch: UserUpdate): Promise<User>;
|
|
43
|
-
/**
|
|
46
|
+
/** The user, the identities, the sessions and the tokens. The app's own
|
|
47
|
+
* tables are joined up by the app with `ON DELETE`. */
|
|
44
48
|
delete(id: string): Promise<void>;
|
|
45
49
|
}
|
|
46
50
|
export interface AuthSessions {
|
|
47
|
-
/**
|
|
51
|
+
/** The idiom after a password change. */
|
|
48
52
|
revokeAll(userId: string): Promise<void>;
|
|
49
53
|
}
|
|
50
54
|
export interface AuthBinding {
|
|
51
55
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
56
|
+
* Cookie → session → user. `null` when there is none.
|
|
57
|
+
* **It does not throw** — not being signed in is not an error.
|
|
54
58
|
*/
|
|
55
59
|
user(request: Request): Promise<User | null>;
|
|
56
60
|
/**
|
|
57
|
-
*
|
|
61
|
+
* Erases that session and returns the deletion cookie. Putting it on the
|
|
62
|
+
* response is the caller's job.
|
|
58
63
|
*
|
|
59
64
|
* ```ts
|
|
60
65
|
* return new Response(null, { headers: await env.auth.signOut(request) });
|
|
61
66
|
* ```
|
|
62
67
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
68
|
+
* It is a plain object rather than a `Headers` because of a measurement —
|
|
69
|
+
* `Headers` cannot cross the RPC boundary (docs/auth.md §4). It is still a
|
|
70
|
+
* `HeadersInit`, so it goes on exactly as above.
|
|
66
71
|
*/
|
|
67
72
|
signOut(request: Request): Promise<SignOutHeaders>;
|
|
68
73
|
users: AuthUsers;
|
|
@@ -78,7 +83,7 @@ export interface AuthBinding {
|
|
|
78
83
|
revokeSessions?(userId: string): Promise<void>;
|
|
79
84
|
}
|
|
80
85
|
/**
|
|
81
|
-
*
|
|
86
|
+
* The fragment to attach to your own `Env`.
|
|
82
87
|
*
|
|
83
88
|
* ```ts
|
|
84
89
|
* interface Env extends AuthEnv {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,sEAAsE;AACtE,eAAO,MAAM,SAAS,mBAAmB,CAAC;AAE1C,MAAM,WAAW,IAAI;IACnB,uEAAuE;IACvE,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;oCACgC;IAChC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,YAAY,EAAE,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OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACnD,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IAOvB,OAAO,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IAC3C,cAAc,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACrD,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1E,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,WAAW,CAAC;CACnB"}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
// `env.auth`
|
|
1
|
+
// The types for `env.auth` (docs/auth.md §4, §10).
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
3
|
+
// This package ships no runtime. The binding is injected by the auth system
|
|
4
|
+
// worker inside workerd, so all a user gets from npm is the type to attach to
|
|
5
|
+
// their own `Env` and the helpers called from the browser
|
|
6
|
+
// (`@runlot/auth/client`). That is also why it has zero dependencies — it must
|
|
7
|
+
// not add a single byte to the worker bundle.
|
|
7
8
|
//
|
|
8
|
-
// `user(request)`
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
|
|
9
|
+
// `user(request)` taking a request is a constraint, not a taste (the same
|
|
10
|
+
// argument as docs/access.md §4.2): `env` is a bundle fixed for the lifetime of
|
|
11
|
+
// the worker, and the identity is a different value on every request. The
|
|
12
|
+
// argument-free shape only holds inside round 6's Next.js adapter, which hides
|
|
13
|
+
// the request in `AsyncLocalStorage`; anywhere else it is a `TypeError` — if
|
|
14
|
+
// "cannot be done" quietly became `null`, every page would look logged out.
|
|
15
|
+
/** The path prefix the system worker terminates (docs/auth.md §5). */
|
|
14
16
|
export const AUTH_BASE = "/__runlot/auth";
|
|
15
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,0DAA0D;AAC1D,+EAA+E;AAC/E,8CAA8C;AAC9C,EAAE;AACF,0EAA0E;AAC1E,gFAAgF;AAChF,0EAA0E;AAC1E,+EAA+E;AAC/E,6EAA6E;AAC7E,4EAA4E;AAE5E,sEAAsE;AACtE,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runlot/auth",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.74",
|
|
4
4
|
"description": "Types and browser helpers for env.auth — Runlot provides the runtime",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@types/node": "^22.10.2",
|
|
31
31
|
"esbuild": "^0.24.2",
|
|
32
32
|
"typescript": "^5.7.2",
|
|
33
|
-
"@runlot/config": "0.1.0-rc.
|
|
33
|
+
"@runlot/config": "0.1.0-rc.74"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"test": "node build.mjs",
|