From 32a704f630e0ca8a79c7d1f662e5249179964358 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 18 Feb 2026 19:02:19 +0000 Subject: [PATCH] refactor(auth): share resolve profile params type --- src/agents/auth-profiles/oauth.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/agents/auth-profiles/oauth.ts b/src/agents/auth-profiles/oauth.ts index 2e044f27b5c..d36f9a2a4b8 100644 --- a/src/agents/auth-profiles/oauth.ts +++ b/src/agents/auth-profiles/oauth.ts @@ -84,6 +84,13 @@ function isExpiredCredential(expires: number | undefined): boolean { ); } +type ResolveApiKeyForProfileParams = { + cfg?: OpenClawConfig; + store: AuthProfileStore; + profileId: string; + agentDir?: string; +}; + async function refreshOAuthTokenWithLock(params: { profileId: string; agentDir?: string; @@ -143,12 +150,9 @@ async function refreshOAuthTokenWithLock(params: { }); } -async function tryResolveOAuthProfile(params: { - cfg?: OpenClawConfig; - store: AuthProfileStore; - profileId: string; - agentDir?: string; -}): Promise<{ apiKey: string; provider: string; email?: string } | null> { +async function tryResolveOAuthProfile( + params: ResolveApiKeyForProfileParams, +): Promise<{ apiKey: string; provider: string; email?: string } | null> { const { cfg, store, profileId } = params; const cred = store.profiles[profileId]; if (!cred || cred.type !== "oauth") { @@ -187,12 +191,9 @@ async function tryResolveOAuthProfile(params: { }); } -export async function resolveApiKeyForProfile(params: { - cfg?: OpenClawConfig; - store: AuthProfileStore; - profileId: string; - agentDir?: string; -}): Promise<{ apiKey: string; provider: string; email?: string } | null> { +export async function resolveApiKeyForProfile( + params: ResolveApiKeyForProfileParams, +): Promise<{ apiKey: string; provider: string; email?: string } | null> { const { cfg, store, profileId } = params; const cred = store.profiles[profileId]; if (!cred) {