import { AccountInfoSchema, AdapterOptions, AdjustmentSchema, AdjustmentStatusEnumSchema, AgentTool, AmountSchema, Ap2MandateAp2WithCheckoutMandateSchema, Ap2MandateAp2WithMerchantAuthorizationSchema, Ap2MandateCheckoutMandateSchema, Ap2MandateErrorCodeSchema, Ap2MandateMerchantAuthorizationSchema, AuthorizationParams, AvailablePaymentInstrumentSchema, BindingSchema, BusinessFulfillmentConfigSchema, BuyerConsent, BuyerConsentBuyerSchema, BuyerConsentConsentSchema, BuyerSchema, CapabilityBaseSchema, CapabilityBusinessSchema, CapabilityPlatformSchema, CapabilityResponseSchema, CardCredential, CardCredentialCardNumberTypeEnumSchema, CardCredentialSchema, CardPaymentInstrumentAvailableCardPaymentInstrumentSchema, Cart, CartCapability, CartCreatePayload, CartCreateRequestSchema, CartResponseSchema, CartSchema, CartUpdatePayload, CartUpdateRequestSchema, CatalogCapability, CatalogExtensions, CatalogLookupResponse, CatalogLookupSchema, CatalogSearchResponse, CatalogSearchSchema, CategorySchema, CheckoutCapability, CheckoutCompleteRequestSchema, CheckoutCreateRequestSchema, CheckoutExtensions, CheckoutResponseSchema, CheckoutResponseStatusSchema, CheckoutSchema, CheckoutSession, CheckoutSessionSchema, CheckoutSessionStatus, CheckoutStatusEnumSchema, CheckoutUpdateRequestSchema, CompleteCheckoutPayload, CompleteCheckoutRequestSchema, ConnectedClient, ContextSchema, CreateCheckoutPayload, CreateCheckoutRequestSchema, DEFAULT_UCP_VERSION, DescriptionSchema, DetailOptionValue, DetailOptionValueSchema, DiscountAllocationSchema, DiscountAppliedDiscountMethodEnumSchema, DiscountAppliedDiscountSchema, DiscountDiscountsObjectSchema, EmbeddedConfigSchema, ErrorCodeSchema, ErrorResponseSchema, ExpectationMethodTypeEnumSchema, ExpectationSchema, FulfillmentAvailableMethodSchema, FulfillmentAvailableMethodTypeEnumSchema, FulfillmentDestinationSchema, FulfillmentEventSchema, FulfillmentExtensionFulfillmentAvailableMethodSchema, FulfillmentExtensionFulfillmentGroupSchema, FulfillmentExtensionFulfillmentMethodSchema, FulfillmentExtensionFulfillmentOptionSchema, FulfillmentExtensionFulfillmentSchema, FulfillmentGroupSchema, FulfillmentGroupUpdatePayload, FulfillmentGroupUpdateRequestSchema, FulfillmentMethodCreatePayload, FulfillmentMethodCreateRequestSchema, FulfillmentMethodResponseSchema, FulfillmentMethodSchema, FulfillmentMethodTypeEnumSchema, FulfillmentMethodUpdatePayload, FulfillmentMethodUpdateRequestSchema, FulfillmentOptionSchema, FulfillmentResponseSchema, FulfillmentSchema, IdentityLinkingCapability, InputCorrelationSchema, ItemResponseSchema, ItemSchema, JWK, JsonSchema, LineItemResponseSchema, LineItemSchema, LineItemUpdatePayload, LineItemUpdateRequestSchema, LinkSchema, LocalizationContext, MediaSchema, MerchantFulfillmentConfigSchema, MessageErrorContentTypeEnumSchema, MessageErrorSchema, MessageErrorSeverityEnumSchema, MessageInfoContentTypeEnumSchema, MessageInfoSchema, MessageSchema, MessageWarningContentTypeEnumSchema, MessageWarningSchema, OAuthServerMetadata, OptionValueSchema, OrderCapability, OrderConfirmationSchema, OrderLineItemSchema, OrderLineItemStatusEnumSchema, OrderUpdate, OrderUpdatePayload, OrderUpdateSchema, Pagination, PaginationSchema, PaymentCredential, PaymentCredentialSchema, PaymentHandlerBaseSchema, PaymentHandlerBusinessSchema, PaymentHandlerInstance, PaymentHandlerMap, PaymentHandlerPlatformSchema, PaymentHandlerResponseSchema, PaymentIdentitySchema, PaymentInstrument, PaymentInstrumentResponseSchema, PaymentInstrumentSchema, PaymentResponseSchema, PaymentSchema, PlatformFulfillmentConfigSchema, PostalAddress, PostalAddressSchema, PriceFilterSchema, PriceRangeSchema, PriceSchema, Product, ProductOptionSchema, ProductSchema, ProfileSchemaBaseSchema, ProfileSchemaBusinessProfileSchema, ProfileSchemaPlatformProfileSchema, ProfileSchemaSigningKeySchema, ProfileSchemaSigningKeyUseEnumSchema, RatingSchema, RetailLocationSchema, ReverseDomainNameSchema, SearchFilters, SearchFiltersSchema, SelectedOptionSchema, ServiceBaseSchema, ServiceBaseTransportEnumSchema, ServiceBusinessSchema, ServicePlatformSchema, ServiceResponseSchema, ShippingDestinationSchema, SignalsSchema, SignedAmountSchema, TokenCredential, TokenCredentialSchema, TokenExchangeParams, TokenRefreshParams, TokenResponse, TokenRevokeParams, ToolDescriptor, ToolErrorResult, TotalResponseSchema, TotalSchema, TotalsSchema, UCPClient, UCPClientConfig, UCPProfile, UCPProfileSchema, UCPSpecOrder, UCPSpecOrderSchema, UCP_CAPABILITIES, UcpBaseSchema, UcpBaseStatusEnumSchema, UcpBusinessSchema, UcpDiscoveryBusinessProfileSchema, UcpDiscoveryPlatformProfileSchema, UcpEntitySchema, UcpErrorSchema, UcpPlatformSchema, UcpRequiresSchema, UcpResponseCartSchema, UcpResponseCatalogSchema, UcpResponseCheckoutSchema, UcpResponseOrderSchema, UcpSigningKeySchema, UcpSigningKeySchema$1, UcpSuccessSchema, UcpVersionConstraintSchema, UcpVersionSchema, UpdateCheckoutPayload, UpdateCheckoutRequestSchema, Variant, VariantSchema, WebhookEvent, WebhookEventSchema, connect, getAgentTools } from "./catch-errors-B4orhUQa.cjs"; //#region src/verify-signature.d.ts /** * Verifies a `Request-Signature` header (detached JWS per RFC 7797) over a raw request body. * * Per UCP spec, the JWT header MUST include a `kid` claim identifying the signing key. * Returns `false` if `kid` is absent — do not fall back to guessing. * * @returns `true` if the signature is valid, `false` for any verification failure. */ /** * Verifies a `Request-Signature` header (detached JWS per RFC 7797) over a raw request body. * * Per UCP spec, the JWT header MUST include a `kid` claim identifying the signing key. * Returns `false` if `kid` is absent — do not fall back to guessing. * * @returns `true` if the signature is valid, `false` for any verification failure. */ declare function verifyRequestSignature(body: string, signature: string, signingKeys: readonly JWK[]): Promise; /** * A stateful verifier that fetches signing keys from a business's UCP discovery * profile and caches them for subsequent verifications. * * Keys are re-fetched from `/.well-known/ucp` when an unknown `kid` is encountered, * supporting zero-downtime key rotation as defined by the UCP spec. */ interface WebhookVerifier { /** * Verify a webhook `Request-Signature` header against the business's current * signing keys. Automatically re-fetches the discovery profile on `kid` cache miss. */ readonly verify: (body: string, signature: string) => Promise; } /** * Creates a {@link WebhookVerifier} bound to a specific business's UCP gateway. * * Signing keys are lazily loaded from `/.well-known/ucp` on the first call * and cached by `kid`. A cache miss triggers a re-fetch to support key rotation. * * @example * ```typescript * import { createWebhookVerifier } from '@omnixhq/ucp-client'; * * const verifier = createWebhookVerifier('https://store.example.com'); * * // In your webhook handler: * const valid = await verifier.verify(rawBody, req.headers['request-signature']); * if (!valid) return res.status(401).send('Invalid signature'); * ``` */ declare function createWebhookVerifier(gatewayUrl: string, options?: { readonly refetchCooldownMs?: number; }): WebhookVerifier; //#endregion //#region src/parse-webhook-event.d.ts //# sourceMappingURL=verify-signature.d.ts.map /** * Parses and validates a raw webhook request body as a UCP order event. * * Call this after verifying the `Request-Signature` header with * {@link createWebhookVerifier} or {@link verifyRequestSignature}. * * Throws {@link UCPError} with code `INVALID_WEBHOOK_PAYLOAD` if the body is * not valid JSON or does not conform to the UCP webhook event schema. * * @example * ```typescript * import { createWebhookVerifier, parseWebhookEvent } from '@omnixhq/ucp-client'; * * const verifier = createWebhookVerifier('https://store.example.com'); * * // In your webhook handler: * const valid = await verifier.verify(rawBody, req.headers['request-signature']); * if (!valid) return res.status(401).send('Invalid signature'); * * const event = parseWebhookEvent(rawBody); * console.log(event.event_id, event.order.id); * ``` */ declare function parseWebhookEvent(body: string): WebhookEvent; //#endregion //#region src/errors.d.ts //# sourceMappingURL=parse-webhook-event.d.ts.map type MessageType = 'error' | 'warning' | 'info'; type MessageSeverity = 'recoverable' | 'requires_buyer_input' | 'requires_buyer_review' | 'unrecoverable'; type ContentType = 'plain' | 'markdown'; /** A single message from the gateway's `messages[]` array. */ interface UCPMessage { readonly type: MessageType; readonly code?: string; readonly content: string; readonly severity?: MessageSeverity; /** JSONPath to the field that caused the error (e.g., `$.buyer.email`). */ readonly path?: string; readonly content_type?: ContentType; } /** Thrown when the gateway returns an error response with `messages[]`. */ declare class UCPError extends Error { readonly code: string; readonly type: MessageType; readonly statusCode: number; /** JSONPath to the field that caused the error, from the first message. */ readonly path: string | undefined; readonly contentType: ContentType | undefined; /** All messages from the gateway response. */ readonly messages: readonly UCPMessage[]; constructor(code: string, message: string, type?: MessageType, statusCode?: number, options?: { readonly path?: string; readonly contentType?: ContentType; readonly messages?: readonly UCPMessage[]; }); } /** Thrown on HTTP 409 when no `messages[]` body is present (idempotency key collision). */ declare class UCPIdempotencyConflictError extends UCPError { constructor(message?: string); } /** Thrown when a checkout response has `status: 'requires_escalation'` with a `continue_url`. */ declare class UCPEscalationError extends Error { /** The URL to redirect the buyer to for merchant-hosted checkout UI. */ readonly continue_url: string; constructor(continue_url: string, message?: string); } /** Thrown when an OAuth token exchange, refresh, or revocation fails. */ declare class UCPOAuthError extends Error { readonly statusCode: number; constructor(message: string, statusCode: number); } //#endregion //# sourceMappingURL=errors.d.ts.map export { AccountInfoSchema, AdapterOptions, AdjustmentSchema, AdjustmentStatusEnumSchema, AgentTool, AmountSchema, Ap2MandateAp2WithCheckoutMandateSchema, Ap2MandateAp2WithMerchantAuthorizationSchema, Ap2MandateCheckoutMandateSchema, Ap2MandateErrorCodeSchema, Ap2MandateMerchantAuthorizationSchema, AuthorizationParams, AvailablePaymentInstrumentSchema, BindingSchema, BusinessFulfillmentConfigSchema, BuyerConsent, BuyerConsentBuyerSchema, BuyerConsentConsentSchema, BuyerSchema, CapabilityBaseSchema, CapabilityBusinessSchema, CapabilityPlatformSchema, CapabilityResponseSchema, CardCredential, CardCredentialCardNumberTypeEnumSchema, CardCredentialSchema, CardPaymentInstrumentAvailableCardPaymentInstrumentSchema, Cart, CartCapability, CartCreatePayload, CartCreateRequestSchema, CartResponseSchema, CartSchema, CartUpdatePayload, CartUpdateRequestSchema, CatalogCapability, CatalogExtensions, CatalogLookupResponse, CatalogLookupSchema, CatalogSearchResponse, CatalogSearchSchema, CategorySchema, CheckoutCapability, CheckoutCompleteRequestSchema, CheckoutCreateRequestSchema, CheckoutExtensions, CheckoutResponseSchema, CheckoutResponseStatusSchema, CheckoutSchema, CheckoutSession, CheckoutSessionSchema, CheckoutSessionStatus, CheckoutStatusEnumSchema, CheckoutUpdateRequestSchema, CompleteCheckoutPayload, CompleteCheckoutRequestSchema, ConnectedClient, ContentType, ContextSchema, CreateCheckoutPayload, CreateCheckoutRequestSchema, DEFAULT_UCP_VERSION, DescriptionSchema, DetailOptionValue, DetailOptionValueSchema, DiscountAllocationSchema, DiscountAppliedDiscountMethodEnumSchema, DiscountAppliedDiscountSchema, DiscountDiscountsObjectSchema, EmbeddedConfigSchema, ErrorCodeSchema, ErrorResponseSchema, ExpectationMethodTypeEnumSchema, ExpectationSchema, FulfillmentAvailableMethodSchema, FulfillmentAvailableMethodTypeEnumSchema, FulfillmentDestinationSchema, FulfillmentEventSchema, FulfillmentExtensionFulfillmentAvailableMethodSchema, FulfillmentExtensionFulfillmentGroupSchema, FulfillmentExtensionFulfillmentMethodSchema, FulfillmentExtensionFulfillmentOptionSchema, FulfillmentExtensionFulfillmentSchema, FulfillmentGroupSchema, FulfillmentGroupUpdatePayload, FulfillmentGroupUpdateRequestSchema, FulfillmentMethodCreatePayload, FulfillmentMethodCreateRequestSchema, FulfillmentMethodResponseSchema, FulfillmentMethodSchema, FulfillmentMethodTypeEnumSchema, FulfillmentMethodUpdatePayload, FulfillmentMethodUpdateRequestSchema, FulfillmentOptionSchema, FulfillmentResponseSchema, FulfillmentSchema, IdentityLinkingCapability, InputCorrelationSchema, ItemResponseSchema, ItemSchema, JWK, UcpSigningKeySchema$1 as JWKSchema, JsonSchema, LineItemResponseSchema, LineItemSchema, LineItemUpdatePayload, LineItemUpdateRequestSchema, LinkSchema, LocalizationContext, MediaSchema, MerchantFulfillmentConfigSchema, MessageErrorContentTypeEnumSchema, MessageErrorSchema, MessageErrorSeverityEnumSchema, MessageInfoContentTypeEnumSchema, MessageInfoSchema, MessageSchema, MessageSeverity, MessageType, MessageWarningContentTypeEnumSchema, MessageWarningSchema, OAuthServerMetadata, OptionValueSchema, OrderCapability, OrderConfirmationSchema, OrderLineItemSchema, OrderLineItemStatusEnumSchema, OrderUpdate, OrderUpdatePayload, OrderUpdateSchema, Pagination, PaginationSchema, PaymentCredential, PaymentCredentialSchema, PaymentHandlerBaseSchema, PaymentHandlerBusinessSchema, PaymentHandlerInstance, PaymentHandlerMap, PaymentHandlerPlatformSchema, PaymentHandlerResponseSchema, PaymentIdentitySchema, PaymentInstrument, PaymentInstrumentResponseSchema, PaymentInstrumentSchema, PaymentResponseSchema, PaymentSchema, PlatformFulfillmentConfigSchema, PostalAddress, PostalAddressSchema, PriceFilterSchema, PriceRangeSchema, PriceSchema, Product, ProductOptionSchema, ProductSchema, ProfileSchemaBaseSchema, ProfileSchemaBusinessProfileSchema, ProfileSchemaPlatformProfileSchema, ProfileSchemaSigningKeySchema, ProfileSchemaSigningKeyUseEnumSchema, RatingSchema, RetailLocationSchema, ReverseDomainNameSchema, SearchFilters, SearchFiltersSchema, SelectedOptionSchema, ServiceBaseSchema, ServiceBaseTransportEnumSchema, ServiceBusinessSchema, ServicePlatformSchema, ServiceResponseSchema, ShippingDestinationSchema, SignalsSchema, SignedAmountSchema, TokenCredential, TokenCredentialSchema, TokenExchangeParams, TokenRefreshParams, TokenResponse, TokenRevokeParams, ToolDescriptor, ToolErrorResult, TotalResponseSchema, TotalSchema, TotalsSchema, UCPClient, UCPClientConfig, UCPError, UCPEscalationError, UCPIdempotencyConflictError, UCPMessage, UCPOAuthError, UCPProfile, UCPProfileSchema, UCPSpecOrder, UCPSpecOrderSchema, UCP_CAPABILITIES, UcpBaseSchema, UcpBaseStatusEnumSchema, UcpBusinessSchema, UcpDiscoveryBusinessProfileSchema, UcpDiscoveryPlatformProfileSchema, UcpEntitySchema, UcpErrorSchema, UcpPlatformSchema, UcpRequiresSchema, UcpResponseCartSchema, UcpResponseCatalogSchema, UcpResponseCheckoutSchema, UcpResponseOrderSchema, UcpSigningKeySchema, UcpSuccessSchema, UcpVersionConstraintSchema, UcpVersionSchema, UpdateCheckoutPayload, UpdateCheckoutRequestSchema, Variant, VariantSchema, WebhookEvent, WebhookEventSchema, WebhookVerifier, connect, createWebhookVerifier, getAgentTools, parseWebhookEvent, verifyRequestSignature }; //# sourceMappingURL=index.d.cts.map