Skip to content

Commit 8ab9025

Browse files
authored
Update matrix-rust-sdk-crypto-wasm to v14.0.1. (#4710)
* Bump rust sdk to 14.0.0 * Remove duplicate type declarations These now match the types in the underlying library, so can be removed. * bump to 14.0.1 * Use new `OutgoingRequest` type from wasm library * fix types * update lockfile
1 parent e49a0a5 commit 8ab9025

9 files changed

+17
-53
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
],
5151
"dependencies": {
5252
"@babel/runtime": "^7.12.5",
53-
"@matrix-org/matrix-sdk-crypto-wasm": "^13.0.0",
53+
"@matrix-org/matrix-sdk-crypto-wasm": "^14.0.1",
5454
"@matrix-org/olm": "3.2.15",
5555
"another-json": "^0.2.0",
5656
"bs58": "^6.0.0",

spec/unit/rust-crypto/OutgoingRequestProcessor.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
SignatureUploadRequest,
2828
UploadSigningKeysRequest,
2929
ToDeviceRequest,
30+
type OutgoingRequest,
3031
} from "@matrix-org/matrix-sdk-crypto-wasm";
3132
import fetchMock from "fetch-mock-jest";
3233

@@ -271,7 +272,7 @@ describe("OutgoingRequestProcessor", () => {
271272
});
272273

