SDK reference · Rails

@provenanceauth/rails/tabs

@provenanceauth/rails/tabs in the Rails: 7 methods. @provenanceauth/rails/tabs, tabs for small, frequent payments between agents.

Methods

tabHeaders

tabHeaders(tabToken: string): Record<string, string>

The headers a buyer sends on each call.

verifyTab

verifyTab(token: string, opts: { jwks: Jwks; seller: string; revocations: CachedRevocations | null; amount?: number; now?: number }): Promise<TabVerifyResult>

The seller's offline check of one call's tab token.

verifyRevocationList

verifyRevocationList(jws: string, opts: { jwks: Jwks; aud: string }): Promise<{ valid: boolean; list: RevocationList | null; detail?: string }>

Check a revocation list's signature (ES256, our JWKS) and audience.

statementShapeError

statementShapeError(p: unknown): string | null

signUsageStatement

signUsageStatement(input: Omit<UsageStatementPayload, "iat" | "kid"> & Partial<Pick<UsageStatementPayload, "iat" | "kid">>, privateKey: Ed25519PrivateJwk): Promise<{ statement: string; payload: UsageStatementPayload }>

Sign a usage statement with the seller agent's registered key (tab-usage+jwt, EdDSA).

verifyUsageStatement

verifyUsageStatement(statement: string, opts: { keys: SellerKey[]; seller?: string }): Promise<{ valid: boolean; detail?: string; payload: UsageStatementPayload | null }>

Verify a usage statement against the seller's registered keys.

createTabMeter

createTabMeter(opts: { dailyCap: number; now?: () => number; intervalMs?: number; capStep?: number }): void

Counts calls on one tab and says when a statement is due: every 5 minutes while in use, and each time usage passes another 20% of the daily cap.

Was this page helpful? Send us feedback

LLM? Read llms.txt.