|
| 1 | +# eVault Core |
| 2 | + |
| 3 | +eVault is a secure, distributed data storage and access system designed for the MetaState ecosystem. It provides a robust framework for storing, managing, and accessing structured data with fine-grained access control and GraphQL-based querying capabilities. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +eVault is a core component of the MetaState infrastructure that enables: |
| 8 | + |
| 9 | +- Secure storage of structured data |
| 10 | +- Fine-grained access control using W3ID |
| 11 | +- GraphQL-based data querying and manipulation |
| 12 | +- Distributed data management |
| 13 | +- Integration with the MetaState ecosystem |
| 14 | + |
| 15 | +## Architecture |
| 16 | + |
| 17 | +### Core Components |
| 18 | + |
| 19 | +1. **GraphQL Server** |
| 20 | + |
| 21 | + - Provides a flexible API for data operations |
| 22 | + - Supports complex queries and mutations |
| 23 | + - Includes built-in documentation and visualization tools |
| 24 | + |
| 25 | +2. **Access Control System** |
| 26 | + |
| 27 | + - W3ID-based authentication |
| 28 | + - Fine-grained access control lists (ACL) |
| 29 | + - Secure token-based authentication |
| 30 | + |
| 31 | +3. **Data Storage** |
| 32 | + |
| 33 | + - Neo4j-based storage backend |
| 34 | + - Structured data model with envelopes |
| 35 | + - Support for multiple data types and ontologies |
| 36 | + |
| 37 | +4. **HTTP Server** |
| 38 | + - Fastify-based web server |
| 39 | + - RESTful endpoints for basic operations |
| 40 | + - GraphQL endpoint for advanced operations |
| 41 | + |
| 42 | +### Data Model |
| 43 | + |
| 44 | +The eVault system uses a hierarchical data model: |
| 45 | + |
| 46 | +- **MetaEnvelope**: Top-level container for related data |
| 47 | + |
| 48 | + - Contains multiple Envelopes |
| 49 | + - Has an associated ontology |
| 50 | + - Includes access control information |
| 51 | + |
| 52 | +- **Envelope**: Individual data container |
| 53 | + - Contains structured data |
| 54 | + - Has a specific value type |
| 55 | + - Linked to a MetaEnvelope |
| 56 | + |
| 57 | +## Features |
| 58 | + |
| 59 | +### 1. Data Management |
| 60 | + |
| 61 | +- Store and retrieve structured data |
| 62 | +- Update and delete data with version control |
| 63 | +- Search and filter data by ontology and content |
| 64 | + |
| 65 | +### 2. Access Control |
| 66 | + |
| 67 | +- W3ID-based authentication |
| 68 | +- Fine-grained access control lists |
| 69 | +- Secure token-based operations |
| 70 | + |
| 71 | +### 3. Query Capabilities |
| 72 | + |
| 73 | +- GraphQL-based querying |
| 74 | +- Complex search operations |
| 75 | +- Real-time data access |
| 76 | + |
| 77 | +### 4. Integration |
| 78 | + |
| 79 | +- Seamless integration with W3ID |
| 80 | +- Support for multiple data formats |
| 81 | +- Extensible architecture |
| 82 | + |
| 83 | +## API Documentation |
| 84 | + |
| 85 | +### GraphQL Operations |
| 86 | + |
| 87 | +#### Queries |
| 88 | + |
| 89 | +- `getMetaEnvelopeById`: Retrieve a specific MetaEnvelope |
| 90 | +- `findMetaEnvelopesByOntology`: Find envelopes by ontology |
| 91 | +- `searchMetaEnvelopes`: Search envelopes by content |
| 92 | +- `getAllEnvelopes`: List all available envelopes |
| 93 | + |
| 94 | +#### Mutations |
| 95 | + |
| 96 | +- `storeMetaEnvelope`: Create a new MetaEnvelope |
| 97 | +- `deleteMetaEnvelope`: Remove a MetaEnvelope |
| 98 | +- `updateEnvelopeValue`: Update envelope content |
| 99 | + |
| 100 | +### HTTP Endpoints |
| 101 | + |
| 102 | +- `/graphql`: GraphQL API endpoint |
| 103 | +- `/voyager`: GraphQL schema visualization |
| 104 | +- `/documentation`: API documentation |
| 105 | + |
| 106 | +## Getting Started |
| 107 | + |
| 108 | +### Prerequisites |
| 109 | + |
| 110 | +- Node.js |
| 111 | +- Neo4j database |
| 112 | +- W3ID system |
| 113 | + |
| 114 | +### Installation |
| 115 | + |
| 116 | +1. Clone the repository |
| 117 | +2. Install dependencies: |
| 118 | + ```bash |
| 119 | + npm install |
| 120 | + ``` |
| 121 | +3. Configure environment variables: |
| 122 | + ``` |
| 123 | + NEO4J_URI=bolt://localhost:7687 |
| 124 | + NEO4J_USER=neo4j |
| 125 | + NEO4J_PASSWORD=your_password |
| 126 | + PORT=4000 |
| 127 | + ``` |
| 128 | +4. Start the server: |
| 129 | + ```bash |
| 130 | + npm start |
| 131 | + ``` |
| 132 | + |
| 133 | +## Security Considerations |
| 134 | + |
| 135 | +- All operations require W3ID authentication |
| 136 | +- Access control is enforced at both API and database levels |
| 137 | +- Data is encrypted in transit and at rest |
| 138 | +- Regular security audits and updates |
| 139 | + |
| 140 | +## Integration Guide |
| 141 | + |
| 142 | +### W3ID Integration |
| 143 | + |
| 144 | +eVault uses W3ID for authentication and access control: |
| 145 | + |
| 146 | +1. Obtain a W3ID token |
| 147 | +2. Include token in Authorization header |
| 148 | +3. Access eVault resources based on permissions |
| 149 | + |
| 150 | +### Data Storage |
| 151 | + |
| 152 | +1. Define data ontology |
| 153 | +2. Create MetaEnvelope with appropriate ACL |
| 154 | +3. Store and manage data through the API |
| 155 | + |
| 156 | +## Development |
| 157 | + |
| 158 | +### Testing |
| 159 | + |
| 160 | +```bash |
| 161 | +npm test |
| 162 | +``` |
| 163 | + |
| 164 | +### Documentation |
| 165 | + |
| 166 | +- API documentation available at `/documentation` |
| 167 | +- GraphQL schema visualization at `/voyager` |
| 168 | +- Example queries in `src/protocol/examples` |
| 169 | + |
| 170 | +## Contributing |
| 171 | + |
| 172 | +1. Fork the repository |
| 173 | +2. Create feature branch |
| 174 | +3. Submit pull request |
| 175 | + |
| 176 | +## License |
| 177 | + |
| 178 | +[License information] |
| 179 | + |
| 180 | +## Support |
| 181 | + |
| 182 | +[Support information] |
0 commit comments