SENTINEL Docs

Storage Backends

Choose where to store audit records: memory, file, or remote API.

Sentinel supports three storage backends. Pass one to AuditConfig.storage when configuring wrapWithSentinel or AuditLogger.

MemoryStorage

In-memory storage with configurable capacity and FIFO eviction. Best for development or short-lived processes.

import { MemoryStorage } from "@valeo/x402";

const storage = new MemoryStorage(10_000);  // max 10k records

FileStorage

JSONL file-based storage — appends one record per line. Buffers writes and flushes periodically. Best for local persistence.

import { FileStorage } from "@valeo/x402";

const storage = new FileStorage(".valeo/audit.jsonl", 10);
// filePath, flushThreshold (records before flush)
ParamTypeDefaultDescription
filePathstring".valeo/audit.jsonl"Path to JSONL file
flushThresholdnumber100Records before flush to disk

ApiStorage

Remote API storage. Batches records and POSTs to api.valeo.money. Falls back to in-memory if unreachable.

import { ApiStorage } from "@valeo/x402";

const storage = new ApiStorage({
  apiKey: process.env.VALEO_API_KEY!,
  baseUrl: "https://api.valeo.money",
  batchSize: 50,
  flushIntervalMs: 5000,
});
ParamTypeDescription
apiKeystringBearer token (val_xxx)
baseUrlstringAPI base URL (default: https://api.valeo.money)
batchSizenumberRecords per batch POST
flushIntervalMsnumberMax ms before flushing buffer