MCPcopy Create free account
hub / github.com/diillson/chatcli / isProviderMatch

Function isProviderMatch

auth/resolver.go:16–24  ·  view source on GitHub ↗

isProviderMatch returns true if the credential's provider is a valid match for the requested provider. This handles the case where OpenAI OAuth tokens are stored under ProviderOpenAICodex but should be found when resolving ProviderOpenAI.

(credProvider, requestedProvider ProviderID)

Source from the content-addressed store, hash-verified

14// for the requested provider. This handles the case where OpenAI OAuth tokens
15// are stored under ProviderOpenAICodex but should be found when resolving ProviderOpenAI.
16func isProviderMatch(credProvider, requestedProvider ProviderID) bool {
17 if credProvider == requestedProvider {
18 return true
19 }
20 if requestedProvider == ProviderOpenAI && credProvider == ProviderOpenAICodex {
21 return true
22 }
23 return false
24}
25
26// ResolveAuthProvider resolves credentials for the given provider and returns a
27// TokenProvider that refreshes OAuth tokens transparently. Lookup order:

Callers 2

TestIsProviderMatchFunction · 0.85
ResolveAuthProviderFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsProviderMatchFunction · 0.68