Skip to content

Commit 838ffc2

Browse files
committed
chore: docs
1 parent da302fb commit 838ffc2

File tree

6 files changed

+780
-12
lines changed

6 files changed

+780
-12
lines changed

\

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
export function generatePassword(length = 16): string {
2+
const chars =
3+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
4+
let result = "";
5+
const charsLength = chars.length;
6+
const randomValues = new Uint32Array(length);
7+
8+
crypto.getRandomValues(randomValues);
9+
10+
for (let i = 0; i < length; i++) {
11+
result += chars.charAt(randomValues[i] % charsLength);
12+
}
13+
14+
return result;
15+
}
16+
17+
export function generateNomadJob(w3id: string, eVaultId: string) {
18+
const neo4jUser = "neo4j";
19+
const neo4jPassword = generatePassword(24);
20+
21+
return {
22+
Job: {
23+
ID: `evault-${w3id}`,
24+
Name: `evault-${w3id}`,
25+
Type: "service",
26+
Datacenters: ["dc1"],
27+
TaskGroups: [
28+
{
29+
Name: "evault",
30+
Networks: [
31+
{
32+
Mode: "bridge",
33+
DynamicPorts: [
34+
{
35+
Label: "http",
36+
},
37+
],
38+
},
39+
],
40+
,
41+
"Volumes": {
42+
"evault-store": {
43+
"Type": "csi",
44+
"Source": "evault-store-abc123",
45+
"ReadOnly": false,
46+
"AccessMode": "single-node-writer",
47+
"AttachmentMode": "file-system",
48+
"Sticky": true
49+
},
50+
"neo4j-data": {
51+
"Type": "csi",
52+
"Source": "neo4j-data-abc123",
53+
"ReadOnly": false,
54+
"AccessMode": "single-node-writer",
55+
"AttachmentMode": "file-system",
56+
"Sticky": true
57+
}
58+
}
59+
Services: [
60+
{
61+
Name: `evault`,
62+
PortLabel: "http",
63+
Tags: ["internal"],
64+
Meta: {
65+
whois: w3id,
66+
id: eVaultId,
67+
},
68+
},
69+
],
70+
Tasks: [
71+
{
72+
Name: "neo4j",
73+
Driver: "docker",
74+
Config: {
75+
image: "neo4j:5.15",
76+
ports: [],
77+
volume_mounts: [
78+
{
79+
Volume: "neo4j-data",
80+
Destination: "/data",
81+
ReadOnly: false,
82+
},
83+
],
84+
},
85+
Env: {
86+
NEO4J_AUTH: `${neo4jUser}/${neo4jPassword}`,
87+
"dbms.connector.bolt.listen_address":
88+
"0.0.0.0:7687",
89+
},
90+
Resources: {
91+
CPU: 300,
92+
MemoryMB: 2048,
93+
},
94+
},
95+
{
96+
Name: "evault",
97+
Driver: "docker",
98+
Config: {
99+
image: "merulauvo/evault:latest",
100+
ports: ["http"],
101+
volume_mounts: [
102+
{
103+
Volume: "evault-store",
104+
Destination: "/evault/data",
105+
ReadOnly: false,
106+
},
107+
],
108+
},
109+
Env: {
110+
NEO4J_URI: "bolt://localhost:7687",
111+
NEO4J_USER: neo4jUser,
112+
NEO4J_PASSWORD: neo4jPassword,
113+
PORT: "${NOMAD_PORT_http}",
114+
W3ID: w3id,
115+
},
116+
Resources: {
117+
CPU: 300,
118+
MemoryMB: 512,
119+
},
120+
DependsOn: [
121+
{
122+
Name: "neo4j",
123+
Condition: "running",
124+
},
125+
],
126+
},
127+
],
128+
},
129+
],
130+
},
131+
};
132+
}
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
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

Comments
 (0)