Przejdź do głównej zawartości

Function: cartSecretMiddleware()

cartSecretMiddleware(getSecret, isCartScoped?): Middleware

Client cart-secret middleware. The header is sent only for cart-scoped operations (isCartScoped, default isCartScopedOperation); public reads stay cacheable and never touch the cookie. For a cart operation, getSecret is read fresh on each request so a rotated secret (recovery redeem) is picked up without rebuilding the pipeline. No header is sent when the secret is absent (legacy plain-id cookie) — the backend then treats the cart as unreachable and the SDK recreates one.

Parameters

getSecret

() => string | null | undefined

isCartScoped?

(operationName) => boolean

Returns

Middleware