INNER CODE UNIT · TypeScript

providers

synthetic-sciences/openscience · backend/cli/src/auth/index.ts:108

    const providers = new Set(Object.keys(synced).filter((id) => !Object.hasOwn(local, id)))
    if (!workspace || !providers.size) return { auth }
    return { auth, overlay: { organization: workspace.organization_id, providers } }
  }

  export async function set(key: string, info: Info) {
    if (info.type === "api" && isAtlasApiKey(info.key)) {
      throw new Error(
        "Ace workspace credentials belong to OpenScience sign-in, not provider keys. Sign in to Ace or add a provider key you control.",
      )
    }
    const selectsByok = key === "openrouter" && info.type === "api" && !isAtlasApiKey(info.key)
    await CredentialLifecycle.mutate(`provider-auth.set:${key}`, async () => {
      if (!selectsByok) {
        await JsonStore.update(filepath, (data) => ({ ...data, [key]: info }))
        return
      }
      const previous = await JsonStore.read(filepath)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…