From f8e2367c8c51d4e704f9006cb3b8021f8cc15593 Mon Sep 17 00:00:00 2001 From: Timshel Date: Mon, 2 Feb 2026 05:35:22 +0800 Subject: [PATCH] Empty AccountKeys when no private key (#6761) Co-authored-by: Timshel --- src/api/identity.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/api/identity.rs b/src/api/identity.rs index cca87ea0..6d567599 100644 --- a/src/api/identity.rs +++ b/src/api/identity.rs @@ -487,14 +487,18 @@ async fn authenticated_response( Value::Null }; - let account_keys = json!({ - "publicKeyEncryptionKeyPair": { - "wrappedPrivateKey": user.private_key, - "publicKey": user.public_key, - "Object": "publicKeyEncryptionKeyPair" - }, - "Object": "privateKeys" - }); + let account_keys = if user.private_key.is_some() { + json!({ + "publicKeyEncryptionKeyPair": { + "wrappedPrivateKey": user.private_key, + "publicKey": user.public_key, + "Object": "publicKeyEncryptionKeyPair" + }, + "Object": "privateKeys" + }) + } else { + Value::Null + }; let mut result = json!({ "access_token": auth_tokens.access_token(),