@fusorb/facet-sdk
v4.1.0
Published
SovGrant API client: framework-agnostic fetch SDK. Auth, credentials, passkeys, OAuth, tenants, billing, webhooks, audit, IdP.
Maintainers
Readme
@fusorb/facet-sdk
SovGrant API client — pure fetch, typed, 11 domain SDK modules. Each module
maps to a facet surface (auth, passkey, identity, OAuth, tenant, billing,
webhooks, audit, identity-provider, api-key, core).
Install
pnpm add @fusorb/facet-sdkUsage
import { SgClient, AuthSdk, TenantSdk } from "@fusorb/facet-sdk";
const sg = new SgClient({
baseUrl: "https://api.sovgrant.com",
apiKey: process.env.SOVGRANT_API_KEY,
});
const { data: tenant } = await sg.tenant.get("acme-corp");
const auth = new AuthSdk(sg);
const { data: session } = await auth.getSession();Architecture
Every domain SDK is a thin, typed wrapper around SgClient.fetch(). No
business logic lives here — just request serialization, response parsing, error
types, and ergonomic method chaining.
| Module | Export | Surface |
|--------|--------|---------|
| SgClient | class | Core HTTP client (fetch + retry + typed errors). |
| AuthSdk | class | Session, token refresh, sign-in/sign-up lifecycle. |
| PasskeySdk | class | Passkey registration + assertion flow. |
| IdentitySdk | class | DID resolution, credential presentation. |
| OAuthSdk | class | OAuth 2.0 / OIDC flows (authorize, token,userinfo). |
| TenantSdk | class | Tenant CRUD, branding, config. |
| BillingSdk | class | Subscriptions, invoices, payment methods. |
| VcSdk | class | Verifiable credentials: issue, verify, revoke, status lists, offers. |
| WebhooksSdk | class | Webhook registration, signing, delivery history. |
| AuditSdk | class | Audit log query + streaming. |
| IdpSdk | class | Identity-provider federation (OIDC/SAML). |
| ApiKeySdk | class | Machine-to-machine API key management (create/list/revoke). |
Token-refresh bridge
The auth surface integrates with @fusorb/facet-store's token-refresh
middleware. When a 401 is received, the store transparently retries with a
refreshed token before the SDK surfaces the error to the caller.
License
MIT © facet contributors. See LICENSE at the repository root.
