@deslop/auth 0.1.1348 → 0.1.1354

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 CHANGED
@@ -1,16 +1,7 @@
1
1
  # Auth
2
2
 
3
- Deslop's identity authority. Apps POST an IdentifyRequest to /api/identify from Auth's machine and receive Account JSON, 401 sign-in text or 403 access-denied text.
4
-
5
3
  ```bash
6
- npm install --global @deslop/auth
7
- auth service install --domain mp281x.xyz --admins <github-id> --github-client-id <client-id>
4
+ auth service install --admins <github-id> --github-client-id <client-id>
8
5
  ```
9
6
 
10
- Callers resolve through a shared browser cookie, this machine's tailnet owner (or an allowed on-behalf claim), then Tailscale whois. Tagged nodes do not identify people. GitHub tailnet logins use GitHub ids; other providers use tailnet logins. Tailnet invitations approve access.
11
-
12
- Browser sign-in uses GitHub OAuth with PKCE. Return URLs must use HTTPS on the configured domain or its subdomains (same-origin in local mode). The shared Secure, HttpOnly, SameSite=Lax cookie lasts 365 days; sessions expire after 30 days unused. Sign-out revokes the session across apps. An iOS app opens `/sign-in?app=<scheme>` in iOS's authentication sheet (scheme `^[a-z]+(-dev)?$`); the GitHub callback creates the session and redirects to `<scheme>://signed-in?session=<secret>`, the shared cookie's value, which the sheet hands only to the app that opened it.
13
-
14
- The home page shows the account and browser sessions; admins also manage people and access requests. MCP offers only list_people, remove_person, list_sessions and sign_out_session. Removing a person deletes sessions; a tailnet person returns on their next request.
15
-
16
- Without `DESLOP_DOMAIN` (`--domain`) the account is the local developer, an admin. For hosted sign-in configure the domain, `GITHUB_ADMINS`, `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET`. Auth alone owns the admin list and includes `admin` in each identity answer based on its people roles.
7
+ Hosted GitHub sign-in also needs `GITHUB_CLIENT_SECRET` in `~/.deslop/auth.env`.
package/dist/server.js CHANGED
@@ -109302,6 +109302,23 @@ var GitHub = class GitHub extends Service$1()("@deslop/auth/services/github/serv
109302
109302
  const user = fnUntraced(function* (request) {
109303
109303
  return yield* pipe(client.execute(setHeaders$1(request, HEADERS)), flatMap$3(schemaBodyJson$1(GitHubUser)), timeout("10 seconds"));
109304
109304
  });
109305
+ const logins = yield* makeWith((login) => mapError$2(user(get$1(`https://api.github.com/users/${encodeURIComponent(login)}`)), (cause) => match(isHttpClientError(cause) && cause.response?.status === 404, {
109306
+ onFalse: () => AuthError.make({
109307
+ cause,
109308
+ error: "temporarily_unavailable",
109309
+ message: "GitHub could not be reached"
109310
+ }),
109311
+ onTrue: () => AuthError.make({
109312
+ cause,
109313
+ message: "GitHub no longer knows this login"
109314
+ })
109315
+ })), {
109316
+ capacity: 64,
109317
+ timeToLive: (exit) => match$3(exit, {
109318
+ onFailure: constant(0),
109319
+ onSuccess: constant("1 day")
109320
+ })
109321
+ });
109305
109322
  return GitHub.of({
109306
109323
  finish: fn("GitHub.finish")(function* (code, state) {
109307
109324
  const flow = yield* take(state);
@@ -109317,7 +109334,7 @@ var GitHub = class GitHub extends Service$1()("@deslop/auth/services/github/serv
109317
109334
  profile: yield* user(bearerToken(get$1("https://api.github.com/user"), token.access_token))
109318
109335
  };
109319
109336
  }, asAuthError("GitHub sign-in failed")),
109320
- login: (login) => pipe(user(get$1(`https://api.github.com/users/${encodeURIComponent(login)}`)), asAuthError("Cannot read the GitHub profile")),
109337
+ login: (login) => get(logins, login),
109321
109338
  start: fn("GitHub.start")(function* (flow) {
109322
109339
  const state = OAuthState.make(yield* nonce);
109323
109340
  const verifier = yield* nonce;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deslop/auth",
3
- "version": "0.1.1348",
3
+ "version": "0.1.1354",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/MP281X/deslop.git",
@@ -33,5 +33,5 @@
33
33
  "engines": {
34
34
  "node": ">=26"
35
35
  },
36
- "fingerprint": "22414983374be75a7320659dee4a22be7425b906f9587ef444dcb8a5a791e9bd"
36
+ "fingerprint": "bd0f89a889c51c52fa76e0ac08cbbd4e127a6606f91a8d665f982675fe38d1f2"
37
37
  }