UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

25 lines (24 loc) • 1.15 kB
import { P as resolveIntegerOption } from "./number-coercion-D6u-4YD8.mjs"; //#region src/channels/direct-dm-guard-policy.ts /** * Direct-DM pre-crypto guard policy. * * Defines conservative shape, size, timestamp, and rate limits before decryption work starts. */ /** Builds the shared policy object for DM-style pre-crypto guardrails. */ function createDirectDmPreCryptoGuardPolicy(e = {}) { return { allowedKinds: e.allowedKinds ?? [4], maxFutureSkewSec: resolveIntegerOption(e.maxFutureSkewSec, 120, { min: 0 }), maxCiphertextBytes: resolveIntegerOption(e.maxCiphertextBytes, 16384, { min: 1 }), maxPlaintextBytes: resolveIntegerOption(e.maxPlaintextBytes, 8192, { min: 1 }), rateLimit: { windowMs: resolveIntegerOption(e.rateLimit?.windowMs, 6e4, { min: 1 }), maxPerSenderPerWindow: resolveIntegerOption(e.rateLimit?.maxPerSenderPerWindow, 20, { min: 1 }), maxGlobalPerWindow: resolveIntegerOption(e.rateLimit?.maxGlobalPerWindow, 200, { min: 1 }), maxTrackedSenderKeys: resolveIntegerOption(e.rateLimit?.maxTrackedSenderKeys, 4096, { min: 1 }) } }; } //#endregion export { createDirectDmPreCryptoGuardPolicy as t };