mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
fix(storage): let a Blossom-only (keyless) account sync across devices
importAccountRecord hard-required encryptedMasterKey, but a Blossom-only account is keyless (no encrypted payloads) and legitimately has none — so its synced record failed to import. Require the envelope ONLY when the record carries an encrypted connection that actually needs it to unlock. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
ef2e48912d
commit
51072e4871
2 files changed
+55
-1
No files matched your search
@@ -735,7 +735,21 @@ export class StorageService {
|
||||
if (!pubkey) {
|
||||
throw new Error("Pubkey required to import storage account record.");
|
||||
}
|
||||
if (!record || typeof record !== "object" || !record.encryptedMasterKey) {
|
||||
if (!record || typeof record !== "object") {
|
||||
throw new Error("Invalid storage account record.");
|
||||
}
|
||||
// A Blossom-only account is keyless (no encrypted payloads), so it legitimately
|
||||
// has no encryptedMasterKey. Require the envelope ONLY when the record actually
|
||||
// carries an encrypted connection that would need it to unlock — otherwise a
|
||||
// Blossom-only account can't sync across devices.
|
||||
const connections =
|
||||
record.connections && typeof record.connections === "object"
|
||||
? record.connections
|
||||
: {};
|
||||
const hasEncryptedConnection = Object.values(connections).some(
|
||||
(conn) => conn && conn.encrypted != null,
|
||||
);
|
||||
if (hasEncryptedConnection && !record.encryptedMasterKey) {
|
||||
throw new Error("Invalid storage account record.");
|
||||
}
|
||||
const toSave = { ...record, pubkey };
|
||||
|
||||
Reference in new issue
Block a user