@prestige-app-cloud/sdk
v0.3.0
Published
TypeScript SDK for Prestige Cloud BaaS — Auth, APIs, Billing, AI Proxy, Push, Files, Lookup Tables
Maintainers
Readme
@prestige-cloud/sdk
TypeScript SDK for Prestige Cloud OAuth 2.0 API.
Handles the full PKCE authorization flow, automatic token refresh, vault access, API connections, and proxy calls.
Installation
npm install @prestige-cloud/sdkQuick Start
import { PrestigeClient } from "@prestige-cloud/sdk";
const client = new PrestigeClient({
clientId: "your-client-id",
redirectUri: "http://localhost:3000/callback",
scopes: ["profile", "vault:standard_api", "connections:proxy"],
storage: "localStorage",
});
// Start OAuth login
const loginUrl = await client.getLoginUrl();
window.open(loginUrl);
// After callback
await client.handleCallback(code);
// Read vault entries
const entries = await client.getVaultEntries("standard_api");
// Proxy API call (key never leaves Prestige Cloud)
const response = await client.proxy("openai-chat", {
body: { model: "gpt-4", messages: [{ role: "user", content: "Hello" }] },
});API
OAuth Flow
getLoginUrl(state?)— Generate OAuth authorization URL with PKCEhandleCallback(code)— Exchange authorization code for tokensrefreshTokens()— Refresh the access token using the stored refresh tokensetTokens(tokens)— Set tokens directly (e.g. restoring from storage)getTokens()— Get the current token set, ornullif not authenticatedclearTokens()— Clear tokens from memory and persistent storage
Vault
getVaultEntries(category)— Read vault entries for a categorywriteVaultEntries(category, entries)— Write vault entries (write-if-empty semantics)
Connections
getConnections()— List API connections with per-placeholder fill statuscreateConnection(templateId, placeholderValues)— Create a connection for an API template
User
getUserProfile()— Fetch the authenticated user's profile (requiresprofilescope)
Proxy
proxy(templateSlug, options?)— Forward a request through Prestige Cloud to a connected API
App Config
getAppConfig()— Get app integration config (requires authentication)getPublicAppConfig()— Get app config without authentication (identified by client ID)
Manual Storage (Local)
saveManualValues(templateId, values)— Save API key values to local storagegetManualValues(templateId)— Load saved values for a specific templategetAllManualValues()— Load all manually saved values across every template
Configuration
interface PrestigeClientConfig {
/** OAuth client ID issued by Prestige Cloud. */
clientId: string;
/** URI that Prestige Cloud redirects to after authorization. */
redirectUri: string;
/** OAuth scopes to request. */
scopes: string[];
/** Base URL of the Prestige Cloud instance. Defaults to "https://prestige.cloud". */
baseUrl?: string;
/** Token storage strategy. Defaults to "none". */
storage?: "localStorage" | "sessionStorage" | "none";
/** Key used for web storage. Defaults to "prestige_tokens". */
storageKey?: string;
}Exported Types
PrestigeClientConfigTokenSetVaultEntryWriteVaultResultConnectionCreateConnectionResultUserProfileAppConfigStorageType
License
MIT
