Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(desktop): the renderer's bootstrap token rotates every 12 hours #16275

Mergedjuliusmarmingemerged 3 commits intot3/desktop-bootstrap-1-stop-retrying fromrefs/pull/16275/headmerged by juliusmarminge View on GitHub

Showing 16 changed files with 55 additions and 13 deletions (loading 13).

x
0 of 16 viewed, 16 left
20 additions and 2 deletionsapps/desktop/src/backend/DesktopBackendConfiguration.test.tsModified
View file
@@ -1,5 +1,7 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, describe, it } from "@effect/vitest";
+import { currentDesktopBootstrapToken } from "@t3tools/shared/desktopBootstrapToken";
+import * as Clock from "effect/Clock";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
@@ -255,8 +257,24 @@
assert.equal(first.bootstrap.t3Home, environment.baseDir);
assert.equal(first.bootstrap.tailscaleServeEnabled, true);
assert.equal(first.bootstrap.tailscaleServePort, 8443);
- assert.match(first.bootstrap.desktopBootstrapToken, /^[0-9a-f]{48}$/i);
- assert.equal(second.bootstrap.desktopBootstrapToken, first.bootstrap.desktopBootstrapToken);
+ assert.match(first.bootstrap.desktopBootstrapSecret ?? "", /^[0-9a-f]{64}$/i);
+ assert.equal(
+ second.bootstrap.desktopBootstrapSecret,
+ first.bootstrap.desktopBootstrapSecret,
+ );
+ // The launch token is the secret's token for the current window, and
+ // the renderer is handed the same one.
+ assert.equal(
+ first.bootstrap.desktopBootstrapToken,
+ currentDesktopBootstrapToken(
+ first.bootstrap.desktopBootstrapSecret ?? "",
+ yield* Clock.currentTimeMillis,
+ ),
+ );
+ assert.equal(
+ yield* configuration.currentBootstrapToken,