MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / writeToken

Function writeToken

apps/desktop/src/main/local-auth.ts:35–42  ·  view source on GitHub ↗
(dataDir: string, token: string)

Source from the content-addressed store, hash-verified

33};
34
35const writeToken = (dataDir: string, token: string): string => {
36 const dir = serverControlDir(dataDir);
37 mkdirSync(dir, { recursive: true });
38 const path = join(dir, "auth.json");
39 writeFileSync(path, `${JSON.stringify({ token }, null, 2)}\n`, { mode: 0o600 });
40 chmodSync(path, 0o600);
41 return token;
42};
43
44export const loadOrMintLocalAuthToken = (dataDir: string = resolveExecutorDataDir()): string =>
45 readToken(localAuthTokenPath(dataDir)) ?? writeToken(dataDir, mintToken());

Callers 2

loadOrMintLocalAuthTokenFunction · 0.70
rotateLocalAuthTokenFunction · 0.70

Calls 1

serverControlDirFunction · 0.70

Tested by

no test coverage detected