-
-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting default secret storage key id to null #4615
Allow setting default secret storage key id to null #4615
Conversation
a20b352
to
1091e68
Compare
defaultKeyId
of the secret storage can be set at null6e70dd0
to
3f51d8e
Compare
3f51d8e
to
9c5504a
Compare
// https://spec.matrix.org/v1.13/client-server-api/#key-storage | ||
// To delete the default key, we send an empty object like the rust sdk does | ||
// (see https://docs.rs/matrix-sdk/latest/matrix_sdk/encryption/recovery/struct.Recovery.html#method.reset_identity) | ||
const newValue: Record<string, never> | { key: string } = keyId === null ? {} : { key: keyId }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit surprised the explicit type is needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inferred type doesn't work really well here:
const newValue: { key?: undefined } | { key: string }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd likely work fine as const
or inline in the setAccountData
call
80a0981
to
2d4a1d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm otherwise
…be set at `null` in order to delete an exising recovery key
2d4a1d1
to
1e0cce2
Compare
Checklist
public
/exported
symbols have accurate TSDoc documentation.Task element-hq/element-web#28977
The goal is to be able to remove the current recovery key.
The spec expects a string for the key however the rust sdk replaces the content of
m.secret_storage.default_key
with an empty object({}
). We went with the same strategy to keep it consistent.Also, the
MatrixClient
already authorises to set the account data with an empty object.matrix-js-sdk/src/client.ts
Lines 4233 to 4244 in 07f97d7