6 Commits
Author SHA1 Message Date
Suzu008 a58a5b8917 refactor(sw): bidirectional SW status sync with IndexedDB persistence
Replace fire-and-forget key delivery with a sync-status protocol that
verifies key consistency between main thread and Service Worker using
SHA-256 fingerprints via MessageChannel request-response.

- SW (ts/sw.ts): persist keys in IndexedDB, auto-restore on activate;
  respond to sync-status queries with loaded keys + fingerprints;
  support cryptio-clear-keys to wipe memory + DB.
- New ts/utils/swSync.ts: single entry point for SW registration,
  key sync, and status verification. Controller change listener
  re-syncs on SW restart. Deduplicates concurrent sync calls.
- Deleted ts/utils/swKeySender.ts (replaced by swSync.ts).
- Remove SW registration (~55 lines) from cryptioSaveImage.ts;
  setup() now calls syncSWStatus().
- uploadUtils.ts: drop 5-retry preview loop (~6.4s worst case);
  single attempt with syncSWStatus fallback on failure.
- cryptioSettings.ts: sync after key changes; clearSWKeys() on
  Clear All.
- cryptioUploadImage/Video.ts: syncSWStatus in setup + preview
  fallback.
- types.ts: add SWStatus interface.
2026-05-30 22:29:45 +08:00
Suzu008 4e0bfdd82e refactor: extract duplicated code into shared modules (videoWidgetUtils, uploadUtils, fileUtils) 2026-03-24 08:53:08 +08:00
Suzu008 0a29b74d66 refactor: replace new Uint8Array() re-wrap with 'as BlobPart' type assertion 2026-03-24 08:33:08 +08:00
Suzu008 b809568a75 refactor(crypto): 优化加密功能并添加base64工具
- 重命名加密函数以更准确反映用途
- 提取base64转换逻辑到独立工具文件
- 简化文本加密流程,移除冗余代码
2025-10-12 12:26:43 +08:00
Suzu008 6ed9ea5b1f refactor(crypto): 重构加密模块以支持不同密钥场景
- 将通用加密解密逻辑提取为内部函数
- 添加针对不同场景的加密解密方法(服务端/客户端密钥)
- 更新相关调用代码以使用新的加密方法
- 改进注释和类型定义
2025-10-12 07:04:20 +08:00
Suzu008 05ac7e0542 refactor(utils): 重构加密文件处理工具模块
将加密文件处理相关功能拆分为独立工具模块,包括文件工具、上传工具、图片加载工具和加密工具

重构 cryptioSaveImage.ts 和 cryptioUploadImage.ts,使用新的工具模块替换原有代码
2025-10-12 06:34:57 +08:00