@deslop/auth 0.1.1802 → 0.1.1872

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.
@@ -14,8 +14,8 @@
14
14
  <link rel="manifest" href="/manifest.webmanifest" />
15
15
 
16
16
  <title>Auth</title>
17
- <script type="module" crossorigin src="/assets/index-DP4z9NUx.js"></script>
18
- <link rel="modulepreload" crossorigin href="/assets/effect-BAaJ_i7Z.js">
17
+ <script type="module" crossorigin src="/assets/index-ek8rcXTf.js"></script>
18
+ <link rel="modulepreload" crossorigin href="/assets/effect-DcMYZgya.js">
19
19
  <link rel="stylesheet" crossorigin href="/assets/index-BwbN28bp.css">
20
20
  </head>
21
21
  <body style="margin: 0; background: #000; color: #f4f4f4">
@@ -1 +1 @@
1
- {"version":0,"bundler":"metro","fileMetadata":{"ios":{"bundle":"_expo/static/js/ios/main-862b302b7d403b8d775daf2068e03ebd.hbc","assets":[]}}}
1
+ {"version":0,"bundler":"metro","fileMetadata":{"ios":{"bundle":"_expo/static/js/ios/main-358a81a75d063bbd81e6063178e5f360.hbc","assets":[]}}}
@@ -1 +1 @@
1
- {"assets":[],"createdAt":"2026-11-30T16:41:37.213Z","extra":{"expoClient":{"ios":{"associatedDomains":["webcredentials:auth.mp281x.xyz"],"bundleIdentifier":"xyz.mp281x.auth","icon":"./src/iphone/app.icon","infoPlist":{"ITSAppUsesNonExemptEncryption":false},"supportsTablet":true},"name":"Auth","orientation":"default","platforms":["ios"],"scheme":"auth","slug":"auth","userInterfaceStyle":"dark","runtimeVersion":{"policy":"fingerprint"},"updates":{"checkAutomatically":"ON_LOAD","fallbackToCacheTimeout":0,"url":"https://auth.mp281x.xyz/api/iphone-update"},"version":"0.1.0","sdkVersion":"58.0.0"}},"id":"9567afd4-8a44-46cc-97f3-8dae21740b8b","launchAsset":{"contentType":"application/javascript","fileExtension":".bundle","hash":"UapKbfZEutpQl_gmg_ehdM2_vk7N8CeyCpzdUwRGe6M","key":"b7abfe81044bbc0eaea9b114902e78c2","path":"_expo/static/js/ios/main-862b302b7d403b8d775daf2068e03ebd.hbc"},"runtimeVersion":"9f8b7b6ff32f67f8c1db16ea3cf1c259e533bf6b"}
1
+ {"assets":[],"createdAt":"2026-12-01T09:19:58.440Z","extra":{"expoClient":{"ios":{"associatedDomains":["webcredentials:auth.mp281x.xyz"],"bundleIdentifier":"xyz.mp281x.auth","icon":"./src/iphone/app.icon","infoPlist":{"ITSAppUsesNonExemptEncryption":false},"supportsTablet":true},"name":"Auth","orientation":"default","platforms":["ios"],"scheme":"auth","slug":"auth","userInterfaceStyle":"dark","runtimeVersion":{"policy":"fingerprint"},"updates":{"checkAutomatically":"ON_LOAD","fallbackToCacheTimeout":0,"url":"https://auth.mp281x.xyz/api/iphone-update"},"version":"0.1.0","sdkVersion":"58.0.0"}},"id":"cb42cdd9-4fa0-414b-9c5b-93ef28f6a433","launchAsset":{"contentType":"application/javascript","fileExtension":".bundle","hash":"qESIf_tjxQmAmzCRiNuYFXk-yeRDSy3M5iHOOSg5iCA","key":"20c758ea86628cd48e583515a3ea2aa2","path":"_expo/static/js/ios/main-358a81a75d063bbd81e6063178e5f360.hbc"},"runtimeVersion":"9f8b7b6ff32f67f8c1db16ea3cf1c259e533bf6b"}
package/dist/server.js CHANGED
@@ -98267,7 +98267,12 @@ function layerDataStore(directory) {
98267
98267
  });
98268
98268
  yield* sql`PRAGMA auto_vacuum = INCREMENTAL`;
98269
98269
  yield* sql`PRAGMA journal_mode = WAL`;
