{"openapi":"3.1.0","info":{"title":"AVGVSTO Server API","description":"Hardware-bound encryption server with AES-256-GCM, ChaCha20-Poly1305, USB key enforcement, and audit logging","contact":{"name":"Roy Merlo & RPX"},"license":{"name":"MIT","identifier":"MIT"},"version":"0.1.0"},"paths":{"/api/v1/audit-log":{"get":{"tags":["admin"],"operationId":"audit_log_handler","parameters":[{"name":"user_id","in":"query","description":"Filter by user ID","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"action","in":"query","description":"Filter by action type","required":false,"schema":{"type":"string"}},{"name":"from","in":"query","description":"Start date (RFC 3339)","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","description":"End date (RFC 3339)","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Max results","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"offset","in":"query","description":"Pagination offset","required":false,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"Audit log entries"},"403":{"description":"Admin access required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/decrypt":{"post":{"tags":["crypto"],"operationId":"decrypt_handler","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecryptBody"}}},"required":true},"responses":{"200":{"description":"Data decrypted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecryptResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Decryption failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/decrypt-file":{"post":{"tags":["crypto"],"operationId":"decrypt_file_handler","requestBody":{"description":"Encrypted file upload (multipart/form-data)","content":{"text/plain":{"schema":{"type":"string"}}},"required":true},"responses":{"200":{"description":"File decrypted successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/encrypt":{"post":{"tags":["crypto"],"operationId":"encrypt_handler","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EncryptBody"}}},"required":true},"responses":{"200":{"description":"Data encrypted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EncryptResponseBody"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"USB key required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/encrypt-file":{"post":{"tags":["crypto"],"operationId":"encrypt_file_handler","requestBody":{"description":"File upload (multipart/form-data)","content":{"text/plain":{"schema":{"type":"string"}}},"required":true},"responses":{"200":{"description":"File encrypted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EncryptResponseBody"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/health":{"get":{"tags":["health"],"operationId":"health_check","responses":{"200":{"description":"Server health status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}},"503":{"description":"Service degraded"}}}},"/api/v1/keys":{"get":{"tags":["crypto"],"operationId":"list_keys","responses":{"200":{"description":"List of bound keys"}}}},"/api/v1/keys/bind-usb":{"post":{"tags":["crypto"],"operationId":"bind_usb_key","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BindUsbBody"}}},"required":true},"responses":{"200":{"description":"USB key bound"},"400":{"description":"USB device not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/login":{"post":{"tags":["auth"],"operationId":"login","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginBody"}}},"required":true},"responses":{"200":{"description":"Login successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"Invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/metrics":{"get":{"tags":["health"],"operationId":"metrics_handler","responses":{"200":{"description":"Server metrics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricsResponse"}}}}}}},"/api/v1/refresh":{"post":{"tags":["auth"],"operationId":"refresh","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshBody"}}},"required":true},"responses":{"200":{"description":"Token refreshed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"Invalid or expired refresh token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/register":{"post":{"tags":["auth"],"operationId":"register","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterBody"}}},"required":true},"responses":{"201":{"description":"User registered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"User already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/stats":{"get":{"tags":["health"],"operationId":"stats_handler","responses":{"200":{"description":"Server stats","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsResponse"}}}}}}},"/api/v1/verify":{"post":{"tags":["crypto"],"operationId":"verify_handler","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyBody"}}},"required":true},"responses":{"200":{"description":"Format verified","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}},"components":{"schemas":{"ApiError":{"type":"object","required":["error","code"],"properties":{"code":{"type":"string"},"error":{"type":"string"}}},"AuditLogParams":{"type":"object","properties":{"action":{"type":["string","null"]},"from":{"type":["string","null"]},"limit":{"type":["integer","null"],"format":"int64"},"offset":{"type":["integer","null"],"format":"int64"},"to":{"type":["string","null"]},"user_id":{"type":["string","null"],"format":"uuid"}}},"AuthResponse":{"type":"object","required":["access_token","refresh_token","token_type","expires_in","user_id","role"],"properties":{"access_token":{"type":"string"},"expires_in":{"type":"integer","format":"int64"},"refresh_token":{"type":"string"},"role":{"type":"string"},"token_type":{"type":"string"},"user_id":{"type":"string","format":"uuid"}}},"BindUsbBody":{"type":"object","required":["usb_path"],"properties":{"usb_path":{"type":"string"}}},"CipherSuite":{"type":"string","enum":["aes-256-gcm","chacha20-poly1305"]},"DecryptBody":{"type":"object","required":["encrypted_data"],"properties":{"encrypted_data":{"type":"string"},"passphrase":{"type":["string","null"]},"usb_key_path":{"type":["string","null"]}}},"DecryptResponse":{"type":"object","required":["data","cipher"],"properties":{"cipher":{"$ref":"#/components/schemas/CipherSuite"},"data":{"type":"array","items":{"type":"integer","format":"int32","minimum":0}}}},"EncryptBody":{"type":"object","required":["data"],"properties":{"cipher":{"type":["string","null"]},"data":{"type":"string"},"passphrase":{"type":["string","null"]},"usb_key_path":{"type":["string","null"]},"use_duress":{"type":["boolean","null"]}}},"EncryptResponseBody":{"type":"object","required":["encrypted_data","file_id","cipher","format_version"],"properties":{"cipher":{"type":"string"},"encrypted_data":{"type":"string"},"file_id":{"type":"string","format":"uuid"},"format_version":{"type":"integer","format":"int32","minimum":0}}},"HealthResponse":{"type":"object","required":["status","version","uptime_secs","database"],"properties":{"database":{"type":"string"},"status":{"type":"string"},"uptime_secs":{"type":"integer","format":"int64","minimum":0},"version":{"type":"string"}}},"LoginBody":{"type":"object","required":["username","password"],"properties":{"password":{"type":"string"},"username":{"type":"string"}}},"MetricsResponse":{"type":"object","required":["uptime_secs","total_requests","memory_usage_bytes"],"properties":{"memory_usage_bytes":{"type":"integer","format":"int64","minimum":0},"total_requests":{"type":"integer","format":"int64","minimum":0},"uptime_secs":{"type":"integer","format":"int64","minimum":0}}},"RefreshBody":{"type":"object","required":["refresh_token"],"properties":{"refresh_token":{"type":"string"}}},"RegisterBody":{"type":"object","required":["username","password"],"properties":{"password":{"type":"string"},"username":{"type":"string"}}},"RegisterResponse":{"type":"object","required":["user_id","username","role"],"properties":{"role":{"type":"string"},"user_id":{"type":"string","format":"uuid"},"username":{"type":"string"}}},"StatsResponse":{"type":"object","required":["app_name","app_version","uptime_secs","total_requests"],"properties":{"app_name":{"type":"string"},"app_version":{"type":"string"},"total_requests":{"type":"integer","format":"int64","minimum":0},"uptime_secs":{"type":"integer","format":"int64","minimum":0}}},"VerifyBody":{"type":"object","required":["encrypted_data"],"properties":{"encrypted_data":{"type":"string"}}},"VerifyResponse":{"type":"object","required":["valid","format_version"],"properties":{"cipher":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CipherSuite"}]},"format_version":{"type":"integer","format":"int32","minimum":0},"valid":{"type":"boolean"}}}}},"tags":[{"name":"auth","description":"Authentication endpoints"},{"name":"crypto","description":"Encryption/decryption endpoints"},{"name":"health","description":"Health and metrics endpoints"},{"name":"admin","description":"Admin-only endpoints"}]}