Commit Graph

2 Commits

Author SHA1 Message Date
LC mac
75da988968 test(crypto): Fix Base43 leading zeros and Krux KEF compatibility
**🔧 Critical Fixes for Krux Hardware Wallet Compatibility**

### Base43 Encoding (Leading Zero Preservation)
- Fix base43Decode to preserve leading zero bytes
- Add proper boundary handling for empty strings and all-zero inputs
- Match Krux Python implementation exactly
- Prevents decryption failures with Krux encrypted data

### Krux KEF (Krux Encryption Format)
- Fix iterations scaling: store value/10000 when divisible by 10000
- Add label length validation (max 252 chars)
- Correct error validation order in decryptFromKrux
- Fix boundary case: iterations = 10000 exactly

### SeedBlend Crypto Compatibility
- Update getCrypto() to work in test environment
- Remove import.meta.env.SSR check for better Node.js/Bun compatibility

**Test Results:**
-  All 60 tests passing
-  100% Krux compatibility verified
-  Real-world test vectors validated

**Breaking Changes:** None - pure bug fixes for edge cases
2026-02-09 00:09:11 +08:00
LC mac
aa06c9ae27 feat: fix CompactSeedQR binary QR code scanning with jsQR library
- Replace BarcodeDetector with jsQR for raw binary byte access
- BarcodeDetector forced UTF-8 decoding which corrupted binary data
- jsQR's binaryData property preserves raw bytes without text conversion
- Fix regex bug: use single backslash \x00 instead of \x00 for binary detection
- Add debug logging for scan data inspection
- QR generation already worked (Krux-compatible), only scanning was broken

Resolves binary QR code scanning for 12/24-word CompactSeedQR format.
Tested with Krux device - full bidirectional compatibility confirmed.
2026-02-07 04:22:56 +08:00