Skip to content

Commit 347279a

Browse files
authored
Empty AccountKeys when no private key (#6761)
Co-authored-by: Timshel <timshel@users.noreply.github.com>
1 parent 7f65a25 commit 347279a

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/api/identity.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,14 +482,18 @@ async fn authenticated_response(
482482
Value::Null
483483
};
484484

485-
let account_keys = json!({
486-
"publicKeyEncryptionKeyPair": {
487-
"wrappedPrivateKey": user.private_key,
488-
"publicKey": user.public_key,
489-
"Object": "publicKeyEncryptionKeyPair"
490-
},
491-
"Object": "privateKeys"
492-
});
485+
let account_keys = if user.private_key.is_some() {
486+
json!({
487+
"publicKeyEncryptionKeyPair": {
488+
"wrappedPrivateKey": user.private_key,
489+
"publicKey": user.public_key,
490+
"Object": "publicKeyEncryptionKeyPair"
491+
},
492+
"Object": "privateKeys"
493+
})
494+
} else {
495+
Value::Null
496+
};
493497

494498
let mut result = json!({
495499
"access_token": auth_tokens.access_token(),

0 commit comments

Comments
 (0)