From b55930f084bbeb4a80c027e0a2e178c43b8773b7 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 22 Oct 2021 17:47:29 +0200 Subject: [PATCH] convert ReplayDetectionEntry to typescript --- ...ectionEntry.js => ReplayDetectionEntry.ts} | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) rename src/matrix/e2ee/megolm/decryption/{ReplayDetectionEntry.js => ReplayDetectionEntry.ts} (61%) diff --git a/src/matrix/e2ee/megolm/decryption/ReplayDetectionEntry.js b/src/matrix/e2ee/megolm/decryption/ReplayDetectionEntry.ts similarity index 61% rename from src/matrix/e2ee/megolm/decryption/ReplayDetectionEntry.js rename to src/matrix/e2ee/megolm/decryption/ReplayDetectionEntry.ts index e5ce2845..f3807c39 100644 --- a/src/matrix/e2ee/megolm/decryption/ReplayDetectionEntry.js +++ b/src/matrix/e2ee/megolm/decryption/ReplayDetectionEntry.ts @@ -14,11 +14,24 @@ See the License for the specific language governing permissions and limitations under the License. */ +import type {TimelineEvent} from "../../../storage/types"; + export class ReplayDetectionEntry { - constructor(sessionId, messageIndex, event) { + public readonly sessionId: string; + public readonly messageIndex: number; + public readonly event: TimelineEvent; + + constructor(sessionId: string, messageIndex: number, event: TimelineEvent) { this.sessionId = sessionId; this.messageIndex = messageIndex; - this.eventId = event.event_id; - this.timestamp = event.origin_server_ts; + this.event = event; + } + + get eventId(): string { + return this.event.event_id; + } + + get timestamp(): number { + return this.event.origin_server_ts; } }