MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / saveUserInfo

Function saveUserInfo

packages/cli/src/auth/user.ts:73–82  ·  view source on GitHub ↗
(info: StoredUserInfo, path = credentialPath())

Source from the content-addressed store, hash-verified

71 * than fail the login.
72 */
73export async function saveUserInfo(info: StoredUserInfo, path = credentialPath()): Promise<void> {
74 if (isUserInfoEmpty(info)) return;
75 // readStore preserves co-located api_key / oauth blocks and any
76 // unknown/foreign keys (captured on a hidden slot), so writing back
77 // only attaches the user block. A legacy single-line plaintext file
78 // parses into { api_key }, so this upgrades it to JSON in passing.
79 const { credentials } = await readStore(path);
80 credentials.user = { ...info };
81 await writeStore(credentials, path);
82}
83
84/**
85 * Read the friendly-display block. Returns `null` when the file is absent

Callers 2

user.test.tsFile · 0.85
persistUserInfoFunction · 0.85

Calls 4

credentialPathFunction · 0.85
isUserInfoEmptyFunction · 0.85
readStoreFunction · 0.85
writeStoreFunction · 0.85

Tested by

no test coverage detected