Skip to content

DHT: Implement encrypted document storage API #2

@umwelt

Description

@umwelt

Context

After schema design is complete, implement the core DHT storage API for encrypted identity documents. This fulfills the Phase 1 deliverable: "Integrate DHT file storage layer".

Scope

  • Implement DHT put operation (store encrypted document)
  • Implement DHT get operation (retrieve by DID)
  • Handle ChaCha20-Poly1305 encryption/decryption
  • Implement replication logic (3+ nodes)
  • Add error handling for network failures
  • Public API: store_identity(did: &str, document: &[u8]) -> Result<()>
  • Public API: retrieve_identity(did: &str) -> Result<Vec<u8>>

Dependencies

Acceptance Criteria

  • store_identity function implemented and working
  • retrieve_identity function implemented and working
  • Documents encrypted with ChaCha20-Poly1305 before storage
  • Minimum 3-node replication enforced
  • Network error handling with retries
  • Unit tests with >80% coverage
  • Integration tests with local DHT cluster
  • API documentation with examples

Technical Notes

  • Use lib-crypto for ChaCha20-Poly1305 encryption (lib-crypto/src/symmetric/chacha20.rs)
  • Implement exponential backoff for retries (max 3 attempts)
  • Store metadata (timestamp, version) with encrypted document
  • Reference lib-identity/src/backup/crypto.rs for existing ChaCha20-Poly1305 usage patterns

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions