sal/examples/hero_vault/README.md
Mahmoud-Emad 6e5d9b35e8 feat: Update SAL Vault examples and documentation
- Renamed examples directory to `_archive` to reflect legacy status.
- Updated README.md to reflect current status of vault module,
  including migration from Sameh's implementation to Lee's.
- Temporarily disabled Rhai scripting integration for the vault.
- Added notes regarding current and future development steps.
2025-07-10 14:03:43 +03:00

2.8 KiB

SAL Vault Examples

This directory contains examples demonstrating the SAL Vault functionality.

Overview

SAL Vault provides secure key management and cryptographic operations including:

  • Vault creation and management
  • KeySpace operations (encrypted key-value stores)
  • Symmetric key generation and operations
  • Asymmetric key operations (signing and verification)
  • Secure key derivation from passwords

Current Status

⚠️ Note: The vault module is currently being updated to use Lee's implementation. The Rhai scripting integration is temporarily disabled while we adapt the examples to work with the new vault API.

Available Operations

  • Vault Management: Create and manage vault instances
  • KeySpace Operations: Open encrypted key-value stores within vaults
  • Symmetric Encryption: Generate keys and encrypt/decrypt data
  • Asymmetric Operations: Create keypairs, sign messages, verify signatures

Example Files (Legacy - Sameh's Implementation)

⚠️ These examples are currently archived and use the previous vault implementation:

  • _archive/example.rhai - Basic example demonstrating key management, signing, and encryption
  • _archive/advanced_example.rhai - Advanced example with error handling and complex operations
  • _archive/key_persistence_example.rhai - Demonstrates creating and saving a key space to disk
  • _archive/load_existing_space.rhai - Shows how to load a previously created key space
  • _archive/contract_example.rhai - Demonstrates smart contract interactions (Ethereum)
  • _archive/agung_send_transaction.rhai - Demonstrates Ethereum transactions on Agung network
  • _archive/agung_contract_with_args.rhai - Shows contract interactions with arguments

Current Implementation (Lee's Vault)

The current vault implementation provides:

// Create a new vault
let vault = Vault::new(&path).await?;

// Open an encrypted keyspace
let keyspace = vault.open_keyspace("my_space", "password").await?;

// Perform cryptographic operations
// (API documentation coming soon)

Migration Status

  • Vault Core: Lee's implementation is active
  • Archive: Sameh's implementation preserved in vault/_archive/
  • Rhai Integration: Being developed for Lee's implementation
  • Examples: Will be updated to use Lee's API
  • Ethereum Features: Not available in Lee's implementation

Security

The vault uses:

  • ChaCha20Poly1305 for symmetric encryption
  • Password-based key derivation for keyspace encryption
  • Secure key storage with proper isolation

Next Steps

  1. Rhai Integration: Implement Rhai bindings for Lee's vault
  2. New Examples: Create examples using Lee's simpler API
  3. Documentation: Complete API documentation for Lee's implementation
  4. Migration Guide: Provide guidance for users migrating from Sameh's implementation