feat: add function to export portable backup settings envelope

This commit is contained in:
shuaiplus
2026-05-07 19:23:22 +08:00
parent 97d2117e15
commit 669d7ef242
2 changed files with 37 additions and 2 deletions
+14
View File
@@ -155,6 +155,20 @@ export function parseBackupSettingsEnvelope(raw: string | null): BackupSettingsE
}
}
export function exportPortableBackupSettingsEnvelope(raw: string | null): string | null {
const envelope = parseBackupSettingsEnvelope(raw);
if (!envelope) return null;
return JSON.stringify({
version: 2,
portableOnly: true,
runtime: {
iv: '',
ciphertext: '',
},
portable: envelope.portable,
});
}
export async function encryptBackupSettingsEnvelope(
plaintext: string,
env: Env,