Authentication
All authenticated requests to The Kernel API (Single API Entry Point) must present valid credentials scoped to the target instance and permissions.
Security Standard (
v1.1.0— Fail-Closed): Production integrations must enforce fail-closed authentication and deny-by-default authorization. Never hardcode credentials, never use fallback signing secrets, and never expose admin tokens in browser-side Theme code.
Initializing @webbios/sdk
Section titled “Initializing @webbios/sdk”Always load endpoint URLs and tokens from environment variables or Cloudflare Worker secrets:
import { WebbiSDK } from '@webbios/sdk';
const endpoint = process.env.WEBBIOS_API_ENDPOINT;const token = process.env.WEBBIOS_API_TOKEN;
if (!endpoint || !token) { throw new Error('Missing WEBBIOS_API_ENDPOINT or WEBBIOS_API_TOKEN');}
const sdk = new WebbiSDK({ // Single API Entry Point for your WebbiOS instance endpoint, token,});
const me = await sdk.auth.me();console.log('Authenticated user:', me.email);Inside Cloudflare Workers
Section titled “Inside Cloudflare Workers”Bind secrets via wrangler secret put and read them from the Worker env object:
import { WebbiSDK } from '@webbios/sdk';
export default { async fetch(request: Request, env: { WEBBIOS_API_ENDPOINT: string; WEBBIOS_API_TOKEN: string }) { if (!env.WEBBIOS_API_ENDPOINT || !env.WEBBIOS_API_TOKEN) { return new Response('Service misconfigured', { status: 500 }); }
const sdk = new WebbiSDK({ endpoint: env.WEBBIOS_API_ENDPOINT, token: env.WEBBIOS_API_TOKEN, });
const me = await sdk.auth.me(); return Response.json({ ok: true, user: me.email }); },};