mirror of
https://github.com/bitwarden/browser
synced 2026-02-08 20:50:28 +00:00
WIP: Changes to how ciphers are replaced when migrating with SDK
This commit is contained in:
@@ -384,27 +384,28 @@ export class Cipher extends Domain implements Decryptable<CipherView> {
|
||||
// version: 1,
|
||||
data: typeof this.data === "string" ? this.data : JSON.stringify(this.data),
|
||||
};
|
||||
console.log("Cipher toSdkCipher data:", sdkCipher.data, ". \n\n\nIt is of type ", typeof this.data);
|
||||
|
||||
|
||||
// switch (this.type) {
|
||||
// case CipherType.Login:
|
||||
// sdkCipher.login = this.login.toSdkLogin();
|
||||
// break;
|
||||
// case CipherType.SecureNote:
|
||||
// sdkCipher.secureNote = this.secureNote.toSdkSecureNote();
|
||||
// break;
|
||||
// case CipherType.Card:
|
||||
// sdkCipher.card = this.card.toSdkCard();
|
||||
// break;
|
||||
// case CipherType.Identity:
|
||||
// sdkCipher.identity = this.identity.toSdkIdentity();
|
||||
// break;
|
||||
// case CipherType.SshKey:
|
||||
// sdkCipher.sshKey = this.sshKey.toSdkSshKey();
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
switch (this.type) {
|
||||
case CipherType.Login:
|
||||
sdkCipher.login = this.login.toSdkLogin();
|
||||
break;
|
||||
case CipherType.SecureNote:
|
||||
sdkCipher.secureNote = this.secureNote.toSdkSecureNote();
|
||||
break;
|
||||
case CipherType.Card:
|
||||
sdkCipher.card = this.card.toSdkCard();
|
||||
break;
|
||||
case CipherType.Identity:
|
||||
sdkCipher.identity = this.identity.toSdkIdentity();
|
||||
break;
|
||||
case CipherType.SshKey:
|
||||
sdkCipher.sshKey = this.sshKey.toSdkSshKey();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return sdkCipher;
|
||||
}
|
||||
|
||||
@@ -1133,12 +1133,14 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
cipherObjects,
|
||||
userId,
|
||||
));
|
||||
// migratedCiphers.forEach((c) => (ciphers[c.id] = c.toCipherData()));
|
||||
migratedCiphers.forEach((c) => (ciphers[c.id] = ciphers[c.id]));
|
||||
// TODO: Something here broke loading my ciphers... need to investigate.
|
||||
const res = await this.updateEncryptedCipherState((current) => {
|
||||
migratedCiphers.forEach((c) => (current[c.id as CipherId] = c.toCipherData()));
|
||||
return current;
|
||||
}, userId);
|
||||
|
||||
console.log("REPLAZCE: Replacing all ciphers for user", userId);
|
||||
console.log("== Replacing all ciphers for user", userId);
|
||||
|
||||
await this.updateEncryptedCipherState(() => ciphers, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user