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
This commit is contained in:
Richard van der Hoff 2023-12-18 17:23:46 +00:00 committed by GitHub
parent d1562befc4
commit ffb4239103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -20,7 +20,7 @@ import * as loglevel from "loglevel";
import type { ISendEventResponse, MatrixClient, Room } from "matrix-js-sdk/src/matrix"; import type { ISendEventResponse, MatrixClient, Room } from "matrix-js-sdk/src/matrix";
import type { GeneratedSecretStorageKey } from "matrix-js-sdk/src/crypto-api"; 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 { HomeserverInstance } from "../plugins/utils/homeserver";
import { Credentials } from "./homeserver"; import { Credentials } from "./homeserver";
import { collapseLastLogGroup } from "./log"; import { collapseLastLogGroup } from "./log";
@ -157,7 +157,7 @@ function setupBotClient(
// Store the cached secret storage key and return it when `getSecretStorageKey` is called // Store the cached secret storage key and return it when `getSecretStorageKey` is called
let cachedKey: { keyId: string; key: Uint8Array }; let cachedKey: { keyId: string; key: Uint8Array };
const cacheSecretStorageKey = (keyId: string, keyInfo: AddSecretStorageKeyOpts, key: Uint8Array) => { const cacheSecretStorageKey = (keyId: string, keyInfo: SecretStorageKeyDescription, key: Uint8Array) => {
cachedKey = { cachedKey = {
keyId, keyId,
key, key,

View File

@ -19,7 +19,7 @@ import { uniqueId } from "lodash";
import type { MatrixClient } from "matrix-js-sdk/src/matrix"; import type { MatrixClient } from "matrix-js-sdk/src/matrix";
import type { Logger } from "matrix-js-sdk/src/logger"; 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 { Credentials, HomeserverInstance } from "../plugins/homeserver";
import type { GeneratedSecretStorageKey } from "matrix-js-sdk/src/crypto-api"; import type { GeneratedSecretStorageKey } from "matrix-js-sdk/src/crypto-api";
import { Client } from "./client"; 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 // Store the cached secret storage key and return it when `getSecretStorageKey` is called
let cachedKey: { keyId: string; key: Uint8Array }; let cachedKey: { keyId: string; key: Uint8Array };
const cacheSecretStorageKey = (keyId: string, keyInfo: AddSecretStorageKeyOpts, key: Uint8Array) => { const cacheSecretStorageKey = (
keyId: string,
keyInfo: SecretStorageKeyDescription,
key: Uint8Array,
) => {
cachedKey = { cachedKey = {
keyId, keyId,
key, key,