Move interface into new file

This commit is contained in:
RMidhunSuresh 2023-03-29 16:43:37 +05:30
parent a87edcf99e
commit 209acaf60e
2 changed files with 35 additions and 15 deletions

View File

@ -19,6 +19,7 @@ import type {DeviceTracker} from "../../../e2ee/DeviceTracker.js";
import type {ILogItem} from "../../../../logging/types";
import type {Clock} from "../../../../platform/web/dom/Clock.js";
import type {DeviceMessageHandler} from "../../../DeviceMessageHandler.js";
import type {IChannel} from "./IChannel";
import {makeTxnId} from "../../../common.js";
import {CancelReason, VerificationEventType} from "./types";
import {Disposables} from "../../../../utils/Disposables";
@ -39,21 +40,6 @@ const messageFromErrorType = {
[CancelReason.MismatchedSAS]: "Emoji/decimal does not match.",
}
export interface IChannel {
send(eventType: VerificationEventType, content: any, log: ILogItem): Promise<void>;
waitForEvent(eventType: VerificationEventType): Promise<any>;
getSentMessage(event: VerificationEventType): any;
getReceivedMessage(event: VerificationEventType): any;
setStartMessage(content: any): void;
cancelVerification(cancellationType: CancelReason): Promise<void>;
acceptMessage: any;
startMessage: any;
initiatedByUs: boolean;
isCancelled: boolean;
cancellation?: { code: CancelReason, cancelledByUs: boolean };
id: string;
otherUserDeviceId: string;
}
type Options = {
hsApi: HomeServerApi;

View File

@ -0,0 +1,34 @@
/*
Copyright 2023 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import type {ILogItem} from "../../../../logging/types";
import {CancelReason, VerificationEventType} from "./types";
export interface IChannel {
send(eventType: VerificationEventType, content: any, log: ILogItem): Promise<void>;
waitForEvent(eventType: VerificationEventType): Promise<any>;
getSentMessage(event: VerificationEventType): any;
getReceivedMessage(event: VerificationEventType): any;
setStartMessage(content: any): void;
cancelVerification(cancellationType: CancelReason): Promise<void>;
acceptMessage: any;
startMessage: any;
initiatedByUs: boolean;
isCancelled: boolean;
cancellation?: { code: CancelReason, cancelledByUs: boolean };
id: string;
otherUserDeviceId: string;
}