Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Include crypto info for rust crypto in rageshakes
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed Oct 25, 2023
1 parent 5e8d274 commit 6ccdd8e
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/rageshake/submit-rageshake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ async function collectBugReport(opts: IOpts = {}, gzipLogs = true): Promise<Form
body.append("user_id", client.credentials.userId!);
body.append("device_id", client.deviceId!);

// TODO: make this work with rust crypto
if (client.isCryptoEnabled() && client.crypto) {
const cryptoApi = client.getCrypto();

if (cryptoApi) {
const keys = [`ed25519:${client.getDeviceEd25519Key()}`];
if (client.getDeviceCurve25519Key) {
keys.push(`curve25519:${client.getDeviceCurve25519Key()}`);
Expand All @@ -92,35 +93,34 @@ async function collectBugReport(opts: IOpts = {}, gzipLogs = true): Promise<Form
body.append("cross_signing_key", (await client.getCrypto()?.getCrossSigningKeyId()) ?? "n/a");

// add cross-signing status information
const crossSigning = client.crypto.crossSigningInfo;
const secretStorage = client.crypto.secretStorage;
const crossSigningStatus = await cryptoApi.getCrossSigningStatus();
const secretStorage = client.secretStorage;

body.append("cross_signing_ready", String(await client.isCrossSigningReady()));
body.append("cross_signing_key", crossSigning.getId() ?? "n/a");
body.append("cross_signing_ready", String(await cryptoApi.isCrossSigningReady()));
body.append("cross_signing_key", (await cryptoApi.getCrossSigningKeyId()) ?? "n/a");
body.append(
"cross_signing_privkey_in_secret_storage",
String(!!(await crossSigning.isStoredInSecretStorage(secretStorage))),
String(crossSigningStatus.privateKeysInSecretStorage),
);

const pkCache = client.getCrossSigningCacheCallbacks();
body.append(
"cross_signing_master_privkey_cached",
String(!!(pkCache && (await pkCache?.getCrossSigningKeyCache?.("master")))),
String(crossSigningStatus.privateKeysCachedLocally.masterKey),
);
body.append(
"cross_signing_self_signing_privkey_cached",
String(!!(pkCache && (await pkCache?.getCrossSigningKeyCache?.("self_signing")))),
String(crossSigningStatus.privateKeysCachedLocally.selfSigningKey),
);
body.append(
"cross_signing_user_signing_privkey_cached",
String(!!(pkCache && (await pkCache?.getCrossSigningKeyCache?.("user_signing")))),
String(crossSigningStatus.privateKeysCachedLocally.userSigningKey),
);

body.append("secret_storage_ready", String(await client.isSecretStorageReady()));
body.append("secret_storage_ready", String(await cryptoApi.isSecretStorageReady()));
body.append("secret_storage_key_in_account", String(await secretStorage.hasKey()));

body.append("session_backup_key_in_secret_storage", String(!!(await client.isKeyBackupKeyStored())));
const sessionBackupKeyFromCache = await client.crypto.getSessionBackupPrivateKey();
const sessionBackupKeyFromCache = await cryptoApi.getSessionBackupPrivateKey();
body.append("session_backup_key_cached", String(!!sessionBackupKeyFromCache));
body.append("session_backup_key_well_formed", String(sessionBackupKeyFromCache instanceof Uint8Array));
}
Expand Down

0 comments on commit 6ccdd8e

Please sign in to comment.