Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | /** |
| 2 | * Fallback store used on unsupported platforms (BSDs, Windows outside Bun, …). |
| 3 | * |
| 4 | * Every operation throws `KeyringError({ kind: 'NoStorageAccess' })` |
| 5 | * so the CLI can fall back to the legacy on-disk config without the |
| 6 | * platform check leaking into caller code. |
| 7 | */ |
| 8 | |
| 9 | import type { CredentialStore } from '../core/store'; |
| 10 | import { CredentialPersistence } from '../core/persistence'; |
| 11 | import { KeyringError } from '../core/errors'; |
| 12 | |
| 13 | export class UnsupportedPlatformStore implements CredentialStore { |
| 14 | readonly id = 'unsupported'; |
| 15 | readonly vendor: string; |
| 16 | |
| 17 | constructor(platform: string) { |
| 18 | this.vendor = `unsupported platform (${platform})`; |
| 19 | } |
| 20 | |
| 21 | persistence(): CredentialPersistence { |
| 22 | return CredentialPersistence.Unspecified; |
| 23 | } |
| 24 | |
| 25 | async setSecret(): Promise<void> { |
| 26 | throw this.unavailable(); |
| 27 | } |
| 28 | async getSecret(): Promise<never> { |
| 29 | throw this.unavailable(); |
| 30 | } |
| 31 | async deleteCredential(): Promise<void> { |
| 32 | throw this.unavailable(); |
| 33 | } |
| 34 | |
| 35 | private unavailable(): KeyringError { |
| 36 | return new KeyringError({ |
| 37 | kind: 'NoStorageAccess', |
| 38 | cause: new Error( |
| 39 | `@composio/cli-keyring does not yet support ${this.vendor}. ` + |
| 40 | 'Only macOS (Keychain), Linux (Secret Service via secret-tool), and Windows under Bun (Credential Manager) are implemented.' |
| 41 | ), |
| 42 | }); |
| 43 | } |
| 44 | } |