273274
it("does not explode with unknown requests", async () => {
274-
const outgoingRequest = { id: "5678", type: 987 };
275+
const outgoingRequest = { id: "5678", type: 987 } as unknown as OutgoingRequest;
275276
const markSentCallPromise = awaitCallToMarkAsSent();
276277
await Promise.all([processor.makeOutgoingRequest(outgoingRequest), markSentCallPromise]);
277278
expect(olmMachine.markRequestAsSent).toHaveBeenCalledWith("5678", 987, "");

spec/unit/rust-crypto/OutgoingRequestsManager.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ limitations under the License.
1616

1717
import { type Mocked } from "jest-mock";
1818
import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm";
19+
import { type OutgoingRequest } from "@matrix-org/matrix-sdk-crypto-wasm";
1920

20-
import { type OutgoingRequest, type OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor";
21+
import { type OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor";
2122
import { OutgoingRequestsManager } from "../../../src/rust-crypto/OutgoingRequestsManager";
2223
import { defer, type IDeferred } from "../../../src/utils";
2324
import { logger } from "../../../src/logger";
@@ -72,7 +73,7 @@ describe("OutgoingRequestsManager", () => {
7273
const firstOutgoingRequestDefer = defer<OutgoingRequest[]>();
7374

7475
olmMachine.outgoingRequests
75-
.mockImplementationOnce(async (): Promise<OutgoingRequest[]> => {
76+
.mockImplementationOnce(async () => {
7677
return firstOutgoingRequestDefer.promise;
7778
})
7879
.mockImplementationOnce(async () => {

spec/unit/rust-crypto/verification.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm";
1818
import { type Mocked } from "jest-mock";
19+
import { type OutgoingRequest } from "@matrix-org/matrix-sdk-crypto-wasm";
1920

2021
import {
2122
isVerificationEvent,
@@ -28,7 +29,7 @@ import {
2829
type Verifier,
2930
VerifierEvent,
3031
} from "../../../src/crypto-api/verification";
31-
import { type OutgoingRequest, type OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor";
32+
import { type OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor";
3233
import { type IDeviceKeys } from "../../../src/@types/crypto";
3334
import { EventType, MatrixEvent, MsgType } from "../../../src";
3435

src/@types/matrix-sdk-crypto-wasm.d.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@ limitations under the License.
1717
import type * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm";
1818

1919
declare module "@matrix-org/matrix-sdk-crypto-wasm" {
20-
interface OlmMachine {
21-
importSecretsBundle(bundle: RustSdkCryptoJs.SecretsBundle): Promise<void>;
22-
exportSecretsBundle(): Promise<RustSdkCryptoJs.SecretsBundle>;
23-
importCrossSigningKeys(
24-
master_key?: string,
25-
self_signing_key?: string,
26-
user_signing_key?: string,
27-
): Promise<RustSdkCryptoJs.CrossSigningStatus>;
28-
}
29-
3020
interface SecretsBundle {
3121
// eslint-disable-next-line @typescript-eslint/naming-convention
3222
to_json(): Promise<{

src/rust-crypto/OutgoingRequestProcessor.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
KeysQueryRequest,
2121
KeysUploadRequest,
2222
type OlmMachine,
23+
type OutgoingRequest,
2324
PutDehydratedDeviceRequest,
2425
RoomMessageRequest,
2526
SignatureUploadRequest,
@@ -34,16 +35,6 @@ import { type AuthDict, type UIAuthCallback } from "../interactive-auth.ts";
3435
import { ToDeviceMessageId } from "../@types/event.ts";
3536
import { UnstablePrefix as DehydrationUnstablePrefix } from "./DehydratedDeviceManager.ts";
3637

37-
/**
38-
* Common interface for all the request types returned by `OlmMachine.outgoingRequests`.
39-
*
40-
* @internal
41-
*/
42-
export interface OutgoingRequest {
43-
readonly id: string | undefined;
44-
readonly type: number;
45-
}
46-
4738
/**
4839
* OutgoingRequestManager: turns `OutgoingRequest`s from the rust sdk into HTTP requests
4940
*

src/rust-crypto/OutgoingRequestsManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import { type OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm";
17+
import { type OlmMachine, type OutgoingRequest } from "@matrix-org/matrix-sdk-crypto-wasm";
1818

19-
import { type OutgoingRequest, type OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts";
19+
import { type OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts";
2020
import { type Logger } from "../logger.ts";
2121
import { defer, type IDeferred, logDuration } from "../utils.ts";
2222

src/rust-crypto/verification.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm";
18-
import { QrState } from "@matrix-org/matrix-sdk-crypto-wasm";
18+
import { type OutgoingRequest, QrState } from "@matrix-org/matrix-sdk-crypto-wasm";
1919

2020
import {
2121
type GeneratedSas,
@@ -30,7 +30,7 @@ import {
3030
type VerifierEventHandlerMap,
3131
} from "../crypto-api/verification.ts";
3232
import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
33-
import { type OutgoingRequest, type OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts";
33+
import { type OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts";
3434
import { TypedReEmitter } from "../ReEmitter.ts";
3535
import { type MatrixEvent } from "../models/event.ts";
3636
import { EventType, MsgType } from "../@types/event.ts";

yarn.lock

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,10 +1521,10 @@
15211521
"@jridgewell/resolve-uri" "^3.1.0"
15221522
"@jridgewell/sourcemap-codec" "^1.4.14"
15231523

1524-
"@matrix-org/matrix-sdk-crypto-wasm@^13.0.0":
1525-
version "13.0.0"
1526-
resolved "https://registry.yarnpkg.com/@matrix-org/matrix-sdk-crypto-wasm/-/matrix-sdk-crypto-wasm-13.0.0.tgz#658bed951e4c8a06a6dd545575a79cf32022d4ba"
1527-
integrity sha512-2gtpjnxL42sdJAgkwitpMMI4cw7Gcjf5sW0MXoe+OAlXPlxIzyM+06F5JJ8ENvBeHkuV2RqtFIRrh8i90HLsMw==
1524+
"@matrix-org/matrix-sdk-crypto-wasm@^14.0.1":
1525+
version "14.0.1"
1526+
resolved "https://registry.yarnpkg.com/@matrix-org/matrix-sdk-crypto-wasm/-/matrix-sdk-crypto-wasm-14.0.1.tgz#e258ef84bcc7889f0e7eb3a7dbecf0830a6dd606"
1527+
integrity sha512-CgLpHs6nTw5pjSsMBi9xbQnBXf2l8YhImQP9cv8nbGSCYdYjFI0FilMXffzjWV5HThpNHri/3pF20ahZtuS3VA==
15281528

15291529
"@matrix-org/olm@3.2.15":
15301530
version "3.2.15"
@@ -1770,14 +1770,6 @@
17701770
dependencies:
17711771
"@babel/types" "^7.20.7"
17721772

1773-
"@types/bs58@^4.0.1":
1774-
version "4.0.4"
1775-
resolved "https://registry.yarnpkg.com/@types/bs58/-/bs58-4.0.4.tgz#49fbcb0c7db5f7cea26f0e0f61dc4a41a2445aab"
1776-
integrity sha512-0IEpMFXXQi2zXaXl9GJ3sRwQo0uEkD+yFOv+FnAU5lkPtcu6h61xb7jc2CFPEZ5BUOaiP13ThuGc9HD4R8lR5g==
1777-
dependencies:
1778-
"@types/node" "*"
1779-
base-x "^3.0.6"
1780-
17811773
"@types/content-type@^1.1.5":
17821774
version "1.1.8"
17831775
resolved "https://registry.yarnpkg.com/@types/content-type/-/content-type-1.1.8.tgz#319644d07ee6b4bfc734483008393b89b99f0219"
@@ -2394,13 +2386,6 @@ balanced-match@^1.0.0:
23942386
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
23952387
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
23962388

2397-
base-x@^3.0.6:
2398-
version "3.0.10"
2399-
resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.10.tgz#62de58653f8762b5d6f8d9fe30fa75f7b2585a75"
2400-
integrity sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ==
2401-
dependencies:
2402-
safe-buffer "^5.0.1"
2403-
24042389
base-x@^5.0.0:
24052390
version "5.0.0"
24062391
resolved "https://registry.yarnpkg.com/base-x/-/base-x-5.0.0.tgz#6d835ceae379130e1a4cb846a70ac4746f28ea9b"
@@ -5726,11 +5711,6 @@ safe-array-concat@^1.1.2:
57265711
has-symbols "^1.0.3"
57275712
isarray "^2.0.5"
57285713

5729-
safe-buffer@^5.0.1:
5730-
version "5.2.1"
5731-
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
5732-
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
5733-
57345714
safe-regex-test@^1.0.3:
57355715
version "1.0.3"
57365716
resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.3.tgz#a5b4c0f06e0ab50ea2c395c14d8371232924c377"

0 commit comments

Comments
 (0)