1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-31 00:33:33 +00:00

WIP: Adds admin call to edit ciphers with SDK

This commit is contained in:
Nik Gilmore
2025-12-16 12:34:28 -08:00
parent 95ae6a7a2c
commit 97b167a405
3 changed files with 8 additions and 6 deletions

3
.npmrc
View File

@@ -1,4 +1 @@
save-exact=true
# Increase available heap size to avoid running out of memory when compiling.
# This applies to all npm scripts in this repository.
node-options=--max-old-space-size=8192

View File

@@ -65,7 +65,7 @@ export enum FeatureFlag {
RiskInsightsForPremium = "pm-23904-risk-insights-for-premium",
VaultLoadingSkeletons = "pm-25081-vault-skeleton-loaders",
BrowserPremiumSpotlight = "pm-23384-browser-premium-spotlight",
SdkCipherOperations = "use_sdk_cipher_operations", // TODO: Create & use a real feature flag.
SdkCipherOperations = "use-sdk-cipher-operations", // TODO: Create & use a real feature flag.
MigrateMyVaultToMyItems = "pm-20558-migrate-myvault-to-myitems",
/* Platform */

View File

@@ -968,8 +968,10 @@ export class CipherService implements CipherServiceAbstraction {
);
if (sdkCipherEncryptionEnabled) {
console.log("USING THE SDK!");
return await this.updateWithServer_sdk(cipherView, userId, orgAdmin);
} else {
console.log("NOT using the SDK!");
const encrypted = await this.encrypt(cipherView, userId);
const updatedCipher = await this.updateWithServer_legacy(encrypted, orgAdmin);
const updatedCipherView = this.decrypt(updatedCipher, userId);
@@ -992,8 +994,11 @@ export class CipherService implements CipherServiceAbstraction {
const sdkUpdateRequest = cipher.toSdkUpdateCipherRequest();
let result: SdkCipherView;
if (orgAdmin) {
// TODO: Need to expose ciphers admin client in SDK
result = await ref.value.vault().ciphers().edit(sdkUpdateRequest);
result = await ref.value
.vault()
.ciphers()
.admin()
.edit(sdkUpdateRequest, cipher.toSdkCipherView());
} else {
result = await ref.value.vault().ciphers().edit(sdkUpdateRequest);
}