@quantabit/encrypted-storage-sdk
v1.0.0
Published
QuantaBit Encrypted Storage SDK - Client-side PBKDF2/AES-GCM vault with optional ciphertext backup
Downloads
89
Maintainers
Readme
@quantabit/encrypted-storage-sdk
客户端加密存储(非假链上)。密钥派生与加解密均在本地完成,明文密码永不离开客户端。
安全模型
deriveKey/encryptJson/decryptJson/saveSecure/loadSecure全部在客户端执行- 可选云端备份仅上传密文:
backupEncryptedBlob→POST /vault/backup - 恢复仅拉取密文:
restoreEncryptedBlob→GET /vault/restore - 禁止把明文密码 POST 到服务器
Usage
import {
encryptJson,
decryptJson,
saveSecure,
loadSecure,
backupEncryptedBlob,
restoreEncryptedBlob,
} from '@quantabit/encrypted-storage-sdk';
const sealed = await encryptJson({ note: 'secret' }, 'user-password');
const opened = await decryptJson(sealed, 'user-password');
await saveSecure('profile', { email: '[email protected]' }, 'user-password');
const profile = await loadSecure('profile', 'user-password');
// Optional: ciphertext-only backup (password stays local)
await backupEncryptedBlob({ id: 'user-1', blob: sealed });
const remote = await restoreEncryptedBlob({ id: 'user-1' });底层优先使用 Web Crypto PBKDF2 + AES-GCM;无 crypto.subtle 时回退到 Node crypto。
MIT
