# Mod validation multisign

#### Add guardians sequence

{% @mermaid/diagram content="sequenceDiagram
participant User
participant DApp
participant Account
participant ModValidation as ValidationModule
participant ModValidationMultisign

```
User->>DApp: Add Guardian
DApp->>Account: execute_user(add_guardian_operation)
Account->>Account: Select validation module based on scope
Account->>ModValidation: validate_operation(add_guardian_operation)
ModValidation-->>Account: Return valid

Account->>ModValidationMultisign: add_guardian(guardian_address)
ModValidationMultisign-->>Account: Guardian added
Account-->>DApp: Return status
DApp-->>User: Display guardian addition success

User->>DApp: Set Threshold
DApp->>Account: execute_user(set_threshold_operation)
Account->>Account: Select validation module based on scope
Account->>ModValidation: validate_operation(set_threshold_operation)
ModValidation-->>Account: Return valid

Account->>ModValidationMultisign: set_threshold(new_threshold)
ModValidationMultisign-->>Account: Threshold set
Account-->>DApp: Return status
DApp-->>User: Display threshold setting success
```

" %}

#### Verifiy multisign sequence

{% @mermaid/diagram content="sequenceDiagram
participant User
participant DApp
participant Account
participant ModValidation as ValidationModule
participant ModValidationMultisign

```
User->>DApp: Request token transfer
DApp->>Account: execute_user(token_transfer_operation)
Account->>Account: Select validation module based on scope
Account->>ModValidation: validate_operation(token_transfer_operation)
ModValidation-->>Account: Return valid

Account->>ModValidationMultisign: is_valid_signature(multisignature)
ModValidationMultisign->>ModValidationMultisign: Verify signatures of all guardians
ModValidationMultisign-->>Account: Return valid

Account->>Account: Execute token transfer operation
Account-->>DApp: Return transaction status
DApp-->>User: Display transaction success" %}
```

### **Overview**

`ModValidationMultisign` is a versatile validation module within the Veive protocol, designed to handle multi-signature validation scenarios. This module can be applied in various contexts, such as wallet multi-ownership and account recovery, by utilizing a set of designated signatories known as "guardians." Its flexibility allows the module to support different use cases depending on the scope in which it is installed. The module is agnostic to the signature method, meaning guardians can use different signing methods without affecting the module's functionality.

### **Purpose**

The primary function of `ModValidationMultisign` is to validate operations by requiring multiple signatures from designated guardians. This feature is crucial for scenarios such as:

1. **Account Multi-ownership**: In this context, the module ensures that all owners (guardians) must approve transactions. By installing the module in the `entry_point=allow` scope, every operation requires pre-authorization from all guardians, providing a robust layer of security.
2. **Account Recovery**: The module can also be used to recover access to an account. If the primary owner loses access, the guardians can authorize the installation or removal of modules (such as replacing a lost device's public key in a WebAuthn module). This is achieved by configuring the module to validate operations in the `install_module` and `uninstall_module` scopes.

#### **Guardian Management and Thresholds**

* **Guardians**: Guardians are designated signatories who can validate operations. The module includes functions to add or remove guardians, making it adaptable to changing security needs.
* **Threshold**: A key feature is the ability to set a threshold, determining how many guardian signatures are required to validate an operation. This threshold can be configured for different security levels, allowing for scenarios where, for example, only a subset of guardians is needed to authorize an action.
