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

Function writeToken

apps/local/src/auth.ts:49–58  ·  view source on GitHub ↗
(dataDir: string, token: string)

Source from the content-addressed store, hash-verified

47};
48
49const writeToken = (dataDir: string, token: string): string => {
50 const dir = serverControlDir(dataDir);
51 mkdirSync(dir, { recursive: true });
52 const path = join(dir, "auth.json");
53 // `mode` only applies when the file is created; chmod afterwards covers the
54 // case where an older world-readable file already exists.
55 writeFileSync(path, `${JSON.stringify({ token }, null, 2)}\n`, { mode: 0o600 });
56 chmodSync(path, 0o600);
57 return token;
58};
59
60/**
61 * Return the stable local bearer token, minting and persisting one on first

Callers 2

loadOrMintLocalAuthTokenFunction · 0.70
rotateLocalAuthTokenFunction · 0.70

Calls 1

serverControlDirFunction · 0.70

Tested by

no test coverage detected