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

Function serializeCredentials

packages/cli/src/auth/store.ts:414–427  ·  view source on GitHub ↗
(c: Credentials)

Source from the content-addressed store, hash-verified

412}
413
414function serializeCredentials(c: Credentials): Record<string, unknown> {
415 // Re-emit unrecognized top-level keys first so the known fields below
416 // are authoritative (collectUnknown already excludes known keys, so
417 // there's no real collision — this is belt-and-suspenders).
418 const out: Record<string, unknown> = { ...(c[UNKNOWN] ?? {}) };
419 if (c.api_key) out["api_key"] = c.api_key;
420 if (c.oauth) out["oauth"] = serializeOAuth(c.oauth);
421 if (c.user) {
422 const user = serializeUser(c.user);
423 // Omit an all-empty user block entirely (no empty `"user": {}` litter).
424 if (Object.keys(user).length > 0) out["user"] = user;
425 }
426 return out;
427}
428
429function serializeOAuth(o: OAuthTokens): Record<string, unknown> {
430 const oauth: Record<string, unknown> = { ...(o[UNKNOWN] ?? {}) };

Callers 1

writeStoreFunction · 0.85

Calls 2

serializeOAuthFunction · 0.85
serializeUserFunction · 0.85

Tested by

no test coverage detected