-
-
Notifications
You must be signed in to change notification settings - Fork 618
Enable key upload to backups where we have the decryption key #4677
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
Conversation
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.
Putting this on hold while we try to understand what bug it is trying to fix, per #4676 (comment).
In any case, we'll need to see an integration test which demonstrates the problem.
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.
ok, the fix looks like it makes sense, but the main thing this is missing is a regression test.
Please could you take a look at matrix-js-sdk/spec/integ/crypto/megolm-backup.spec.ts
. In there there are some existing tests for checkKeyBackupAndEnable
: please could you take a look at them and see if you can add another which covers your usecase.
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 generally good to me, thanks.
A few minor requests.
Co-authored-by: Richard van der Hoff <[email protected]>
Co-authored-by: Richard van der Hoff <[email protected]>
Co-authored-by: Richard van der Hoff <[email protected]>
Co-authored-by: Richard van der Hoff <[email protected]>
// We are lacking a way to signal that the secret has been received, so we wait a bit.. | ||
jest.useRealTimers(); | ||
await new Promise((resolve) => { | ||
setTimeout(resolve, 500); | ||
}); | ||
jest.useFakeTimers({ doNotFake: ["queueMicrotask"] }); | ||
|
||
// the backup secret should not be cached | ||
const cachedKey = await aliceClient.getCrypto()!.getSessionBackupPrivateKey(); | ||
expect(cachedKey).toBeNull(); |
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 might be nice to factor the 5 copies of this code out to a helper function, but I'll not insist
@@ -1338,7 +1383,7 @@ describe("verification", () => { | |||
async function sendBackupGossipAndExpectVersion( | |||
requestId: string, | |||
secret: string, | |||
expectBackup: KeyBackupInfo, | |||
expectBackup?: KeyBackupInfo | { errcode?: string; error?: 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.
could you document the behavior of expectBackup
? What does it mean if it is undefined
, what if it has an errcode
, etc?
Co-authored-by: Richard van der Hoff <[email protected]>
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.
Nearly there I think!
errcode: "M_NOT_FOUND", | ||
error: "No backup found", | ||
}, | ||
401, |
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.
shouldn't this be a 404?
new MatrixError( | ||
{ | ||
errcode: "M_NOT_FOUND", | ||
error: "No backup found", | ||
}, | ||
401, | ||
), |
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.
this could be more neatly written:
new MatrixError( | |
{ | |
errcode: "M_NOT_FOUND", | |
error: "No backup found", | |
}, | |
401, | |
), | |
new MatrixError({ errcode: "M_NOT_FOUND", error: "No backup found" }, 404), |
Co-authored-by: Richard van der Hoff <[email protected]>
Co-authored-by: Richard van der Hoff <[email protected]>
Co-authored-by: Richard van der Hoff <[email protected]>
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.
thank you!
🚢
Fixes #4676
Signed-off-by: Ajay Bura [email protected]
Checklist
public
/exported
symbols have accurate TSDoc documentation.