feat(browser): Implement fallback SHA256 for non-HTTPS environments and enhance browser tests for consistent hashing

This commit is contained in:
Juergen Kunz
2025-06-19 23:03:36 +00:00
parent 0bae2d6eec
commit 23ad99d0e2
7 changed files with 250 additions and 10 deletions

View File

@ -37,4 +37,9 @@ Merge the functionality from @push.rocks/isohash into @push.rocks/smarthash to p
- The web version uses native Web Crypto API for performance
- The Node.js version continues using the existing crypto implementation
- API remains consistent across both environments
- No breaking changes to existing smarthash functionality
- No breaking changes to existing smarthash functionality
## Additional Features Implemented
- **Fallback for non-HTTPS environments**: Added pure JavaScript SHA256 implementation that automatically activates when crypto.subtle is not available (e.g., HTTP or file:// protocols)
- **Comprehensive browser tests**: Created test.browser.ts with specific browser environment tests
- **Cross-environment consistency**: Ensured hash outputs match across Node.js and browser implementations