Almanac
guestPublic

SDK API reference (generated)

source: scripts/gen-api-refs.mjs

This page is generated by scripts/gen-api-refs.mjs from the SDK sources on each build, so it stays in sync with the code. It is the exported public surface; the narrative reference with examples lives in identity, entitlements, and the JavaScript and Python pages.

Sources: citrate-sdk-js@328bdea, citrate-sdk-python@850b3c1.

JavaScript, @citratelabs/sdk

identity

SymbolKindSummary
UserIdtypeA 0x-prefixed 32-byte hex user id (the raw stable identifier the factory salts with)
uuidToUserIdfunctionDerive the raw 32-byte AA userId from an OIDC subject UUID
addressToUserIdfunctionLeft-pad a 20-byte EOA address to a 32-byte AA userId (SIWE-keyed principals)
predictWalletAddressfunctionPredict the counterfactual smart-wallet address for a userId. Pure + offline
verifyWalletAddressOnChainfunctionVerify the locally-predicted address against the on-chain factory (ground truth)
generateVerifierfunctionA 43-char base64url verifier (256 bits of entropy)
challengeFromVerifierfunctionS256 challenge for a verifier
verifyIdTokenfunctionVerify an OIDC ID token and return its (now-trusted) claims. Throws IdTokenError on any failure
DeployPermitinterfaceA factory deploy permit signed by the authority's identity-signer

entitlements

SymbolKindSummary
TIERSconstThe five tiers the authority mints (mirrors citrate-identity TIERS)
CapabilitySetinterfaceWhat a principal may do. Explicit set membership — never derived from an ordering
DEFAULT_CAPABILITIESconstThe canonical default tier→capability map
normalizeTierfunctionNormalize an entitlement tier value at the trust boundary. Unknown/garbage collapses to
EntitlementClaimLikeinterfaceThe minimal shape of the entitlement claim this module reads
capabilitiesfunctionCapabilities for a raw tier value (normalized first)
canfunctionWhether a claim grants a capability. Applies the same fail-safe + role-bypass semantics as

Python, citrate-labs-sdk

citrate_sdk.identity

SymbolKindSummary
WalletPredictionErrorclass
uuid_to_user_iddefkeccak256(utf8(lowercase(uuid))) — matches the authority's wallet-claims.ts
address_to_user_iddefLeft-pad a 20-byte EOA to a 32-byte AA userId (SIWE-keyed principals)
generate_verifierdefA 43-char base64url verifier (256 bits of entropy)
challenge_from_verifierdef
Pkceclass
create_pkcedef
IdTokenErrorclass
IdentityErrorclass
TokenSetclass
UserInfoclass
IdentityClientclass

citrate_sdk.entitlements

SymbolKindSummary
CapabilitySetclass
normalize_tierdefFail-safe: unknown/garbage/non-str collapses to public. Never escalates
capabilitiesdef

citrate_sdk.gateway

SymbolKindSummary
GatewayErrorclass
GatewayClientclass

Command line

citrate (Python)

usage: citrate [-h] {contract,wallet,entitlement,gateway} ...

Citrate SDK command line

positional arguments:
  {contract,wallet,entitlement,gateway}
    contract            Print the federation contract table
    wallet              Embedded smart-account wallet helpers
    entitlement         Entitlement capabilities
    gateway             Inference gateway

optional arguments:
  -h, --help            show this help message and exit