@optare/node
v0.1.0
Published
Server-side Optare SDK: sk_live_ management calls and offline JWT verification.
Readme
@optare/node
Server-side Optare SDK. Two independent pieces.
Offline JWT verification
Trust a bearer token from your front end without a network call or shared secret.
import { createOptareJwtVerifier } from "@optare/node";
const verifier = createOptareJwtVerifier({
baseURL: "https://id.optare.one", // JWKS: ${baseURL}/.well-known/jwks.json
});
const claims = await verifier.verify(token); // throws OptareJwtError if invalid
const maybe = await verifier.tryVerify(token); // null instead of throwingOne JWKS fetch, cached for an hour; every verify() after that is local
(signature + iss / exp / aud). Call verifier.invalidate() after key
rotation, or pass a pre-fetched jwks to go fully offline.
sk_live_ management calls
import { createOptareManagementClient } from "@optare/node";
const optare = createOptareManagementClient({
secretKey: process.env.OPTARE_SECRET_KEY!, // sk_live_… — never ship to a browser
baseURL: "https://id.optare.one",
});
await optare.organizations.list();
const org = await optare.organizations.create({ name: "Acme Inc" });
await optare.organizations.update(org.id, { consumerPlanTemplate: "professional" });
await optare.organizations.invite(org.id, { email: "[email protected]", role: "admin" });Non-2xx responses throw OptareApiError with .status and the server's message.
