@runlot/auth 0.1.0-rc.145 → 0.1.0-rc.146
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 +45 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +18 -0
- package/dist/client.js.map +1 -1
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -2,8 +2,11 @@ import { type User } from "./index.js";
|
|
|
2
2
|
export interface NextOpts {
|
|
3
3
|
next?: string;
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A provider id: `"github"`, `"google"`, `"runlot"`, or the id of one of the
|
|
7
|
+
* project's OIDC providers (docs/auth-access-unify.md §5).
|
|
8
|
+
*/
|
|
9
|
+
export type AuthProvider = "github" | "google" | "runlot" | (string & {});
|
|
7
10
|
/** The sign-in page. Given a provider, it goes straight to that provider's
|
|
8
11
|
* authorize. */
|
|
9
12
|
export declare function signInUrl(provider?: AuthProvider, opts?: NextOpts): string;
|
|
@@ -25,6 +28,46 @@ export declare function signUpUrl(opts?: NextOpts): string;
|
|
|
25
28
|
* single `<img>` embedded in somebody else's page could throw the user out.
|
|
26
29
|
*/
|
|
27
30
|
export declare function signOutUrl(opts?: NextOpts): string;
|
|
31
|
+
/**
|
|
32
|
+
* One sign-in provider the project has turned on. `kind` is `builtin` for the
|
|
33
|
+
* project's own GitHub or Google app, `oidc` for a generic OpenID Connect
|
|
34
|
+
* provider, `runlot` for "Continue with Runlot". `name` is the button label and
|
|
35
|
+
* `icon` an icon URL (empty when there is none).
|
|
36
|
+
*/
|
|
37
|
+
export interface AuthProviderInfo {
|
|
38
|
+
id: string;
|
|
39
|
+
kind: "builtin" | "oidc" | "runlot";
|
|
40
|
+
name: string;
|
|
41
|
+
icon: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* What the sign-in page needs to know about the project, from
|
|
45
|
+
* `GET /__runlot/auth/config`. No secrets: what is here is what the hosted
|
|
46
|
+
* page already shows.
|
|
47
|
+
*/
|
|
48
|
+
export interface AuthConfig {
|
|
49
|
+
brand: {
|
|
50
|
+
name: string;
|
|
51
|
+
logo: string;
|
|
52
|
+
color: string;
|
|
53
|
+
};
|
|
54
|
+
/** Only the providers that are turned on — draw a button for each and no other. */
|
|
55
|
+
providers: AuthProviderInfo[];
|
|
56
|
+
password: boolean;
|
|
57
|
+
magicLink: boolean;
|
|
58
|
+
/** Off means only existing users can sign in, by any method including social. */
|
|
59
|
+
allowSignup: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The project's sign-in configuration, for a custom login page.
|
|
63
|
+
*
|
|
64
|
+
* **It throws on anything but a 200** — unlike `session()`, there is no answer
|
|
65
|
+
* that means "nothing": a 404 is a project whose login is off, and a page that
|
|
66
|
+
* drew zero buttons from it would hide that.
|
|
67
|
+
*/
|
|
68
|
+
export declare function config(fetchImpl?: typeof fetch): Promise<AuthConfig>;
|
|
69
|
+
/** The turned-on providers, so a custom page never draws a button that answers `provider_not_configured`. */
|
|
70
|
+
export declare function providers(fetchImpl?: typeof fetch): Promise<AuthProviderInfo[]>;
|
|
28
71
|
/**
|
|
29
72
|
* Who is signed in right now. This is what a client-rendered app calls while
|
|
30
73
|
* booting.
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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,MAA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AAK,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,CAAC,CAKtF"}
|
package/dist/client.js
CHANGED
|
@@ -50,6 +50,24 @@ export function signUpUrl(opts) {
|
|
|
50
50
|
export function signOutUrl(opts) {
|
|
51
51
|
return authUrl("sign-out", undefined, opts);
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* The project's sign-in configuration, for a custom login page.
|
|
55
|
+
*
|
|
56
|
+
* **It throws on anything but a 200** — unlike `session()`, there is no answer
|
|
57
|
+
* that means "nothing": a 404 is a project whose login is off, and a page that
|
|
58
|
+
* drew zero buttons from it would hide that.
|
|
59
|
+
*/
|
|
60
|
+
export async function config(fetchImpl) {
|
|
61
|
+
const f = fetchImpl ?? fetch;
|
|
62
|
+
const res = await f(`${AUTH_BASE}/config`, { credentials: "same-origin" });
|
|
63
|
+
if (!res.ok)
|
|
64
|
+
throw new Error(`GET ${AUTH_BASE}/config → ${res.status}`);
|
|
65
|
+
return (await res.json());
|
|
66
|
+
}
|
|
67
|
+
/** The turned-on providers, so a custom page never draws a button that answers `provider_not_configured`. */
|
|
68
|
+
export async function providers(fetchImpl) {
|
|
69
|
+
return (await config(fetchImpl)).providers;
|
|
70
|
+
}
|
|
53
71
|
/**
|
|
54
72
|
* Who is signed in right now. This is what a client-rendered app calls while
|
|
55
73
|
* booting.
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,2EAA2E;AAC3E,uCAAuC;AAEvC,OAAO,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,2EAA2E;AAC3E,uCAAuC;AAEvC,OAAO,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;AAY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AC,KAAK,UAAU,MAAM,CAAC,SAAwB;IACnD,MAAM,CAAC,GAAG,SAAS,IAAI,KAAK,CAAC;IAC7B,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,GAAG,SAAS,SAAS,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC;IAC3E,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,OAAO,SAAS,aAAa,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IACxE,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAe,CAAC;AAC1C,CAAC;AAED,6GAA6G;AAC7G,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,SAAwB;IACtD,OAAO,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7C,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/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.146",
|
|
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.146"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"test": "node build.mjs",
|