Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

246 write an architecture document for didcomm mediator server e13 #269

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

Tekum-Emmanuella
Copy link
Collaborator

please @ all, read this arc doc so we can review together and merge.


---

# DIDComm Mediator RS - ARC42 Architecture Documentation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this RS here is confusing


### 2.1 Technical Constraints
- **Rust Programming Language**: Ensures high performance and memory safety.
- **Transport Agnosticism**: Supports various protocols (HTTP, Bluetooth, etc.).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bluetooth is not yet supported

- **No External State**: Minimal reliance on external systems for scalability.

### 2.2 Regulatory Constraints
- **Privacy Compliance**: Aligns with GDPR and similar regulations.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this GDPR means

docs/arc42.md Show resolved Hide resolved
| **DID Rotation** | Accepted | ✅ Implemented |
| **Cross-Domain Messaging/Routing Protocol** | Adopted | ✅ Implemented |
| **Trust Ping Protocol** | Adopted | ✅ Implemented |
| **Discover Features Protocol** | Adopted | ⚪ In Progress |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| **Discover Features Protocol** | Adopted |In Progress |
| **Discover Features Protocol** | Adopted |Implemented |

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| **Discover Features Protocol** | Adopted | ⚪ In Progress |
| **Discover Features Protocol** | Adopted | ✅ Implemented |

Comment on lines +96 to +99
2. **In Progress Features**:
- **Discover Features Protocol** and **Out-of-Band Messaging** are under development to expand functionality.
- **Basic Message Protocol** will enable straightforward message exchanges between agents.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel like its preferable to remove this highlight here because this will require frequent modifications, beside the discover features protocol is implemented already


1. **Web Plugin Layer**:
- Enables plug-and-play of web endpoints.
- Currently used to implement features such as DID endpoints, out-of-band messages, and DIDComm messaging.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Currently used to implement features such as DID endpoints, out-of-band messages, and DIDComm messaging.
- Currently used to implement features such as **DID Endpoints**, **out-of-band messaging**, and **DIDComm messaging**.

At the core is the **Generic Server**, responsible for hosting the overall application and enabling the plugin system. The main components are:

1. **Dispatcher**: Routes incoming requests to the appropriate web plugin.
2. **Web Plugin Layer**: Hosts modular implementations for endpoint-specific logic (e.g., DID endpoint generation, out-of-band messages).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. **Web Plugin Layer**: Hosts modular implementations for endpoint-specific logic (e.g., DID endpoint generation, out-of-band messages).
2. **Web Plugin Layer**: Hosts modular implementations for endpoint-specific logic (e.g., DID endpoint generation, out-of-band messaging).

Comment on lines +145 to +157
graph TD
GenericServer[Generic Server] --> Dispatcher[Dispatcher]
Dispatcher --> WebPluginLayer[Web Plugin Layer]
WebPluginLayer --> DIDEndpoint[DID Endpoint]
WebPluginLayer --> OOBMessaging[Out-of-Band Messages]
WebPluginLayer --> DIDCommMessaging[DIDComm Messaging Endpoint]
DIDCommMessaging --> CommonProcessing[Common DIDComm Processing]
DIDCommMessaging --> MessagingPlugins[Messaging Plugin Layer]
MessagingPlugins --> Forward[Forward Protocol]
MessagingPlugins --> Pickup[Pickup Protocol]
MessagingPlugins --> Coordination[Mediator Coordination Protocol]
MessagingPlugins --> Trustping[Trust Ping Protocol]
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the Out-of-Band messages to Out-of-Band Messaging

Comment on lines +231 to +342

**Disadvantages**:
- No fault tolerance: if the mediator fails, the service becomes unavailable.
- Limited scalability.

---

#### 2. **Distributed Deployment with Load Balancer (Recommended)**

**Use Case**: Ideal for production environments requiring high availability and scalability.

- Multiple mediator instances are deployed behind a load balancer.
- The load balancer distributes requests evenly across mediators, ensuring efficient utilization of resources.
- Supports horizontal scaling by adding more mediator instances as needed.

