@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 20 lines 582 Bytes
Raw
1 import * as Cloudflare from "@alchemy.run/cloudflare";
2 import { Random } from "alchemy";
3 import * as Effect from "effect/Effect";
4 import { Store } from "./Store.ts";
5
6 /**
7 * An API key secret in the Secrets Store.
8 *
9 * Uses `Random` to generate a stable random value that persists
10 * across deploys (only regenerated if the resource is replaced).
11 */
12 export const ApiKey = Effect.gen(function* () {
13 const store = yield* Store;
14 const secret = yield* Random("ApiKeyValue");
15
16 return yield* Cloudflare.SecretsStore.Secret("ApiKey", {
17 store,
18 value: secret.text,
19 });
20 });