Add IP Vault: Cryptographic proof-of-origin system

Implements a complete vertical slice of the IP Vault feature for BlackRoad OS,
providing cryptographic timestamping and evidence generation for ideas and
intellectual property.

## Components Added

### Agent Layer
- **VaultAgent** (`agents/categories/security/vault_agent.py`):
  - Deterministic text canonicalization
  - Multi-hash generation (SHA-256, SHA-512, Keccak-256)
  - LEO (Ledger Evidence Object) construction
  - Verification text generation
  - Blockchain anchoring preparation

### Backend API
- **Models** (`backend/app/models/leo.py`):
  - LEO: Stores cryptographic hashes and metadata
  - AnchorEvent: Audit trail for blockchain anchoring

- **Schemas** (`backend/app/schemas/leo.py`):
  - LEOCreate, LEOResponse, LEODetail, LEOList
  - AnchorRequest, AnchorEventResponse

- **Router** (`backend/app/routers/ip_vault.py`):
  - POST /api/vault/leos - Create new LEO
  - GET /api/vault/leos - List LEOs (paginated)
  - GET /api/vault/leos/{id} - Get LEO details
  - POST /api/vault/leos/{id}/anchor - Initiate anchoring (stub)
  - GET /api/vault/leos/{id}/events - Get anchor events

### Frontend
- **API Client** (`backend/static/js/api-client.js`):
  - createLEO(), getLEOs(), getLEO()
  - anchorLEO(), getLEOEvents()

- **App** (`backend/static/js/apps.js`):
  - loadIPVault() - Load and display LEOs
  - vaultIdea() - Create new LEO from form
  - viewLEO() - Show detailed LEO modal with verification

- **UI** (`backend/static/index.html`):
  - Desktop icon (🔐 IP Vault)
  - Window with form and list view
  - Start menu integration

## Features

- **Deterministic canonicalization**: Ensures reproducible hashing
- **Multi-hash support**: SHA-256, SHA-512, Keccak-256 (Ethereum-compatible)
- **Verification instructions**: Auto-generated proof-of-authenticity text
- **Blockchain-ready**: Prepared for Bitcoin, Litecoin, Ethereum anchoring
- **Clean separation**: Agent logic, API, database, frontend all decoupled

## Testing

- Python syntax validated for all new files
- JavaScript syntax validated
- VaultAgent tested end-to-end with sample idea
- All hashes computed successfully

## Next Steps

- Implement actual blockchain anchoring
- Add RoadChain integration
- Export LEOs as legal-grade PDFs
- Add user authentication to LEO creation
This commit is contained in:
Claude
2025-11-18 11:18:39 +00:00
parent ce7b42a257
commit 45bd2cc194
11 changed files with 1066 additions and 2 deletions

View File

@@ -419,6 +419,38 @@ class ApiClient {
async deleteFile(fileId) {
return this.delete(`/api/files/${fileId}`);
}
// ===== IP Vault API =====
async createLEO(idea, author = 'Alexa', title = null) {
return this.post('/api/vault/leos', {
idea,
author,
title
});
}
async getLEOs(page = 1, perPage = 20, author = null) {
let endpoint = `/api/vault/leos?page=${page}&per_page=${perPage}`;
if (author) {
endpoint += `&author=${encodeURIComponent(author)}`;
}
return this.get(endpoint);
}
async getLEO(leoId) {
return this.get(`/api/vault/leos/${leoId}`);
}
async anchorLEO(leoId, chain = 'bitcoin') {
return this.post(`/api/vault/leos/${leoId}/anchor`, {
chain
});
}
async getLEOEvents(leoId) {
return this.get(`/api/vault/leos/${leoId}/events`);
}
}
// Create singleton instance