Use this file to discover all available pages before exploring further.
ALX Protocol uses EIP-712 typed structured data to let agents authorize KB queries off-chain. A SignedProtocolRequest binds a specific KB, a natural-language query, the requesting agent address, a nonce, an expiry timestamp, and a chain ID. Verifiers recover the signer from the signature and enforce expiry and nonce uniqueness before processing the request.All signing and verification primitives are exported from @alx/protocol/core. Import directly from there rather than from the top-level @alx/protocol package when you only need EIP-712 utilities.
import { buildSignedProtocolRequestDomain, verifySignedProtocolRequest, SIGNED_PROTOCOL_REQUEST_TYPES, NonceTracker, SignedRequestValidationError,} from "@alx/protocol/core";
An in-memory NonceTracker instance. When provided, verifySignedProtocolRequest calls consume(agent, nonce) — which throws NONCE_REUSED if the nonce has already been seen, and records it otherwise.
On success, returns ok: true, the checksummed signer address recovered from the signature, and the normalized request with all numeric fields converted to strings.
Computes the EIP-712 struct hash for a request. Useful when you need the typed data hash for off-chain audit logs or as input to another protocol layer.
function hashSignedProtocolRequest( domain: SignedProtocolRequestDomain, request: SignedProtocolRequest): string
Recovers the signer address from a signature without performing expiry or nonce checks. Use verifySignedProtocolRequest for production verification; use this only when you need the raw recovered address.
function recoverSignedProtocolRequestSigner( domain: SignedProtocolRequestDomain, request: SignedProtocolRequest, signature: string): string
Validates and normalizes the numeric fields of a request to their canonical string forms. Throws MALFORMED_REQUEST if kbId is not a valid 32-byte hex string or if any numeric field cannot be converted to a non-negative BigInt.
An in-memory store that tracks consumed nonces per agent address. Use one NonceTracker instance per server process lifetime and persist nonces to durable storage if you need cross-restart replay protection.
class NonceTracker { has(agent: string, nonce: bigint | number | string): boolean; consume(agent: string, nonce: bigint | number | string): void;}