Fix missing device keys in rageshakes and sentry reports (#11906)

* fix missing device keys in RS

* fix import

* fix import

* simplify error handling

* refact: cleaner keys array creation

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

* refact: cleaner keys array creation

* jslint

---------

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
Valere 2024-01-16 09:59:14 +01:00 committed by GitHub
parent 9254e9562e
commit 0b6d2f923d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View file

@ -87,10 +87,9 @@ async function collectBugReport(opts: IOpts = {}, gzipLogs = true): Promise<Form
if (cryptoApi) {
body.append("crypto_version", cryptoApi.getVersion());
const keys = [`ed25519:${client.getDeviceEd25519Key()}`];
if (client.getDeviceCurve25519Key) {
keys.push(`curve25519:${client.getDeviceCurve25519Key()}`);
}
const ownDeviceKeys = await cryptoApi.getOwnDeviceKeys();
const keys = [`curve25519:${ownDeviceKeys.curve25519}`, `ed25519:${ownDeviceKeys.ed25519}`];
body.append("device_keys", keys.join(", "));
// add cross-signing status information

View file

@ -121,10 +121,11 @@ async function getCryptoContext(client: MatrixClient): Promise<CryptoContext> {
if (!cryptoApi) {
return {};
}
const keys = [`ed25519:${client.getDeviceEd25519Key()}`];
if (client.getDeviceCurve25519Key) {
keys.push(`curve25519:${client.getDeviceCurve25519Key()}`);
}
const ownDeviceKeys = await cryptoApi.getOwnDeviceKeys();
const keys = [`curve25519:${ownDeviceKeys.curve25519}`, `ed25519:${ownDeviceKeys.ed25519}`];
const crossSigningStatus = await cryptoApi.getCrossSigningStatus();
const secretStorage = client.secretStorage;
const sessionBackupKeyFromCache = await cryptoApi.getSessionBackupPrivateKey();