Skip to content

Commit a5086a0

Browse files
authored
Mark IEventDecryptionResult as deprecated (#5112)
This is supposed to be js-sdk-internal
1 parent c251be9 commit a5086a0

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/@types/crypto.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ limitations under the License.
1515
*/
1616

1717
import type { ISignatures } from "./signed.ts";
18+
import type { EventDecryptionResult } from "../common-crypto/CryptoBackend.ts";
1819

1920
// Backwards compatible re-export
20-
export type { EventDecryptionResult as IEventDecryptionResult } from "../common-crypto/CryptoBackend.ts";
21+
/** @deprecated This is an internal type and should not be used. */
22+
type IEventDecryptionResult = EventDecryptionResult;
23+
export type { IEventDecryptionResult };
2124

2225
interface Extensible {
2326
[key: string]: any;

src/models/event.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ limitations under the License.
2121

2222
import { type ExtensibleEvent, ExtensibleEvents } from "matrix-events-sdk";
2323

24-
import type { IEventDecryptionResult } from "../@types/crypto.ts";
2524
import { logger } from "../logger.ts";
2625
import {
2726
EVENT_VISIBILITY_CHANGE_TYPE,
@@ -40,7 +39,7 @@ import { TypedReEmitter } from "../ReEmitter.ts";
4039
import { type MatrixError } from "../http-api/index.ts";
4140
import { TypedEventEmitter } from "./typed-event-emitter.ts";
4241
import { type EventStatus } from "./event-status.ts";
43-
import { type CryptoBackend, DecryptionError } from "../common-crypto/CryptoBackend.ts";
42+
import { type CryptoBackend, DecryptionError, type EventDecryptionResult } from "../common-crypto/CryptoBackend.ts";
4443
import { type IAnnotatedPushRule } from "../@types/PushRules.ts";
4544
import { type Room } from "./room.ts";
4645
import { EventTimeline } from "./event-timeline.ts";
@@ -1025,7 +1024,7 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
10251024
*
10261025
* @param decryptionResult - the decryption result, including the plaintext and some key info
10271026
*/
1028-
private setClearData(decryptionResult: IEventDecryptionResult): void {
1027+
private setClearData(decryptionResult: EventDecryptionResult): void {
10291028
this.clearEvent = decryptionResult.clearEvent;
10301029
this.senderCurve25519Key = decryptionResult.senderCurve25519Key ?? null;
10311030
this.claimedEd25519Key = decryptionResult.claimedEd25519Key ?? null;

src/rust-crypto/rust-crypto.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
import anotherjson from "another-json";
1818
import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm";
1919

20-
import type { IEventDecryptionResult, IMegolmSessionData } from "../@types/crypto.ts";
20+
import type { IMegolmSessionData } from "../@types/crypto.ts";
2121
import { KnownMembership } from "../@types/membership.ts";
2222
import { type IDeviceLists, type IToDeviceEvent, type ReceivedToDeviceMessage } from "../sync-accumulator.ts";
2323
import type { ToDeviceBatch, ToDevicePayload } from "../models/ToDeviceMessage.ts";
@@ -28,6 +28,7 @@ import {
2828
type BackupDecryptor,
2929
type CryptoBackend,
3030
DecryptionError,
31+
type EventDecryptionResult,
3132
type OnSyncCompletedData,
3233
} from "../common-crypto/CryptoBackend.ts";
3334
import { type Logger, LogSpan } from "../logger.ts";
@@ -285,7 +286,7 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, CryptoEventH
285286
await encryptor.encryptEvent(event, this.globalBlacklistUnverifiedDevices, this.deviceIsolationMode);
286287
}
287288

288-
public async decryptEvent(event: MatrixEvent): Promise<IEventDecryptionResult> {
289+
public async decryptEvent(event: MatrixEvent): Promise<EventDecryptionResult> {
289290
const roomId = event.getRoomId();
290291
if (!roomId) {
291292
// presumably, a to-device message. These are normally decrypted in preprocessToDeviceMessages
@@ -2202,7 +2203,7 @@ class EventDecryptor {
22022203
public async attemptEventDecryption(
22032204
event: MatrixEvent,
22042205
isolationMode: DeviceIsolationMode,
2205-
): Promise<IEventDecryptionResult> {
2206+
): Promise<EventDecryptionResult> {
22062207
// add the event to the pending list *before* attempting to decrypt.
22072208
// then, if the key turns up while decryption is in progress (and
22082209
// decryption fails), we will schedule a retry.

0 commit comments

Comments
 (0)