-
Notifications
You must be signed in to change notification settings - Fork 216
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
Fix | Share room keys with dehydrated devices with rust stack #1858
Conversation
I have been testing this PR against a local Web instance running on a synapse with |
/** | ||
The device keys per devices per users. | ||
*/ | ||
@property (nonatomic) NSDictionary<NSString *, id> *deviceKeys; |
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.
In the existing MXKeysQueryResponse this was a MXUsersDevicesMap<MXDeviceInfo*> *deviceKeys
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.
Looks like a sensible approach to me, I trust you that you tested it and it works properly 😉
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 don't understand the code, but looks plausible.
/** | ||
Cross-signing keys per users. | ||
*/ | ||
@property (nonatomic) NSDictionary<NSString*, MXCrossSigningInfo*> *crossSigningKeys; |
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.
How easy would it be to do the same thing to the cross-signing keys, because we'll have the same problem here. If it's easy, may as well do it while we're touching the code here.
Pull Request Checklist
Fixes element-hq/element-ios#7795
The new MSC3814matrix-org/matrix-spec-proposals#3814 is introducing a new format for dehydrated devices (to get messages even if all your sessions are logged out).
As per the new format, the DeviceKey payload from a keys/query call now contains a new boolean field
dehydrated
, that is used when computing the signature.The problem is that the SDK converts the http response to a JSON Model
MXKeysQueryResponse
and this model was not aware of that field. As a consequence when passing back the response to rust viamarkRequestAsSent
usingmodel.jsonString()
, thedehydrated
field was dropped, thus the rust layer was refusing the device because the signature was invalid.First approach would be to add the
dehydrated
field to the model, but this is not very future proof as any new future field would cause the same problem.The rust crypto stack also just pass this payload and is not using it (the legacy stack neeeded the typed model).
Unfortunatly I cannot just modify the existing model to just use a generic Dictionnary because some parts of the sdk for the legacy crypto still needed it.
So I created a new
MXKeysQueryResponseRaw
almost similar to the existingMXKeysQueryResponse
, but that is not trying to convert the device info to a typed model. This is now used by the rust layer to query and pass back to the olm machine.