Function: requireGatewayClearance()
ts
function requireGatewayClearance(secret, store?): (ctx) => Promise<GatewayClearanceContext>;Defined in: packages/core/src/handoff/middleware.ts:71
Zero-trust middleware que valida o token de delegação HMAC.
Lê o header x-vurb-delegation do extra do pedido MCP, verifica a assinatura HMAC-SHA256 e o TTL, e injeta GatewayClearanceContext no contexto do handler.
Parameters
| Parameter | Type | Description |
|---|---|---|
secret | string | Segredo HMAC partilhado entre o gateway e o micro-servidor. Deve corresponder a SwarmGatewayConfig.delegationSecret. |
store? | HandoffStateStore | Store opcional para hidratação do Claim-Check (necessário quando carryOverState pode exceder 2 KB). |
Returns
ts
(ctx): Promise<GatewayClearanceContext>;Parameters
| Parameter | Type |
|---|---|
ctx | unknown |
Returns
Promise<GatewayClearanceContext>
Throws
HandoffAuthError — traduzido para erro FORBIDDEN pelo framework se não for capturado pelo handler.