Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix incorrect type annotation on cacheSecretStorageKey (#12068)
Browse files Browse the repository at this point in the history
* Fix incorrect type annotation on `cacheSecretStorageKey`

`cacheSecretStorageKey` is passed a `SecretStorageKeyDescription` (aka a
`ISecretStorageKeyInfo`), and has done ever since
matrix-org/matrix-js-sdk#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
#11217.

* playwright has the same problem
  • Loading branch information
richvdh authored Dec 18, 2023
1 parent d1562be commit ffb4239
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cypress/support/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 6 additions & 2 deletions playwright/pages/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ffb4239

Please sign in to comment.