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:
22
libs/common/src/vault/models/domain/cipher-sdk-mapper.ts
Normal file
22
libs/common/src/vault/models/domain/cipher-sdk-mapper.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user