MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / saveToken

Function saveToken

apps/cli/src/lib/storage/credentials.ts:15–28  ·  view source on GitHub ↗
(token: string, options?: { userId?: string; orgId?: string })

Source from the content-addressed store, hash-verified

13}
14
15export async function saveToken(token: string, options?: { userId?: string; orgId?: string }): Promise<void> {
16 await fs.mkdir(getConfigDir(), { recursive: true })
17
18 const credentials: Credentials = {
19 token,
20 createdAt: new Date().toISOString(),
21 userId: options?.userId,
22 orgId: options?.orgId,
23 }
24
25 await fs.writeFile(CREDENTIALS_FILE, JSON.stringify(credentials, null, 2), {
26 mode: 0o600, // Read/write for owner only
27 })
28}
29
30export async function loadToken(): Promise<string | null> {
31 try {

Callers 1

Calls 2

getConfigDirFunction · 0.85
writeFileMethod · 0.80

Tested by

no test coverage detected