Send null org key for unconfirmed members in sync (#7850)

Since #7666 the sync profile's `organizationsNew` also lists Accepted
(not yet confirmed) memberships. Their `akey` is still empty, so the
response contained `"key": ""`, whereas upstream sends `null` until the
member is confirmed.

Bitwarden Android 2026.9 prefers `organizationsNew` and only skips
organizations whose key is null. The empty string is handed to the SDK,
which rejects it ("Invalid asymmetric type, got type 0 with 1 parts"),
so the whole `initializeOrgCrypto` call fails: none of the user's
organization keys are loaded and every organization item and collection
fails to decrypt on that device.

Send null for an empty key, matching upstream and the existing handling
of the user key in `GET /api/accounts/keys`.


Claude-Session: https://claude.ai/code/session_011UHYQWTz2PkXSCfucaRMZB

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MinchinWebandClaude Opus 5.5 authored and GitHub committed 2026-10-25 16:49:02 +01:00
1 parent b71cb7a832
commit c925c04de0
1 file changed
+2 -1
+2 -1
View File
@@ -523,7 +523,8 @@ impl Membership {
// These are per user // These are per user
"userId": self.user_uuid, "userId": self.user_uuid,
"key": self.akey, // Accepted (not yet confirmed) members have no key yet; send null like upstream, not ""
"key": (!self.akey.is_empty()).then_some(&self.akey),
"status": self.status, "status": self.status,
"type": membership_type, "type": membership_type,
"enabled": true, "enabled": true,