Skip to main content

Arkhos Client & Integration Guide

Arkhos — Secure Multi-Tenant Object Storage Abstraction

Welcome to the Arkhos File Vault client documentation. Arkhos is a multi-tenant backend microservice that gives your application a single, unified API to store, encrypt, version, share, and audit files across AWS S3, Google Cloud Storage, Azure Blob Storage, and Local Disk.


Why Consume Arkhos as a Client Application?​

Instead of embedding cloud-specific SDKs (aws-sdk, cloud.google.com/go/storage, azblob), managing raw encryption keys, or writing custom file validation logic in every microservice, your application interacts with Arkhos through standard REST endpoints or the official Go SDK (pkg/arkhos):

Core Capabilities Available to Your Application​

  1. "1 Big Bucket per Client + Free Logical Partitions": Your tenant is provisioned with an isolated cloud bucket (or local directory). Inside that bucket, your application organizes documents freely using any logical_path (e.g., finance/2026/11/invoice-901.pdf or hr/contracts/emp-42.docx).
  2. Two Upload & Delivery Modes:
    • STREAM_ENVELOPE (Zero-Trust Encrypted Vault): Your application streams plaintext files in constant ($O(1)$) RAM to Arkhos. Arkhos inspects Magic Bytes, computes SHA-256 on-the-fly, and encrypts the stream in 4 MB AES-256-GCM chunks using a unique per-file DEK (Data Encryption Key) wrapped by your tenant's KEK (Key Encryption Key).
    • PRESIGNED_CLOUD (Direct Cloud Offload): Your backend requests a time-bound, size-enforced pre-signed upload URL (POST /v1/files/presign-upload), your frontend uploads directly to S3/GCS/Azure passing the normalized required_headers, and your backend confirms (POST /v1/files/{id}/confirm).
  3. Automatic Immutable Versioning (v1, v2, ...): Uploading a new file to an existing logical_path never overwrites previous data; Arkhos automatically creates v2, marks it as is_latest = true, and preserves v1 for compliance and historical queries.
  4. Enterprise Governance (WORM, Crypto-Shredding & Hash-Chained Audit): Protect regulated documents with WORM (Write Once, Read Many) retention locks (HTTP 423 Locked on deletion attempts), permanently destroy sensitive data via Crypto-Shredding (DELETE /v1/files/{id}?shred=true), and verify every operation cryptographically via GET /v1/audit-logs?verify=true.

5-Minute Client Quickstart​

Step 1: Start Arkhos & Local Infrastructure​

# 1. Start PostgreSQL 16, MinIO (S3), fake-gcs-server (GCS), and Azurite (Azure)
docker compose -f iac/docker-compose.yml up -d

# 2. Build the Arkhos Server and CLI
cd src
go build -o ../dist/arkhos ./cmd/arkhos
go build -o ../dist/arkhosctl ./cmd/arkhosctl
cd ..

# 3. Start Arkhos Server on port 8080
export ARKHOS_PORT=8080
export ARKHOS_DATABASE_URL="postgres://arkhos:arkhos@127.0.0.1:5432/arkhos?sslmode=disable"
export ARKHOS_MASTER_KEY="0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
export ARKHOS_ADMIN_TOKEN="arkhos-dev-admin-token"
export ARKHOS_LOCAL_STORAGE_DIR="./data/storage"

./dist/arkhos

Step 2: Provision Your Client Tenant & API Key​

Use arkhosctl (or the Admin REST API) to onboard your client application and receive an X-API-Key:

export ARKHOS_SERVER_URL="http://127.0.0.1:8080"
export ARKHOS_ADMIN_TOKEN="arkhos-dev-admin-token"

# Create a client backed by LOCAL_DISK (or AWS_S3, GCP_GCS, AZURE_BLOB)
./dist/arkhosctl client create \
--slug acme-portal \
--name "Acme Customer Portal" \
--provider LOCAL_DISK \
--bucket arkhos-acme-bucket \
--ensure-bucket

# Issue a scoped API Key for your application
./dist/arkhosctl apikey create \
--client-id <YOUR_CLIENT_UUID> \
--name "acme-backend-key" \
--scopes "files:read,files:write,files:delete,presign:upload,presign:download,audit:read" \
--prefixes "*"

Step 3: Upload & Download Your First Encrypted File​

export ARKHOS_API_KEY="ak_live_..."

# 1. Stream-upload and encrypt a document in O(1) RAM
curl -sS -X POST "http://127.0.0.1:8080/v1/files/upload" \
-H "X-API-Key: ${ARKHOS_API_KEY}" \
-F "logical_path=finance/2026/11/invoice-001.pdf" \
-F 'custom_metadata={"category":"invoice","customer_id":"cust_99"}' \
-F "retain_days=365" \
-F "file=@./invoice-001.pdf" | jq .

# 2. List documents in your Big Bucket filtered by prefix and JSONB metadata
curl -sS "http://127.0.0.1:8080/v1/files?prefix=finance/2026/&metadata.category=invoice" \
-H "X-API-Key: ${ARKHOS_API_KEY}" | jq .

# 3. Stream-download the decrypted document
curl -sS "http://127.0.0.1:8080/v1/files/<FILE_UUID>/content" \
-H "X-API-Key: ${ARKHOS_API_KEY}" \
-o downloaded-invoice.pdf