1. Getting Started
Get up and running with wFabricSecurity in minutes.
2. Prerequisites
Before installing wFabricSecurity, ensure you have:
Requirement |
Description |
|---|---|
Python |
Version 3.10 or higher |
pip |
Latest version recommended |
Operating System |
Linux, macOS, or Windows |
Verify your Python installation:
python --version
# Should show: Python 3.10.x or higher
pip --version
# Should show: pip 22.x or higher
3. Installation
The recommended way to install wFabricSecurity is via pip:
pip install wFabricSecurity
For development or to install from source:
# Clone the repository
git clone https://github.com/wisrovi/wFabricSecurity.git
cd wFabricSecurity
# Install in development mode
pip install -e .
# Or install with dev dependencies
pip install -e ".[dev]"
4. Verification
Verify the installation was successful:
import wFabricSecurity
print(f"wFabricSecurity version: {wFabricSecurity.__version__}")
Or run a quick test:
python -c "from wFabricSecurity import FabricSecurity; print('✓ Installation successful!')"
4.1. Quick Start
Get started with wFabricSecurity in three simple steps:
4.1.1. Step 1: Basic Initialization
from wFabricSecurity import FabricSecuritySimple
# Initialize the security system
security = FabricSecuritySimple(
msp_path="/path/to/your/msp"
)
print("✓ Security system initialized!")
4.1.2. Step 2: Verify a Message
from wFabricSecurity import FabricSecuritySimple
security = FabricSecuritySimple(msp_path="/path/to/msp")
# Verify an incoming message
result = security.verify_and_process(
payload='{"action": "process_data", "id": "12345"}',
sender="CN=Master"
)
if result:
print("✓ Message verified and processed!")
else:
print("✗ Verification failed!")
4.1.3. Step 3: Create Secure Communication
from wFabricSecurity import FabricSecurity
from wFabricSecurity.fabric_security.core.enums import CommunicationDirection
# Full initialization
security = FabricSecurity(
me="Master",
msp_path="/path/to/msp"
)
# Register identity
security.register_identity()
# Define communication permissions
security.register_communication(
from_participant="CN=Master",
to_participant="CN=Slave",
direction=CommunicationDirection.BIDIRECTIONAL
)
# Create a signed message
message = security.create_message(
recipient="CN=Slave",
content='{"operation": "process_data"}'
)
print(f"✓ Message created: {message}")
5. Complete Example
A full working example:
"""
wFabricSecurity Quick Start Example
Complete demonstration of Zero Trust security features.
"""
from wFabricSecurity import FabricSecurity
from wFabricSecurity.fabric_security.core.enums import CommunicationDirection
from wFabricSecurity.fabric_security.core.exceptions import (
CodeIntegrityError,
PermissionDeniedError
)
def main():
# Initialize security system
security = FabricSecurity(
me="Master",
msp_path="/path/to/msp"
)
# 1. Register identity
print("1. Registering identity...")
security.register_identity()
print(f" ✓ Identity registered: {security.me}")
# 2. Register code integrity
print("2. Registering code integrity...")
security.register_code(
files=["main.py", "utils.py"],
version="1.0.0"
)
print(" ✓ Code integrity registered")
# 3. Set up communication permissions
print("3. Configuring permissions...")
security.register_communication(
"CN=Master",
"CN=Slave",
CommunicationDirection.BIDIRECTIONAL
)
print(" ✓ Communication permissions configured")
# 4. Create and send a message
print("4. Creating signed message...")
message = security.create_message(
recipient="CN=Slave",
content='{"operation": "process_data", "payload": "test"}'
)
print(f" ✓ Message created: {message.sender} -> {message.recipient}")
# 5. Verify the message
print("5. Verifying message...")
if security.verify_message(message):
print(" ✓ Message verified successfully!")
else:
print(" ✗ Verification failed!")
print("\n" + "="*50)
print("✓ All operations completed successfully!")
print("="*50)
if __name__ == "__main__":
main()
5.1. Next Steps
Now that you have wFabricSecurity installed, explore these resources:
Step-by-step guides for common use cases.
Complete documentation of all classes and methods.
System architecture and design patterns.
Answers to common questions.
See also
Installation - Detailed installation instructions
usage - Usage examples and patterns
Tutorials - Step-by-step tutorials