@veive-io/mod-validation-as
v1.0.0
Published
Veive smart account validation module
Downloads
8
Readme
Mod Validation
Overview
mod-validation-as
is a foundational library in the Veive protocol, designed to support the creation and integration of validation modules. These modules are essential for verifying the authenticity and authorization of operations within smart accounts on the Koinos blockchain. This library provides the necessary tools and interfaces to develop robust validation logic, ensuring that only valid and authorized operations are executed.
Components and Functional Description
The mod-validation-as
library offers several key components and tools that facilitate the development and integration of validation modules:
1. IModValidation
Interface
- Description: This interface defines the standard for external interactions with validation modules. It is typically used by the
account-as
module to communicate with and utilize the capabilities of validation modules. - Purpose: The
IModValidation
interface ensures that all validation modules adhere to a consistent protocol for operation validation, installation, and uninstallation processes. - Use Case: When a smart account needs to validate an operation, it uses the
IModValidation
interface to invoke the appropriate methods on the validation module, ensuring the operation meets the required criteria.
2. ModValidation
Class
- Description: The
ModValidation
class serves as the base class for all validation modules. Developers extend this class to create custom validation modules that implement specific validation logic. - Key Methods:
is_valid_operation
: This method should be overridden to implement the specific validation logic required by the module. It is called to verify if an operation meets the necessary criteria for execution.on_install
andon_uninstall
: These methods handle the setup and teardown of the module, respectively, ensuring that any necessary resources are initialized or cleaned up.
- Use Case: A developer creating a new validation module will extend the
ModValidation
class and override its methods to define custom validation rules, such as checking for specific signatures or ensuring compliance with particular policies.
3. modvalidation
Proto
- Description: This protocol buffer (proto) provides the data structures necessary for defining and transmitting data related to validation modules.
- Purpose: The
modvalidation
proto standardizes the format and structure of data exchanged between the smart account and validation modules, facilitating smooth communication and integration. - Components:
- Data Structures: Includes various data types and structures used for defining validation rules, operation details, and module metadata.
Usage and Integration
Integration in the Veive Protocol
The mod-validation-as
library plays a crucial role in the Veive protocol's modular architecture. It integrates closely with the account-as
module, allowing smart accounts to utilize validation modules to ensure that all operations are properly authorized and adhere to the set rules.
Flow Integration:
- The
IModValidation
interface and theModValidation
class enable seamless communication and interaction between smart accounts and validation modules. This integration ensures that validation checks are performed whenever an operation is initiated, maintaining the integrity and security of the system.
Development and Customization:
- Developers can extend the
ModValidation
class to create custom validation modules tailored to specific use cases, such as checking for multi-signature requirements, enforcing transaction limits, or integrating with external authentication systems.
Scripts
Build
To compile the package, run:
yarn build
Contributing
Contributions are welcome! Please open an issue or submit a pull request on the GitHub repository.
License
This project is licensed under the MIT License. See the LICENSE file for details.