Expand description
Passkey encryption for Webcash wallets
This module provides state-of-the-art passkey encryption functionality for Webcash wallets, supporting both iOS (Face ID/Touch ID) and Android (Passkey API) platforms.
§Security Architecture
The passkey encryption system follows these principles:
- Key Isolation: Encryption keys are protected by platform hardware security modules
- Zero Secrets: Passkey data never leaves the device’s secure enclave
- Forward Secrecy: Keys are regenerated when passkey enrollment changes
- Defense in Depth: Multiple layers of encryption and authentication
§Implementation Strategy
§iOS Integration
- Uses iOS Keychain Services with
kSecAccessControland.biometryAnyflags - Leverages Secure Enclave for key storage and passkey verification
- Supports both Face ID and Touch ID seamlessly
- Falls back to device passcode when passkeys unavailable
§Android Integration
- Uses Android Keystore with passkey authentication requirements
- Supports fingerprint, face unlock, and iris scanning
- Integrates with Android Credential Manager API for unified experience
- Hardware security module protection when available
§Usage Patterns
use webylib::passkey::{PasskeyEncryption, EncryptionConfig};
// Initialize with platform-specific configuration
let mut passkey = PasskeyEncryption::new(EncryptionConfig::default())?;
// Encrypt wallet with passkey protection
let wallet_data = b"wallet data";
let encrypted_data = passkey.encrypt_with_passkey(wallet_data).await?;
// Decrypt wallet (triggers passkey prompt)
let decrypted_data = passkey.decrypt_with_passkey(&encrypted_data).await?;Structs§
- Encrypted
Data - Encrypted data container with metadata
- Encryption
Config - Configuration for passkey encryption
- Encryption
Metadata - Encryption metadata (non-sensitive information)
- KdfParams
- Key derivation parameters
- Passkey
Encryption - Main passkey encryption interface
Functions§
- decrypt_
with_ password - Decrypt data with a password-based key
- encrypt_
with_ password - Encrypt data with a password-based key (fallback when passkeys unavailable).