import { Endpoint } from './common/types.js'; /** * Validates if a string is a valid Ethereum address * @param address - the address to check * @returns true if it's a valid Ethereum address */ export declare const isEthereumAddress: (address: string | undefined) => boolean; export declare const getRandomBigInt: (bits?: number) => bigint; /** * It generates a random step id * @returns the step id */ export declare const generateStepId: () => string; /** * It checks the step id has the right format * @param stepId - the step id to validate * @returns true if it's a valid step id */ export declare const isStepIdValid: (stepId: string) => boolean; /** * Decode an x402 access token to extract subscriber address and plan ID. * The x402 access token is a base64-encoded JSON document containing * session key information and permissions. * * @param accessToken - The x402 access token to decode (base64-encoded JSON) * @returns The decoded token data or null if invalid */ export declare const decodeAccessToken: (accessToken: string) => Record | null; /** * Encode a PaymentPayload object into an x402 access token string. * * Inverse of {@link decodeAccessToken}. Used by the MCP transport to turn the * in-band `_meta["x402/payment"]` PaymentPayload object back into the * base64url token string the facilitator's verify/settle APIs consume. * * The base64 envelope is transport-only: the EIP-712 signature lives inside * `payload.authorization` / `payload.signature`, not over the base64 wrapper, * so re-encoding a decoded (or foreign-encoded) payload is byte-safe for the * facilitator — the invariant is semantic recovery, not byte-identity. * * Produces unpadded base64url with compact JSON (no spaces), matching the form * {@link decodeAccessToken} accepts. * * Encodes UTF-8 bytes before base64 so it never throws on non-ASCII input — this * runs on client-supplied `_meta["x402/payment"]`, and `btoa` alone throws a * DOMException on code points > U+00FF. For ASCII JSON (all real x402 * PaymentPayloads: EIP-712 hex/decimal/signature fields) the output is * byte-identical to `btoa(json)`, so the round-trip with {@link decodeAccessToken} * is unchanged. `decodeAccessToken` is intentionally left as-is; a full UTF-8 * round-trip would additionally require decoding the bytes there. * * @param payload - The decoded PaymentPayload object (e.g. from `_meta["x402/payment"]`) * @returns The base64url-encoded access token string (unpadded) */ export declare const encodeAccessToken: (payload: Record) => string; /** * It returns the list of endpoints that are used by agents/services implementing the Nevermined Query Protocol * @param serverHost - The host of the server where the agents/services are running * @returns the list of endpoints */ export declare const getQueryProtocolEndpoints: (serverHost: string) => Endpoint[]; /** * Giving a server host it returns the URL to the OpenAPI documentation of the AI Hub * @param serverHost - the server host (i.e http://localhost:5000) * @returns */ export declare const getAIHubOpenApiUrl: (serverHost: string) => string; export declare const generateDeterministicAgentId: (agentId: string, className?: string) => string; export declare const generateSessionId: () => string; export declare const logSessionInfo: (agentId: string, sessionId: string, agentName?: string) => void; //# sourceMappingURL=utils.d.ts.map