Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions request_for_proposals/ ddc-sdk-encryption.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# DDC SDK Built-in Encryption for Secure Data Storage

## Proposal submitted to Cere Foundation on [30th May 2025] by Nitin Gupta


## Abstract
This proposal aims to implement built-in encryption capabilities for Cere's Decentralized Data Cluster (DDC) SDK, enabling automatic client-side encryption during uploads and decryption during downloads. Currently, developers must implement encryption manually, which is error-prone and non-uniform. This project will embed encryption directly into the DDC SDK core, Playground, and CLI, making "privacy by default" a seamless part of every data flow. The solution will include a Cipher interface, AES-GCM encryption implementation, UI controls for the Playground, and command-line flags for the CLI.

## Team 🧑‍🤝‍🧑

### Team members
- Nitin Gupta


### Contact
- **Contact Name:** Nitin Gupta
- **Contact Email:** nitingupta6182345@gmail.com



### Team Code Repos
- https://github.com/nitininhouse/


### Team LinkedIn Profiles
- https://www.linkedin.com/in/nitin-gupta-8918b2280/

## Development Roadmap :nut_and_bolt:

### Overview
- **Total Estimated Duration:** 3-4 weeks
- **Full-Time Equivalent (FTE):** 1.0

### Milestone 1 — Core SDK Encryption Implementation
- **Estimated Duration:** 2 weeks
- **FTE:** 1.0

| Number | Deliverable | Specification |
| -----: | ----------- | ------------- |
| 1a | Cipher Interface Design | Define TypeScript interface with encrypt/decrypt methods accepting Uint8Array |
| 1b | DdcClientOptions Extension | Add optional cipher field to existing options interface |
| 1c | DdcClient Integration | Modify constructor, upload(), and download() methods to handle encryption |
| 1d | AES-GCM Implementation | Create production-ready AES-GCM cipher class |
| 1e | Unit Tests | Comprehensive test suite with mock XOR cipher and integration tests |
| 1f | Documentation | Update SDK documentation with encryption examples |

**Acceptance Criteria:**
- Cipher interface properly defined and exported
- Upload/download flows seamlessly handle encryption when cipher provided
- All existing functionality remains unchanged (backward compatibility)
- Unit tests achieve >95% coverage
- Integration tests verify round-trip encryption/decryption

### Milestone 2 — Playground Integration
- **Estimated Duration:** 2 weeks
- **FTE:** 1.0

| Number | Deliverable | Specification |
| -----: | ----------- | ------------- |
| 2a | UI Components | Encryption checkbox, key input field, download & decrypt button |
| 2b | React Integration | Connect UI controls to SDK encryption functionality |
| 2c | User Experience | Intuitive flow for enabling/disabling encryption |
| 2d | Error Handling | Proper error messages for invalid keys or decryption failures |
| 2e | Visual Feedback | Clear indicators when files are encrypted vs plain |

**Acceptance Criteria:**
- Encryption can be toggled on/off in Playground UI
- Users can input custom encryption keys
- Encrypted uploads show unintelligible data when downloaded directly
- "Download & Decrypt" successfully retrieves original plaintext
- Error handling provides clear feedback to users

### Milestone 3 — CLI Enhancement
- **Estimated Duration:** 1 weeks
- **FTE:** 1.0

| Number | Deliverable | Specification |
| -----: | ----------- | ------------- |
| 3a | Command Flags | Implement --encrypt and --key flags for upload/download |
| 3b | Argument Parsing | Robust parsing and validation of encryption parameters |
| 3c | CLI Integration | Connect flags to SDK encryption functionality |
| 3d | Help Documentation | Update CLI help text with encryption examples |
| 3e | End-to-End Testing | Verify CLI encryption workflow on testnet |

**Acceptance Criteria:**
- `ddc upload --encrypt --key <hex>` successfully encrypts files
- `ddc download --encrypt --key <hex>` successfully decrypts files
- Invalid keys or missing flags provide helpful error messages
- Help documentation clearly explains encryption usage
- CLI maintains all existing functionality

## Future Plans

**Long-term Maintenance:**
- Establish monitoring for encryption/decryption performance
- Plan for future cryptographic standard updates (post-quantum readiness)
- Consider integration with hardware security modules (HSMs)

**Short-term Enhancement:**
- Gather community feedback on encryption UX
- Optimize performance for large file encryption
- Add support for multiple encryption algorithms
- Create developer tutorials and best practices guide

**Long-term Vision:**
- Contribute to Cere ecosystem as ongoing community member
- Explore advanced features like key derivation and rotation
- Potential collaboration on future Cere infrastructure projects

## Preferred method of funds delivery
- USDC on Ethereum address: [Your 0x address]



## Additional Details

**Technical Approach:**
- Use Web Crypto API for browser compatibility
- Implement secure key handling with proper warnings
- Follow cryptographic best practices (authenticated encryption)
- Ensure consistent behavior across SDK, Playground, and CLI

**Risk Mitigation:**
- Comprehensive testing strategy including edge cases
- Security review of cryptographic implementation
- Performance benchmarking for large files
- Backward compatibility validation