> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spellguard.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Logging Backends

> Pluggable storage for commitments and message archives

# Logging Backends

AMP separates **commitment logging** (proof that message existed) from **message archiving** (storing encrypted content).

## Commitment Backends

Commitment backends provide tamper-evident audit trails.

| Backend  | Description               | Properties                       | Cost |
| -------- | ------------------------- | -------------------------------- | ---- |
| `memory` | In-memory store           | Volatile, fast                   | Free |
| `rekor`  | Sigstore transparency log | Immutable, public, Merkle proofs | Free |

## Archive Backends

Archive backends store encrypted message content.

| Backend  | Description             | Properties                                       | Cost       |
| -------- | ----------------------- | ------------------------------------------------ | ---------- |
| `memory` | In-memory store         | Volatile, fast                                   | Free       |
| `s3`     | AWS S3 with Object Lock | WORM compliance, supports S3-compatible services | S3 pricing |

## Configuration

Backends are configured via environment variables:

```bash theme={null}
# Commitment backend: 'memory' | 'rekor'
COMMITMENT_BACKEND=rekor

# Archive backend: 'memory' | 's3'
ARCHIVE_BACKEND=s3
```

## Backend Interfaces

```typescript theme={null}
interface CommitmentBackend {
  readonly name: string;
  init(): Promise<void>;
  logCommitment(commitment: AuditCommitment): Promise<string | null>;
  verifyCommitment(commitmentHash: string): Promise<boolean>;
  isConnected(): boolean;
}

interface ArchiveBackend {
  readonly name: string;
  init(): Promise<void>;
  archive(message: SecureMessage, commitment: AuditCommitment): Promise<string | null>;
  retrieve(archiveId: string): Promise<ArchivePayload | SecureMessage | null>;
  isConnected(): boolean;
}
```