98270
- if (!some(yield* sql`PRAGMA auto_vacuum`, (row) => row.auto_vacuum === 2)) return yield* die$2(`${filename} was created without incremental vacuum`);
98270
+ const vacuumMode = findAll({
98271
+ Request: Void,
98272
+ Result: Struct$2({ auto_vacuum: Int$1 }),
98273
+ execute: () => sql`PRAGMA auto_vacuum`
98274
+ });
98275
+ if (!some(yield* vacuumMode(), (row) => row.auto_vacuum === 2)) return yield* die$2(`${filename} was created without incremental vacuum`);
98271
98276
  }), scoped, provideServiceEffect(Reactivity, make$29));
98272
98277
  return provideMerge(retiredSessions, provideMerge(tuned, merge$4(layer({ filename }), layer$19)));
98273
98278
  }));
@@ -99338,47 +99343,66 @@ var Sessions = class Sessions extends Service$1()("@deslop/auth/sessions/server/
99338
99343
  log: "Warn",
99339
99344
  message: "Expired sessions could not be deleted"
99340
99345
  }), repeat(spaced(hours(1))), forkScoped);
99346
+ const current = fn("Sessions.current")(function* (secret) {
99347
+ const id = yield* hash(secret);
99348
+ const now$3 = toEpochMillis(yield* now);
99349
+ const since = toEpochMillis(yield* cutoff);
99350
+ return yield* findOneOption({
99351
+ Request: Void,
99352
+ Result: CookieSession,
99353
+ execute: () => sql`UPDATE ${table} SET lastSeenAt = ${now$3} WHERE id = ${id} AND lastSeenAt > ${since} RETURNING *`
99354
+ })();
99355
+ }, asAuthError("Cannot read the session"));
99356
+ const list = fn("Sessions.list")(function* (user) {
99357
+ const since = toEpochMillis(yield* cutoff);
99358
+ return yield* findAll({
99359
+ Request: Void,
99360
+ Result: CookieSession,
99361
+ execute: () => sql`SELECT * FROM ${table} WHERE userId = ${user} AND lastSeenAt > ${since} ORDER BY lastSeenAt DESC`
99362
+ })();
99363
+ }, asAuthError("Cannot list sessions"));
99341
99364
  return Sessions.of({
99342
99365
  create: fn("Sessions.create")(function* (user, address, browser) {
99343
99366
  const secret = encode$1(yield* random.randomBytes(32));
99344
- const now$3 = yield* now;
99367
+ const now$4 = yield* now;
99345
99368
  yield* insert({
99346
99369
  address,
99347
99370
  browser,
99348
- createdAt: now$3,
99371
+ createdAt: now$4,
99349
99372
  id: yield* hash(secret),
99350
- lastSeenAt: now$3,
99373
+ lastSeenAt: now$4,
99351
99374
  userId: user
99352
99375
  });
99353
99376
  return secret;
99354
99377
  }, mutate, asAuthError("Cannot create the session")),
99355
- current: fn("Sessions.current")(function* (secret) {
99356
- const id = yield* hash(secret);
99357
- const now$4 = toEpochMillis(yield* now);
99358
- const since = toEpochMillis(yield* cutoff);
99359
- return yield* findOneOption({
99360
- Request: Void,
99361
- Result: CookieSession,
99362
- execute: () => sql`UPDATE ${table} SET lastSeenAt = ${now$4} WHERE id = ${id} AND lastSeenAt > ${since} RETURNING *`
99363
- })();
99364
- }, asAuthError("Cannot read the session")),
99378
+ current,
99365
99379
  forget: fn("Sessions.forget")(function* (secret) {
99366
99380
  yield* sql`DELETE FROM ${table} WHERE id = ${yield* hash(secret)}`;
99367
99381
  }, mutate, asAuthError("Cannot sign out; no changes committed")),
99368
99382
  forgetPerson: fn("Sessions.forgetPerson")(function* (user) {
99369
99383
  yield* sql`DELETE FROM ${table} WHERE userId = ${user}`;
99370
99384
  }, mutate, asAuthError("Cannot sign out the person; no changes committed")),
99371
- list: fn("Sessions.list")(function* (user) {
99372
- const since = toEpochMillis(yield* cutoff);
99373
- return yield* findAll({
99374
- Request: Void,
99375
- Result: CookieSession,
99376
- execute: () => sql`SELECT * FROM ${table} WHERE userId = ${user} AND lastSeenAt > ${since} ORDER BY lastSeenAt DESC`
99377
- })();
99378
- }, asAuthError("Cannot list sessions")),
99385
+ list,
99379
99386
  remove: fn("Sessions.remove")(function* (id, user) {
99380
99387
  yield* sql`DELETE FROM ${table} WHERE id = ${id} AND userId = ${user}`;
99381
- }, mutate, asAuthError("Cannot sign out the session; no changes committed"))
99388
+ }, mutate, asAuthError("Cannot sign out the session; no changes committed")),
99389
+ watch: (user, secret) => unwrap$4(gen(function* () {
99390
+ const own = yield* match$8(secret, {
99391
+ onNone: () => succeedNone,
99392
+ onSome: current
99393
+ });
99394
+ const listed = map$7(list(user), map$10((row) => ListedSession.make({
99395
+ address: row.address,
99396
+ browser: row.browser,
99397
+ current: exists(own, (found) => found.id === row.id),
99398
+ id: row.id,
99399
+ lastSeenAt: row.lastSeenAt
99400
+ })));
99401
+ return pipe(tick("1 minute"), switchMap(() => sql.reactive(["sessions"], listed)), changesWith(toEquivalence(ArraySchema(ListedSession))), buffer$1({
99402
+ capacity: 1,
99403
+ strategy: "sliding"
99404
+ }));
99405
+ }))
99382
99406
  });
