SDK reference · Rails
@provenanceauth/rails/a2a
@provenanceauth/rails/a2a in the Rails: 11 methods. @provenanceauth/rails/a2a, handing a Provenance grant to another agent over A2A.
Methods
delegationExtension
delegationExtension(params: DelegationExtensionParams, opts?: { required?: boolean }): AgentExtensionThe extension entry for a receiver's Agent Card capabilities.extensions.
readDelegationExtension
readDelegationExtension(card: unknown): { params: DelegationExtensionParams; required: boolean } | { params: null; reason: string }The receiver's declared params, read from its Agent Card: the extension entry with a P-256 public holder key, or null with why (the card doesn't list it, or the key isn't usable).
delegationRequested
delegationRequested(header: string | string[] | null | undefined): booleanWhether an A2A-Extensions header value (or values) turns this extension on.
withDelegation
withDelegation<M extends A2AMessage>(message: M, data: DelegationMessageData): MThe message with the grant attached under the extension URI, and the URI listed in extensions.
readDelegation
readDelegation(message: unknown): DelegationMessageData | nullThe grant a message carries under the extension URI, or null (absent, or not a token string).
needMoreStatus
needMoreStatus(need: DelegationNeed, text: string, ids: { messageId: string; contextId?: string; taskId?: string }): A2ATaskStatusThe status a receiver answers with when its grant is too small: auth required, naming what it needs.
readNeed
readNeed(status: unknown): DelegationNeed | nullWhat an auth-required status says the receiver needs, or null (another state, or no need under the URI).
receiptMetadata
receiptMetadata(receipt: DelegationReceipt, metadata?: Record<string, unknown>): Record<string, unknown>An artifact's metadata with the receipt under the extension URI.
readReceipt
readReceipt(artifact: unknown): DelegationReceipt | nullThe receipt an artifact carries, or null.
acceptDelegation
acceptDelegation(message: unknown, opts: AcceptGrantOptions): Promise<DelegationVerdict>The receiver's check of a message's grant: it is present, checks against the JWKS (signature, expiry, need), is bound to this receiver's own key (cnf.jkt is its thumbprint: a grant bound to anyone else, or a bearer grant, is refused), and, when the receiver checks online or the grant says status_check: "online", its chain is live.
acceptGrant
acceptGrant(data: DelegationMessageData | null, opts: AcceptGrantOptions): Promise<DelegationVerdict>The receiver's check of a grant it was handed, whatever carried it (A2A metadata here, MCP _meta in @provenanceauth/rails/mcp): see.