From ffb42391039504c0f4229ae1660d5a7015bcf6eb Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Mon, 18 Dec 2023 17:23:46 +0000 Subject: [PATCH] Fix incorrect type annotation on `cacheSecretStorageKey` (#12068) * Fix incorrect type annotation on `cacheSecretStorageKey` `cacheSecretStorageKey` is passed a `SecretStorageKeyDescription` (aka a `ISecretStorageKeyInfo`), and has done ever since https://github.com/matrix-org/matrix-js-sdk/pull/1502. `AddSecretStorageKeyOpts`is something else, though until recently some of the properties on `AddSecretStorageKeyOpts` were incorrectly marked as optional, so this went unnoticed since it was broken by https://github.com/matrix-org/matrix-react-sdk/pull/11217. * playwright has the same problem --- cypress/support/bot.ts | 4 ++-- playwright/pages/bot.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cypress/support/bot.ts b/cypress/support/bot.ts index 6f14bbbf45..9e9e00c878 100644 --- a/cypress/support/bot.ts +++ b/cypress/support/bot.ts @@ -20,7 +20,7 @@ import * as loglevel from "loglevel"; import type { ISendEventResponse, MatrixClient, Room } from "matrix-js-sdk/src/matrix"; import type { GeneratedSecretStorageKey } from "matrix-js-sdk/src/crypto-api"; -import type { AddSecretStorageKeyOpts } from "matrix-js-sdk/src/secret-storage"; +import type { SecretStorageKeyDescription } from "matrix-js-sdk/src/secret-storage"; import { HomeserverInstance } from "../plugins/utils/homeserver"; import { Credentials } from "./homeserver"; import { collapseLastLogGroup } from "./log"; @@ -157,7 +157,7 @@ function setupBotClient( // Store the cached secret storage key and return it when `getSecretStorageKey` is called let cachedKey: { keyId: string; key: Uint8Array }; - const cacheSecretStorageKey = (keyId: string, keyInfo: AddSecretStorageKeyOpts, key: Uint8Array) => { + const cacheSecretStorageKey = (keyId: string, keyInfo: SecretStorageKeyDescription, key: Uint8Array) => { cachedKey = { keyId, key, diff --git a/playwright/pages/bot.ts b/playwright/pages/bot.ts index 2a6df36e82..1bac352692 100644 --- a/playwright/pages/bot.ts +++ b/playwright/pages/bot.ts @@ -19,7 +19,7 @@ import { uniqueId } from "lodash"; import type { MatrixClient } from "matrix-js-sdk/src/matrix"; import type { Logger } from "matrix-js-sdk/src/logger"; -import type { AddSecretStorageKeyOpts } from "matrix-js-sdk/src/secret-storage"; +import type { SecretStorageKeyDescription } from "matrix-js-sdk/src/secret-storage"; import type { Credentials, HomeserverInstance } from "../plugins/homeserver"; import type { GeneratedSecretStorageKey } from "matrix-js-sdk/src/crypto-api"; import { Client } from "./client"; @@ -139,7 +139,11 @@ export class Bot extends Client { // Store the cached secret storage key and return it when `getSecretStorageKey` is called let cachedKey: { keyId: string; key: Uint8Array }; - const cacheSecretStorageKey = (keyId: string, keyInfo: AddSecretStorageKeyOpts, key: Uint8Array) => { + const cacheSecretStorageKey = ( + keyId: string, + keyInfo: SecretStorageKeyDescription, + key: Uint8Array, + ) => { cachedKey = { keyId, key,