From 7e0d92cbe0b46acf1d043218bd5ca3a64d7a9d14 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 19 Feb 2024 12:25:24 +0000 Subject: [PATCH] Add getAuthIssuer method for MSC2965 (#4071) Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- spec/unit/matrix-client.spec.ts | 18 ++++++++++++++++++ src/client.ts | 14 ++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/spec/unit/matrix-client.spec.ts b/spec/unit/matrix-client.spec.ts index f9fab0864ba..ac43580913a 100644 --- a/spec/unit/matrix-client.spec.ts +++ b/spec/unit/matrix-client.spec.ts @@ -3012,4 +3012,22 @@ describe("MatrixClient", function () { expect(result).toEqual({}); }); }); + + describe("getAuthIssuer", () => { + it("should use unstable prefix", async () => { + httpLookups = [ + { + method: "GET", + path: `/auth_issuer`, + data: { + issuer: "https://issuer/", + }, + prefix: "/_matrix/client/unstable/org.matrix.msc2965", + }, + ]; + + await expect(client.getAuthIssuer()).resolves.toEqual({ issuer: "https://issuer/" }); + expect(httpLookups.length).toEqual(0); + }); + }); }); diff --git a/src/client.ts b/src/client.ts index b08598913cb..15fc1a99429 100644 --- a/src/client.ts +++ b/src/client.ts @@ -9974,6 +9974,20 @@ export class MatrixClient extends TypedEventEmitter { + return this.http.request(Method.Get, "/auth_issuer", undefined, undefined, { + prefix: ClientPrefix.Unstable + "/org.matrix.msc2965", + }); + } } /**