Skip to content

@eventista/sdk-core

Core utilities and HTTP client building blocks for Eventista SDKs. Platform-agnostic — works in web browsers, Node, and React Native.

Terminal window
bun add @eventista/sdk-core

The same code runs on Web, Node, and React Native — no platform adapter is required for createClient or the crypto helpers.

app/api/health/route.ts
import { createClient, EventistaSDKError } from "@eventista/sdk-core";
const client = createClient({
baseURL: "https://api.eventista.example",
timeout: 10_000,
});
export async function GET() {
const response = await client.get("/health");
if (!response.ok) {
throw new EventistaSDKError("Health check failed", "HEALTH_CHECK_FAILED", {
cause: response.problem,
});
}
return Response.json(response.data);
}
lib/health.ts
import { createClient, EventistaSDKError } from "@eventista/sdk-core";
export const client = createClient({
baseURL: "https://api.eventista.example",
timeout: 10_000,
});
export async function checkHealth() {
const response = await client.get("/health");
if (!response.ok) {
throw new EventistaSDKError("Health check failed", "HEALTH_CHECK_FAILED", {
cause: response.problem,
});
}
return response.data;
}
// app/(tabs)/index.tsx
import { useEffect, useState } from "react";
import { Text, View } from "react-native";
import { checkHealth } from "../../lib/health";
export default function HomeScreen() {
const [status, setStatus] = useState<string>("checking…");
useEffect(() => {
checkHealth()
.then(() => setStatus("healthy"))
.catch((err) => setStatus(`error: ${err.code}`));
}, []);
return (
<View>
<Text>{status}</Text>
</View>
);
}

Request signing primitives (signRequest, verifyRequest, hmacSha256, sha256) are implemented via @noble/hashes — a pure-JS, audited, dependency-free implementation. The same code runs unchanged on web, Node ≥20, Bun, and React Native / Hermes; no platform adapter or polyfill is required.

Output bytes are byte-for-byte identical to crypto.subtle.sign("HMAC", ...) and Node crypto.createHmac("sha256", ...) for the same key + data, so backend verification logic does not need to change (RFC 2104). RFC 4231 known-answer tests live under tests/unit/utils/crypto/ and run as part of bun run test.

Scaffold release. Public API is unstable — do not depend on it for production yet.