1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

[PM-19479] Client-Managed SDK state definition (#14839)

* [PM-19479] Client-Managed SDK state definition

* Remove test code

* Update based on latest sdk

* Add DB config

* Remove uuid conversion step

* Move mapper into separate file

* Revert to client managed state

* Move mapper to Cipher

* Typo

---------

Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.com>
This commit is contained in:
Daniel García
2025-08-22 14:21:52 +02:00
committed by GitHub
parent 7aca0cdbd7
commit 12df7def61
6 changed files with 99 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { SdkRecordMapper } from "@bitwarden/common/platform/services/sdk/client-managed-state";
import { UserKeyDefinition } from "@bitwarden/common/platform/state";
import { Cipher as SdkCipher } from "@bitwarden/sdk-internal";
import { ENCRYPTED_CIPHERS } from "../../services/key-state/ciphers.state";
import { CipherData } from "../data/cipher.data";
import { Cipher } from "./cipher";
export class CipherRecordMapper implements SdkRecordMapper<CipherData, SdkCipher> {
userKeyDefinition(): UserKeyDefinition<Record<string, CipherData>> {
return ENCRYPTED_CIPHERS;
}
toSdk(value: CipherData): SdkCipher {
return new Cipher(value).toSdkCipher();
}
fromSdk(value: SdkCipher): CipherData {
throw new Error("Cipher.fromSdk is not implemented yet");
}
}