99383
99407
  })), Sessions.migrations);
99384
99408
  };
@@ -99493,6 +99517,9 @@ var People = class People extends Service$1()("@deslop/auth/people/server/People
99493
99517
  yield* sql`DELETE FROM ${bindings} WHERE userId = ${id}`;
99494
99518
  yield* sql`DELETE FROM ${table} WHERE id = ${id}`;
99495
99519
  });
99520
+ const list = fn("People.list")(function* (_admin) {
99521
+ return listPeople(yield* all(), admins);
99522
+ }, asAuthError("Cannot read people"));
99496
99523
  return People.of({
99497
99524
  admit: fn("People.admit")(function* (params) {
99498
99525
  const row = yield* existing(params.id);
@@ -99512,9 +99539,7 @@ var People = class People extends Service$1()("@deslop/auth/people/server/People
99512
99539
  }, asAuthError("Cannot bind the tailnet user")),
99513
99540
  bound: fn("People.bound")(boundRow, asAuthError("Cannot read the tailnet user")),
99514
99541
  find,
99515
- list: fn("People.list")(function* () {
99516
- return listPeople(yield* all(), admins);
99517
- }, asAuthError("Cannot read people")),
99542
+ list,
99518
99543
  register: fn("People.register")(function* (user, profileName, tailnet) {
99519
99544
  const fullName = filter$5(profileName, isNonEmpty$1);
99520
99545
  const row = yield* find(user.id);
@@ -99557,7 +99582,11 @@ var People = class People extends Service$1()("@deslop/auth/people/server/People
99557
99582
  const row = yield* existing(id);
99558
99583
  yield* removeRow(id);
99559
99584
  return personOf(admins, row);
99560
- }, mutate, sql.withTransaction, asAuthError("Cannot remove the person; no changes committed"))
99585
+ }, mutate, sql.withTransaction, asAuthError("Cannot remove the person; no changes committed")),
99586
+ watch: (admin) => buffer$1(sql.reactive(["people"], list(admin)), {
99587
+ capacity: 1,
99588
+ strategy: "sliding"
99589
+ })
99561
99590
  });
99562
99591
  })), People.migrations);
99563
99592
  };
@@ -99702,18 +99731,19 @@ var Identity = class Identity extends Service$1()("@deslop/auth/identity/server/
99702
99731
  return Identity.of({ resolve });
99703
99732
  }));
99704
99733
  };
