INNER CODE UNIT · TypeScript
resolveApiKey
Core-Mate/OpenGUI · deepseek-harness-plugin/src/index.ts:430
const resolveApiKey = async (_provider: string, active: ResolvedPiAiProviderProfile): Promise<string> => {
const ref = credentialRef(active.apiKeyEnv ?? API_KEY_ENV)
const credentials = ctx.get('credentials')
const hit = credentials === undefined ? undefined : await credentials.resolve(ref)
if (hit !== undefined) return assertUsableApiKey(hit.value, name, ref)
throw new LlmError(`coremate-mobile: no credential stored for ${ref}`, 'MISSING_CREDENTIAL')
}
const adapter = new PhonePiAiAdapter({
profiles: () => {
const active = profile()
return active === undefined ? new Map() : new Map([[PROVIDER, active]])
},
resolveApiKey,
auth: {
credentials: new InMemoryCredentialStore(),
authContext: defaultProviderAuthContext(),
},
resolveAttachments: () => ctx.get('attachments'),