[PM-42197] feat: Thread encryptedByKeyId through cipher requests - #2987
Conversation
…add userKeyId to decryption response
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR threads the SDK's Code Review DetailsNo findings. Verified during this pass: the Minor, not posted inline: the request-level initializers ( |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2987 +/- ##
==========================================
+ Coverage 79.51% 81.80% +2.28%
==========================================
Files 1169 1046 -123
Lines 75029 67798 -7231
==========================================
- Hits 59660 55461 -4199
+ Misses 15369 12337 -3032 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-42197
📔 Objective
The SDK's
EncryptionContextnow exposesencryptedByKeyId: String?— the hex-encoded ID ofthe specific key used to encrypt a vault item (nil for legacy V1 AES-CBC-HMAC ciphers).
This PR threads that field through the entire cipher-request call chain wherever
encryptedForis already passed:
CipherRequestModel— newencryptedByKeyId: String?property serialized in JSONCipherCreateRequestModel,BulkShareCiphersRequestModel— forwarded toCipherRequestModelAddCipherRequest,AddCipherWithCollectionsRequest,UpdateCipherRequest,ShareCipherRequest,BulkShareCiphersRequest)CipherAPIServiceprotocol +APIServiceimplementationCipherServiceprotocol +DefaultCipherServiceimplementationCipherEncryptionMediator— reads fromEncryptionContext.encryptedByKeyIdVaultRepository— passes through foraddCipher,updateCipher,shareCipher,bulkShareCiphersFido2CredentialStoreService— passes through for both add and update pathsAlso adds
userKeyId: String?toUserDecryptionResponseModel(groundwork for a follow-upthat will consume the server's active key ID in the decryption response).