Skip to main content
@cskn/sdk has three layers. You can use any of them on its own.

App data

Synchronous accessors for what the host injected into window.cskn.

Platform API

An authenticated HTTP client for api.csknapps.xyz and TanStack Query hooks for the common endpoints.

Native bridge

Camera, storage, notifications, passkeys and more, through the shell’s bridge.

Setup

The API hooks use TanStack Query, so the app needs a QueryClientProvider. Then call useBridgeAuth once at the root.

Conventions

  • Hooks and functions come in pairs. Every native feature has plain functions (capturePhoto, storageGet) and a React hook (useCamera, useStorage). The hooks are thin wrappers, so use the functions anywhere outside a component.
  • Results, not exceptions. Native calls resolve with { cancelled } or { error } instead of throwing. Check them before reading the payload.
  • appSlug defaults to the current app. Hooks that take an app slug (widgets, settings, themes) fall back to window.cskn.app.slug, so you rarely pass one.

Full example