99705
- // src/identity/handlers.ts
99706
- function authResponse(effect) {
99707
- return pipe(effect, catchIf$2(is$2(AuthError), (error) => succeed$5(text(error.message, failureOptions(error, 401)))), map$7(setHeader("cache-control", "no-store")));
99708
- }
99709
- const identityHandlers = IdentityRpcs.toLayer(gen(function* () {
99734
+ const watchIdentity = gen(function* () {
99710
99735
  const identity = yield* Identity;
99711
99736
  const sql = yield* SqlClient;
99712
- return { "people.account": (_, options) => buffer$1(sql.reactive(["people", "sessions"], identity.resolve(identifyRequestOf(options.headers), true)), {
99737
+ return (request) => buffer$1(sql.reactive(["people", "sessions"], identity.resolve(request, true)), {
99713
99738
  capacity: 1,
99714
99739
  strategy: "sliding"
99715
- }) };
99716
- }));
99740
+ });
99741
+ });
99742
+ // src/identity/handlers.ts
99743
+ function authResponse(effect) {
99744
+ return pipe(effect, catchIf$2(is$2(AuthError), (error) => succeed$5(text(error.message, failureOptions(error, 401)))), map$7(setHeader("cache-control", "no-store")));
99745
+ }
99746
+ const identityHandlers = IdentityRpcs.toLayer(map$7(watchIdentity, (watch) => ({ "people.account": (_, options) => watch(identifyRequestOf(options.headers)) })));
99717
99747
  const identityHttp = use((router) => gen(function* () {
99718
99748
  const identity = yield* Identity;
99719
99749
  yield* router.add("POST", IDENTIFY_PATH, authResponse(gen(function* () {
@@ -99749,15 +99779,11 @@ const peopleToolHandlers = peopleTools.toLayer(map$7(People, (people) => ({
99749
99779
  })));
99750
99780
  const peopleHandlers = PeopleRpcs.toLayer(gen(function* () {
99751
99781
  const people = yield* People;
99752
- const sql = yield* SqlClient;
99753
99782
  return {
99754
99783
  "people.admit": fnUntraced(function* (input) {
99755
99784
  return yield* people.admit(input, yield* CurrentAdmin);
99756
99785
  }),
99757
- "people.watch": () => unwrap$4(map$7(CurrentAdmin, (admin) => buffer$1(sql.reactive(["people"], people.list(admin)), {
99758
- capacity: 1,
99759
- strategy: "sliding"
99760
- })))
99786
+ "people.watch": () => unwrap$4(map$7(CurrentAdmin, people.watch))
99761
99787
  };
99762
99788
  }));
99763
99789
  // src/sessions/handlers.ts
@@ -99783,28 +99809,7 @@ const sessionsToolHandlers = sessionsTools.toLayer(map$7(Sessions, (sessions) =>
99783
99809
  return { id: input.id };
99784
99810
  })
99785
99811
  })));
99786
- const sessionsHandlers = SessionsRpcs.toLayer(gen(function* () {
99787
- const sessions = yield* Sessions;
99788
- const sql = yield* SqlClient;
99789
- return { "sessions.watch": (_, options) => unwrap$4(gen(function* () {
99790
- const user = yield* CurrentUser;
99791
- const own = yield* match$8(identifyRequestOf(options.headers).session, {
99792
- onNone: () => succeedNone,
99793
- onSome: sessions.current
99794
- });
99795
- const listed = map$7(sessions.list(user.id), map$10((row) => ListedSession.make({
99796
- address: row.address,
99797
- browser: row.browser,
99798
- current: exists(own, (found) => found.id === row.id),
99799
- id: row.id,
99800
- lastSeenAt: row.lastSeenAt
99801
- })));
99802
- return pipe(tick("1 minute"), switchMap(() => sql.reactive(["sessions"], listed)), changesWith(toEquivalence(ArraySchema(ListedSession))), buffer$1({
99803
- capacity: 1,
99804
- strategy: "sliding"
99805
- }));
99806
- })) };
99807
- }));
99812
+ const sessionsHandlers = SessionsRpcs.toLayer(map$7(Sessions, (sessions) => ({ "sessions.watch": (_, options) => unwrap$4(map$7(CurrentUser, (user) => sessions.watch(user.id, identifyRequestOf(options.headers).session))) })));
99808
99813
  // src/sign-ins/shared.ts
99809
99814
  function parentDomain(canonical) {
99810
99815
  return pipe(new URL(canonical).hostname, split$1("."), drop$1(1), join$3("."));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deslop/auth",
3
- "version": "0.1.1802",
3
+ "version": "0.1.1872",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/MP281X/deslop.git",
@@ -36,5 +36,5 @@
36
36
  "engines": {
37
37
  "node": ">=26"
38
38
  },
39
- "fingerprint": "f0db3ef4c31ac42d485736001a39e08f45d698c71833f1a231ca54cc5e098508"
39
+ "fingerprint": "9374467f07d5086df4f015548e6947ae17c5ef185cf4f1bbff21e3acadda363a"
40
40
  }