**Advantages**:
- High availability: If one mediator instance fails, others continue handling requests.
- Scalable: New instances can be added to handle increased load.
- Efficient routing: Load balancer optimizes resource utilization.

**Disadvantages**:
- Slightly higher complexity due to additional components (load balancer).

---

### 7.3 Deployment Diagram

Below is a component diagram showcasing the deployment with multiple mediators and a load balancer:

```mermaid
graph TD
subgraph Internet
User1[Recipient Agent]
User2[Sender Agent]
end

User1 --> LB[Load Balancer]
User2 --> LB

subgraph Mediator Cluster
Mediator1[Mediator Instance 1]
Mediator2[Mediator Instance 2]
end

LB --> Mediator1
LB --> Mediator2

Mediator1 --> DB1[Message Storage DB]
Mediator2 --> DB1
```

---

### 7.4 Deployment Considerations

#### **Cloud Deployment**

**Infrastructure**:
- Use cloud platforms like AWS, Azure, or GCP.
- Services like Elastic Load Balancer (AWS), Application Gateway (Azure), or Cloud Load Balancer (GCP) can be employed for load balancing.

**Scaling**:
- Leverage auto-scaling groups to dynamically scale mediator instances based on traffic.

**Monitoring**:
- Use monitoring tools (e.g., Prometheus, CloudWatch, or Azure Monitor) to track mediator performance, error rates, and resource usage.

---

#### **On-Premises Deployment**

**Infrastructure**:
- Deploy mediators on virtual machines or containers (e.g., Docker).
- Use a software-based load balancer (e.g., HAProxy, NGINX) for request distribution.

**Scaling**:
- Add more mediator instances manually to handle increased traffic.

**Monitoring**:
- Use tools like Grafana and Prometheus to monitor system health.

---

### 7.5 Benefits of Load Balancer in Deployment

1. **Fault Tolerance**:
- Ensures service continuity even if one mediator instance fails.

2. **Scalability**:
- Handles growing traffic by distributing load across multiple instances.

3. **Optimized Resource Utilization**:
- Prevents overloading a single mediator, ensuring consistent performance.

4. **Simplified Maintenance**:
- Instances can be updated or replaced without downtime by redirecting traffic.

This detailed deployment view provides clarity on how the system can be deployed effectively, balancing performance, fault tolerance, and scalability.

---
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the whole of this deployment view we only saying what can be use, i think the document is to empose what to do base our capabilities

#### 8.1.6 Secure Logging and Monitoring

**Log Handling**:
- Sensitive data (e.g., private keys, PII) is redacted from logs.
Copy link
Collaborator

@Blindspot22 Blindspot22 Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(PII) is good but I think it will be best if you just wrote it out as (Personally Identifiable Information).


1. **Static Application Security Testing (SAST)**:
- Tools like **SonarQube**, **CodeQL**, or **Checkmarx** are used to scan source code for vulnerabilities.
- Integrated into CI/CD pipelines to analyze every commit and pull request.
Copy link
Collaborator

@Blindspot22 Blindspot22 Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Integrated into CI/CD pipelines to analyze every commit and pull request.
Integration of CI/CD pipelines to analyze every commit and pull request.

or

Suggested change
- Integrated into CI/CD pipelines to analyze every commit and pull request.
Integrated CI/CD pipelines to analyze every commit and pull request.

| **DID Rotation** | Accepted | ✅ Implemented |
| **Cross-Domain Messaging/Routing Protocol** | Adopted | ✅ Implemented |
| **Trust Ping Protocol** | Adopted | ✅ Implemented |
| **Discover Features Protocol** | Adopted | ⚪ In Progress |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| **Discover Features Protocol** | Adopted | ⚪ In Progress |
| **Discover Features Protocol** | Adopted | ✅ Implemented |

@Blindspot22 Blindspot22 added documentation Improvements or additions to documentation enhancement New feature or request Pending and removed Pending labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write an Architecture Document for DIDComm Mediator Server E13
5 participants