Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ixo/matrix-bot-sdk",
"version": "0.8.0-ixo.8",
"version": "0.8.0-ixo.9",
"description": "TypeScript/JavaScript SDK for Matrix bots and appservices (ixo fork)",
"repository": {
"type": "git",
Expand Down
2 changes: 2 additions & 0 deletions src/e2ee/CryptoClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ export class CryptoClient {
this.storage.storageType,
);
this.engine = new RustEngine(machine, this.client);
LogService.info("CryptoClient", `OlmMachine initialized, running initial outgoing requests`);
await this.engine.run();
LogService.info("CryptoClient", `Initial outgoing requests complete`);

const identity = this.engine.machine.identityKeys;
this.deviceCurve25519 = identity.curve25519.toBase64();
Expand Down
10 changes: 10 additions & 0 deletions src/e2ee/RustEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ICryptoRoomInformation } from "./ICryptoRoomInformation";
import { EncryptionAlgorithm } from "../models/Crypto";
import { EncryptionEvent } from "../models/events/EncryptionEvent";
import { BackupManager } from "./BackupManager";
import { LogService } from "../logging/LogService";

/**
* @internal
Expand Down Expand Up @@ -50,6 +51,9 @@ export class RustEngine {
private async runOnly(...types: RequestType[]) {
// Note: we should not be running this until it runs out, so cache the value into a variable
const requests = await this.machine.outgoingRequests();
if (requests.length > 0) {
LogService.debug("RustEngine", `Processing ${requests.length} outgoing request(s)`);
}
for (const request of requests) {
if (types.length && !types.includes(request.type)) continue;
switch (request.type) {
Expand Down Expand Up @@ -149,7 +153,13 @@ export class RustEngine {
private async processKeysUploadRequest(request: KeysUploadRequest) {
const body = JSON.parse(request.body);
// delete body["one_time_keys"]; // use this to test MSC3983
const otkIds = body.one_time_keys ? Object.keys(body.one_time_keys) : [];
if (otkIds.length > 0) {
LogService.info("RustEngine", `Uploading ${otkIds.length} OTK(s): [${otkIds.join(", ")}]`);
}
const resp = await this.client.doRequest("POST", "/_matrix/client/v3/keys/upload", null, body);
const counts = resp?.one_time_key_counts?.signed_curve25519 ?? "unknown";
LogService.debug("RustEngine", `Keys upload response: server OTK count = ${counts}`);
await this.machine.markRequestAsSent(request.id, request.type, JSON.stringify(resp));
}

Expand Down
Loading