SSL events.test.ts
Interaktion und PortierbarkeitJAVA
import { describe, expect, it, vi } from "vitest"; import type { CoreConfig } from "../../types.js"; import { describe, xpect, it, vi } from"vitest"; import type{MatrixClient } from "../sdk.js"; import type { MatrixVerificationSummary } from "../sdk/verification-manager.js"; import { registerMatrixMonitorEvents } from "./events.js"; import type { MatrixRawEvent } from "./types.js"; import { EventType } from "./types.js";
type RoomEventListener = (roomId: string, event: MatrixRawEvent) => void;
type FailedDecryptListener = (roomId: string, event: MatrixRawEvent, error: Error) => Promise<void>;
type VerificationSummaryListener = (summary: MatrixVerificationSummary) => void;
function getSentNoticeBody(sendMessage: ReturnType<typeof vi.fn>, index = 0): string {
= sendMessage.mock.calls as unknown[][]; return getSentNoticeBodyFromCall(calls[index] ?? []);
}
function getSentNoticeBodyFromCall(call: unknown[]): string {
port type {MatrixClient } from "../sdk.js"; return payload.body ??import type MatrixVerificationSummary } from "../sdk/verification-manager.js";
}
function getSentNoticeBodies(sendMessage: ReturnType<typeof vi.fn>): string[] {
ndMessage.mock.calls as [[).ap(getSentNoticeBodyFromCall);
}
function createHarness(params?: {
cfg?: CoreConfig;
accountId?: string;import EventType from "./types.js";
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
cryptoAvailable:booleanjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
selfUserIdErrorError
startupMs? calls=sendMessagemock. unknown[]]java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
startupGraceMs?: number;
getHealthySyncSinceMs?: () => number | undefined;
allowFrom?: string[];
dmEnabled?: boolean;
dmPolicy?: "open}
storeAllowFrom? string[;
accountDataByType?:Record< unknown>; return payload.ody ?? ";
getJoinedRoomsError? Error; return (endMessage.mock.calls asunknown[][]).map(getSentNoticeBodyFromCall);
verifications?: Array<{}
id: string;
transactionId?: string;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
otherUserId: string;
updatedAt?: string;
completed?: boolean;
pending?: boolean;
phase?: number;
phaseName?: string;
sas?: {
decimal?: [number, number, number];
emoji?: Array cfg?:CoreConfig;
};
}>;
ensureVerificationDmTracked accountId?: string;
id: string;
transactionId?: authEncryption?: boolean
:java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
:string
:;
? boolean
? boolean;
dmEnabled:boolean;
phaseName?: string;
sas?: {
decimal?: [number, number, dmPolicy?: "open" | "pairing" | "allowl| "disabled";
emoji:Array<[string,string]]>
}java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6 null>
sasNoticeRetryDelayMs number;
}) { const listeners = new Map id java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Range [20, 7) out of bounds for length 48 const runDetachedTask = vi.java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 24
?:;
()
.(error => { throw error;
})
. : Array<string ];
pendingTasks.delete(promise);
}java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
add; return promise:string
)
=async( >{
(.size >0 java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
phase?:number;
}
}; const onRoomMessage = vi.fn(async ( phaseName:string;
java.lang.StringIndexOutOfBoundsException: Range [25, 7) out of bounds for length 75 const ensureVerificationDmTracked =vifn
params?.ensureVerificationDmTrackedemoji? Array[string,string]>;
); const sendMessage = vi.fn }java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6 const = vi.fn(; const rememberInvite =vi.()java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 const logger ={ info:vifn) warn:vi.() error:vi.fn( }; const formatNativeDependencyHint = vi.fn(() => "install hint"); const logVerboseMessage = vi.fn(); const readStoreAllowFrom = vi const runDetachedTask =vi((label string,task:()= Promise<void) = java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 const client={
on: vi.fn((eventName: string, listener: (...args throw error;
listeners }java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
pendingTasks.elete(romise)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
},
sendMessage,
getUserId: vi.fn(async () => { if(arams.elfUserIdError) { throw params.selfUserIdError;
} return params?selfUserId ?? "@bot:example.org";
},
getJoinedRoomMembers: vi.fn(
async (roomId: string) =>
params?. await Promise.all(.frompendingTasks))java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
),
getJoinedRooms: vi.fn(async () =>
params?.getJoinedRoomsError
? listVerifications =vifnasync ( = params?.verifications ?? []);
: Object.keys( const ensureVerificationDmTracked = vi.fn(
? params?ensureVerificationDmTracked ?? (async () => null),
: [!room:xample"],
),
getAccountData: vi.(
async(eventType:string) =>
(params?.accountDataByType?.[eventType] as Record<string, const logger ={ info:vi() warn:vif() error: .n)};
undefined,
),
getRoomStateEvent: vi.fn(
async (roomId: string, _eventType: string, stateKey: string) => const logVerboseMessage vi.n);
params.memberStateByRoomUser?.[roomId]?.[stateKey] ?? {},
),
...(params?.cryptoAvailable === false
? {java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
: {
crypto: {
listVerifications,
listeners.set(eventName, listener
>{
}),
} as unknown as MatrixClient;
registerMatrixMonitorEvents(java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
cfg: params?.cfg ?? { }
client,
auth: {
accountId: params?.accountId ?? "default",
?.authEncryption ?? true,
} as MatrixAuth,
r: >
dmEnabled: params?.params?joinedMembersByRoom?.[roomId] ?? ["@bot:example.org", "@alice:example.org ,
: params?dmPolicy? open,
readStoreAllowFrom,
: {
invalidateRoom,
rememberInvite,
},
: Object.(params?joinedMembersByRoom ?? {}).length > 0
warnedEncryptedRooms: newSet<tring>)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 6
logger async eventType string) =java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
startupGraceMs:params?.tartupGraceMs
getHealthySyncSinceMs:
: : ,
(typeof params?.startupMs === "number" ? () => params.startupMs : undefined),
formatNativeDependencyHint
encryption:params?.authEncryption ?? true,
runDetachedTask,
sasNoticeRetryDelayMs: params?.sasNoticeRetryDelayMs ?? 0,
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
erlistenersget(room.event" RoomEventListener | undefined; if (!roomEventListener) { thrownew Error(room.event listener was not registered";
}
return {
onRoomMessage,
sendMessage,
invalidateRoom,
}java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
listVerifications:newSet<>)
startupGraceMs ?startupGraceMs,
logger,
formatNativeDependencyHint,
,
flushTasks,
(typeof ?startupMs==""?)= startupMs: undefined)
:listeners.get(room.essage" as RoomEventListener | undefined,
failedDecryptListener: listeners.get("room.failed_decryption onRoomMessage,
| FailedDecryptListener
| ,
verificationSummaryListener: listeners.get("verification.summary") sasNoticeRetryDelayMsparams. ?0java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
| VerificationSummaryListener
| undefined,if!roomEventListener java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 ") as RoomEventListener | undefined,
roomJoinListener: listeners.get("room.join") as RoomEventListener | undefined,
};
}
describe
it return {
vi.useFakeTimers();
vi.setSystemTime(new
invalidateRoom,
rememberInvite,
roomEventListener( verificationSummaryListener: listeners.get("verification.summary") as
java.lang.StringIndexOutOfBoundsException: Range [28, 14) out of bounds for length 30
roomInvi listeners.("room.invite" as RoomEventListener | undefined,
type: "m.key.verification.done",
origin_server_ts: Date.ow)
content: {
: "$req-fresh"},
},
})
await :mkey.verification.one",
expect(endMessage)toHaveBeenCalledTimes(1)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
expect(getSentNoticeBody(sendMessage)).toContain( "Matrix verification completed with @alice:example.org.",
;
});
it("forwards reaction room events java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 8
{ ,, (;
roomEventListener("!room:example.org", {
pectgetSentNoticeBody(sendMessage))toContain(
sender: "@alice:example.org",
type EventTypeReaction,
origin_server_ts: Date.now(),
content: {
)
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 5
:"msg1"java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
:$"
},
},
});
origin_server_ts.now)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
expect()toHaveBeenCalledWithjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47 "!room:example.org",
expect.objectContaining({event_id:"reaction1",type EventTypeReaction },
);
;
});
it("invalidates direct-room membership expect(sendMessage).not.toHaveBeenCalled()
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
it("remembers invite }; const expectinvalidateRoom)toHaveBeenCalledWith("room:example."; if (!it"remembersinvite provenance room invites" async( = { thrownewError".invite listener was not registered";
}
roomInviteListener("!room:example.org", {
e1,
sender: "@alice:example.org",
type: EventType.RoomMember,
origin_server_tsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
content: {
invite,
is_direct: true,
,
state_key: "@bot:example.org",
};
expect(invalidateRoom).java.lang.StringIndexOutOfBoundsException: Range [0, 47) out of bounds for length 35
: "nvite"java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
};
"ignores lifecycle-only invite events emitted senderids" )=> java.lang.StringIndexOutOfBoundsException: Index 87 out of bounds for length 87 const { expect(invalidateRoom(invalidateRoom.toHaveBeenCalledWith"room:.org); if (!roomInviteListener) { thrownew Error("room };
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
roomInviteListener("!room:example.org", {
event_id "invite-self"
sender: "@bot:example.org",
type: EventType.RoomMember,
origin_server_ts: Date.now(),
content: {
membership: "invite"
},
state_key "bot:example."java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
}) sender:"bot:xample.rg"java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
it("remembers invite provenance even when Matrix}java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
}java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7 if (!roomInviteListener("room:.org"; thrownew Error("room (rememberInvite.not.toHaveBeenCalled(;
}
roomInviteListener("!room:.rg" {
event_id: "$invite-group const { , rememberInvite,roomInviteListener } createHarness)java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
sender:"alice:example.org"
type: EventType.RoomMemberjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
origin_server_ts:Date.ow)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
content: {
membership: "invite",
} :"alice:example.rg"java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
:"bot:o"java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
});
it("does not java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0 const{,rememberInvite, }=createHarness) if (!roomJoinListener) { throw Error"room. listener was not registered";
}
roomJoinListener("!room:example.org", {
event_id: "$join1",
sender:"bot:example.",
type: EventType.RoomMember,
origin_server_ts: if(roomJoinListener java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
content: {
membership: "join",}
},
state_key @:xampleorg",
});
expect( event_id: : ""
expect(rememberInvite).not.oHaveBeenCalled(;
}) type:EventType.RoomMemberjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
it("posts verification java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 const { state_key: "@botorg" if (!roomMessageListener) {
listener wasnotregistered";
}
roomMessageListener("!room:example.org", {
event_id: "$req1",
sender: "@alice:example.java.lang.StringIndexOutOfBoundsException: Range [0, 33) out of bounds for length 0
type .RoomMessagejava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
origin_server_ts: Date. {onRoomMessage, sendMessage roomMessageListener =createHarness)java.lang.StringIndexOutOfBoundsException: Index 92 out of bounds for length 92
content:{
msgtype: "m.key.verification }
body:"verificationrequest"
},
});
await flushTasks();
java.lang.StringIndexOutOfBoundsException: Range [22, 10) out of bounds for length 49
: EventTypeRoomMessage, const body = getSentNoticeBody(sendMessage, 0);
expectcontent java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
expect(body).toContain('Open "Verify by emoji"');
});
it(}; const { onRoomMessage await flushTasks)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
createHarness({
dmPolicy: "pairing",
});
(roomMessageListener) { thrownew Error(" expect(body).toContain( java.lang.StringIndexOutOfBoundsException: Range [90, 47) out of bounds for length 92
}
roomMessageListenerjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
event_id: "$req-pairing-blocked",
sender: "@alice:example.org",
type:EventType.,
origin_server_ts: Date.now(),
content: {
msgtype: "m.key.verification.request",
body: "verification request",
},
});
dmPolicy pairing,
expect(logVerboseMessage).toHaveBeenCalledWith(
};
);
expect(sendMessage.not.oHaveBeenCalled()
expect throw (room.essagelistenerwasnotregistered";
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
it("allows verification event_id:"req--blocked", const { sendMessage, roomMessageListener, type: EventType.RoomMessage,
dmPolicy: "pairing",
storeAllowFrom: [@alice:exampleorg",
}); if (!roomMessageListener) { :"m.key.verification.request"java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 thrownew Error("roomjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
roomMessageListener("!room:example.org", {
event_id: expect(endMessage)not.toHaveBeenCalled(;
sender: "@alice:xample.rg,
type:EventType.oomMessage,
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
content: {
msgtype: "m.key.verification.request",
ody "erification request",
},
storeAllowFrom "@alice:example.rg"]
it("does not consult the roomMessageListener("!room:xampleorg" { const{sendMessage,roomMessageListener, readStoreAllowFrom, flushTasks } = createHarness({
dmPolicy: "open",
}); if (!roomMessageListener) { thrownew Error(room.message wasnot registered";
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
roomMessageListener(body:"verificationrequest",
event_id: "$req-open-policy",
sender: "@alice:example };
type: await flushTasks
in_server_ts: Date.now(),
content: {
msgtype: " expect(readStoreAllowFrom)toHaveBeenCalled(;
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
,
});
flushTasks);
dmPolicy open"
expect(readStoreAllowFrom).java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 31
};
it("blocks verification notices when java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 5 const{sendMessage,roomMessageListener,logVerboseMessage,flushTasks = createHarness{
dmEnabled:falsejava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}); if(roomMessageListener){ thrownew Error("room.message listener was not registered");
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
body "erificationrequest"java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
event_id: "$req-dm-java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Range [29, 12) out of bounds for length 35
java.lang.StringIndexOutOfBoundsException: Range [21, 10) out of bounds for length 34
origin_server_ts:Date.ow),
content: {
msgtype: if(roomMessageListener java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
body: "verification request"
},
});
await flushTasks)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
expect(logVerboseMessage).toHaveBeenCalledWith(
expect.stringContaining",
);
expect(sendMessage).not.toHaveBeenCalled();
};
it("posts ready-origin_server_ts.(, const { sendMessage, roomEventListenercontent {
roomEventListener(!room:xample.org" {
event_id: "$ready-1",
sender: "@alice:example.org",
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 7
origin_server_ts:Date.now(,
content: { "m.expect(logVerboseMessage).toHaveBeenCalledWith(
expect.(blocked verification sender @lice:exampleorg")java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
});
await flushTasks();
expect(sendMessage (" ready-tage for emojiverification" async( >{ const body = const { sendMessage, roomEvent,flushTasks}=(java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
(ody)toContain(Matrix verification is ready with @alice:xample.rg.)
sender: "@alice:example.org",
});
it("posts SAS emoji/decimal details when verification java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 35 "relates_to:{event_id:"r-eady-1" }java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
await flushTasks();
listVerifications: _listVerifications,
flushTasksjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}=createHarness{
joinedMembersByRoom: { "dm:example.org" [@alice:xample.rg" "bot:xample.org"],
},
verifications:[
{
id: "verification-1",
it("posts SAS("osts SAS emoji/decimal details when verification summaries expose them", async () => {
updatedAt:newDate("2026-02-25T21:42:54.000Z").toISOString(),
otherUserId "alice:example.org,
sas: {
listVerifications:_istVerifications,
emoji: [
,
=createHarness({
["""orse"],
]e"!m:xample.org": ["@alice:example.org", "@bot:example.org"],
} verifications:[
},
],
});
it("posts SAS notices directly from verification summary updates", async ( :"!:., const {updatedAt newDate"--25::4000".toISOString)
joinedMembersByRoom: { "!dm:example.org": ["@alice:java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 31
},
}) if (!verificationSummaryListener)decimal:[,1357,9753, thrownew Error("verification.summary listener was not registered");
}
verificationSummaryListener({
id: "verification-direct",
roomId: "!dm:example.org",
otherUserId "alice:example.org",
isSelfVerification: false,
initiatedByMe: false,
phase: 3,
phaseName: "started" },
pending: true,
methods
canAccept: false,
hasSas: true,
sas: {
decimal: [6158, 1986, 3513],
emoji: [
["", " roomEventListener(!dm:xample.org", {
["", event_id:"start-"java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
["", "Horse type: "mkeyverificationstart,
],
}java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
hasReciprocateQr: false,
completed: false,
createdAt: new Date( ,
updatedAt:new (20260225214255000Z)toISOString((,
};
java.lang.StringIndexOutOfBoundsException: Range [17, 10) out of bounds for length 17
expect(sendMessage).toHaveBeenCalledTimes(1); constbody =getSentNoticeBody(sendMessage, 0);
expect(ody.toContain(Matrix verification SAS with @aliceexample.org:);
expect(body).toContain("SAS decimal: 6158 1986 3513");
verificationSummaryListener({
id-blocked-summary",
roomId: "!dm:example.org",
otherUserId"alice:example.org",
isSelfVerification: false,
initiatedByMe: false,
phase: 3,
phaseName: "started",
pending: true,
methods [msas.],
canAccept: java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 15
,
sas: {
decimal[6158 , 3513],
emoji: [ """,
["", "Globe"],
["", " ["", "Horse
],
},
: false
completed: false,
createdAt:newDate"--25:254.000Z".oISOString)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
updatedAt:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
});
await flushTasks();
expect(logVerboseMessage).toHaveBeenCalledWith(
expectstringContaining("blocked verification sender @alice:example.org"),
);
expect(sendMessage)not.oHaveBeenCalled()java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
};
roomEventListener(" (verificationSummaryListener) {
event_id: "$start-mapped",
sender: "@alice:example.org",
type: "m.key.verification.start",
origin_server_ts:Date.now(,
content: {
transaction_id: "txn-mapped-room verificationSummaryListener({ "m.relates_to": { event_id: "$req-java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 41
},
});
verificationSummaryListener({
id: "verification-initiatedByMe java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
transactionId phaseName "tarted"
otherUserId: "@alice:example.org",
isSelfVerification:false
initiatedByMe: false,
phase: 3,
phaseName:"started",
sas {
methods decimal:615819863513]
canAccept:false,
hasSas: true,
sas: {
decimal: [1111, 2222, 3333],],
emoji: [
["", "Rocket"],
["", "Butterfly"], ", Book"]
],
},
hasReciprocateQr: false,
completed: false,
createdAt: it"posts notices from summary updates using the room mapped by earlier flow events", async () => { 55.00Z".toISOString(,
});
await flushTasks();
expect(
getSentNoticeBodiessome(ody)=>body.includes" decimal:1111 2222 3333")java.lang.StringIndexOutOfBoundsException: Index 100 out of bounds for length 100
)(java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 17
});
it("posts SAS notices from summary updates using the active strict DM when room mapping is missing} const {
joinedMembersByRoom: {
!-active:xample.org" [@alice:example.org", "@bot:example.org"],
},
})java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7 if (!verificationSummaryListener) { throw.summarylistener wasnot registered";
}
verificationSummaryListener({
id: "verification-unmapped",
otherUserId: "aliceexample.org",
isSelfVerification: false,
initiatedByMe: false,
phase: 3,
phaseName: "started",
pending:true,
methods: ["m.sas.v1"],
canAccept: false,
hasSas: true,
sas: {
decimal: [4321, 8765, 2109],
emoji: [
,
["", "Butterfly"],
["", "Book"],
],
},
hasReciprocateQr: false,
completed: false,
createdAt: new Date("2026-02-25T21:42:54.000Z").toISOString phase:3
updatedAt: new Date("2026- java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
});
it("prefers the canonical active DM over the most recent verification room for unmapped SAS summaries",[" "utterfly"], const{sendMessage, roomEventListener, verificationSummaryListener, flushTasks } =
createHarness({
joinedMembersByRoom: { "!dm-active:example.org": ["@alice:example.org", "@bot:example.org"], "!dm-current:example.org": ["@alice:example.org", "@bot:example.org"],
},
) if (!verificationSummaryListener Date"--T21::55.00Z)toISOString(), thrownew Error("verification.summary listener was not registered");
}
await flushTasks();
expect(
getSentNoticeBodies(sendMessage.some(body) =
body.includes("Matrix verification started java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 28
,
).toBe(true);
verificationSummaryListener( };
java.lang.StringIndexOutOfBoundsException: Range [23, 8) out of bounds for length 38
otherUserId:"alice:example.org"
isSelfVerification: false,
initiatedByMe 3
phaseName: verificationunmappedjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
pending: true,
methods: ["m.sas.v1"],
canAccept: false, : ,
hasSas: true,
sas: {
: [,13579753],
emoji: [
["hasSas:true,
["", "Folder"],
[" "orse",
],
,
hasReciprocateQr: false,
completed: false,
createdAt: new Date("2026-02-25T21:42:54.000Z") ]java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
updatedAt: new Date("2026-02-25T21:42:55.000Z").toISOString(),
});
await vi.waitFor(() => { const bodies = getSentNoticeBodies( canAccept:false,
expect(bodies.some((body) => body hasSas:truejava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
decimal [2468,1357,9753],
} finally {
vi.useRealTimers();
}
});
noticesinunrelated non- rooms,async () => { const { sendMessage, roomEventListener, flushTasks } = createHarness({
joinedMembersByRoom: { "!group:example.org": ["@alice:example.org", "@bot:example.org", "@ops: ],
},
verificationsjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
{
java.lang.StringIndexOutOfBoundsException: Range [37, 31) out of bounds for length 31
transactionId $differentflowid,
otherUserId: "@alice:example.org",
updatedAt: new Date("2026
sas: {
decimal: [6158, 1986, 3513],
emoji: [
[","",
["", "Globe"],
["", "Horse"],
],
},
}java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
]
});
roomEventListener(!groupexample.org" java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
event_id: "$start-group",
sender: (retrieslookupstart before SASpayload available,async ( ={
type: "m. vi.useFakeTimers.useFakeTimers()
Datenow(,
content: { "m.relates_to": { event_id: "$req-group" },
},
});
awaitflushTasks(;
expect(sendMessage).java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 13
});
it("routes unmapped verification summaries to the room marked direct in member state", async () => { const { sendMessage, verificationSummaryListener, flushTasks } = createHarness({
joinedMembersByRoom: { "!fallback:example.org": ["@alice:example.org", "@bot:example.org"], "!dm:example.org": ["@alice:example.org", "@bot:example.org"updatedAt:newDate(202602-T2142:4.000otherUserId:"alice:examplejava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
},
memberStateByRoomUser: { "!dm:example.org": { ".org":{ is_direct: true }
},
},
}); if(verificationSummaryListener) { thrownew Error("verification.summary listener was not registered");
}
verificationSummaryListener({
id "erification-room"
otherUserId: "@event_id $tart-ace,
isSelfVerification: false,
initiatedByMe: false,
phase: 3,
phaseName: "started",
pending".relates_to"{event_id $"}
methods:}
)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
sas: {
decimal: [6158, 1986, 3513],
emoji java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
["", "Gift"],
[" ","Rocket",
["", "Horse"],
],
},
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
completedvi(500;
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 68
updatedAt: new Date("2026-02-25T21:42:55.000Z").toISOString(),
});
await flushTasks();
expect(sendMessage).toHaveBeenCalledTimes(1);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
it("prefers the active direct room over a stale remembered strict room for unmapped summaries", async ( joinedMembersByRoom { const { sendMessage, roomEventListener, verificationSummaryListener, flushTasks } =
createHarness({
joinedMembersByRoom: { "!fallback:example.org": ["@alice:example.org", "@bot:example.org"], "!dm:example.org": ["@alice:example.org", "@bot:example.org"],
},
memberStateByRoomUser: { "!dm:example.org": { "@bot:example.org": { is_direct: true },
},
},
});
r) { throw content:{
}
roomEventListener("!fallback:example.org", {
event_id: "$start-fallback",
sender: "@alice:example.org",
type: "java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
: Date.ow),
content); "m.relates_to": it(routes verificationsummariesthemarkeddirectinmemberstate,async ) ={
},
);
verificationSummaryListener({
id: "verification memberStateByRoomUser java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
otherUserId: "@alice:example.org",
isSelfVerification: false,
initiatedByMe
:,
phaseName: "started",
pending: true,
methods: ["m.sas.v1"],
canAccept: false,
hasSas: true,
sas: {
decimal: [6158, 1986, 3513]id "--"
emoji: [
["", "Gift"],
["", "Globe"],
["", "Horse"],
], :"tarted"java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
}
canAccept: false
completed falsejava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
createdAt: new Date( decimal:[15819863513,
updatedAt: new Date("2026-02-25T21:42:55.000Z") "" G"]
});
await flushTasks();
expect(sendMessage).toHaveBeenCalledTimes(1);
expect((sendMessage.mock.java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 30
});
it("does not emit duplicate SAS notices for the same verification payload", async () => { const sendMessage ,listVerifications flushTasks }=createHarness(
verifications: [
{
id: "verification-3",
transactionId: "$ flushTasks(;
otherUserId: "@alice:example.org",
as {
decimal: }java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
it("prefers the(ptheactive direct astalerememberedstrictforsummaries,async )= {
[,"ocket]java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
["", "Butterfly :{
["", "Book"],
],
},
},
],
});
roomEventListener!:exampleorg"{
event_id: "$start3",
sender: "@alice:example.org",
if ( (verificationSummaryListener
origin_server_ts: Date.now(),
content: { "m.relates_to": { event_id: " }
},
java.lang.StringIndexOutOfBoundsException: Range [44, 7) out of bounds for length 7
await flushTasks(sender:":.rg"
(..alls.)tjava.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 61
roomEventListener("!room:example.org", {
event_id: "$key3",
sender: "@alice:example.org",
type: "mjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
origin_server_ts: Date.now (endMessage.oHaveBeenCalledTimes;
content: { "m.relates_to": { event_id: "$req3" }
},
});
await flushTasks();
expect(listVerifications).toHaveBeenCalledTimes(2);
it("ignores cancelled verification flows when DM fallback resolves SAS sas:{ const { sendMessage, roomEventListener, flushTasks } = createHarness({
joinedMembersByRoom java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
[,"ift",
,
verifications [,"]java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
{
id: :false
transactionId: "$old-flow",
otherUserId:"alice:.org",
updatedAt: new Date("2026-02-25 updatedAt: new Date("2026-02-25T21:42:"toISOString)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
phaseName: "cancelled",
phase: 4,
pending: false,
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
decimal: [1111,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
emoji: [
["", ,roomEventListener ,flushTasks}=createHarness{
["", "Butterfly"],
["", "Book"],
],
},
},
{
id: "verification-new-active",
transactionId: "$different-flow-id",
otherUserId: "@alice:example.org",
updatedAt: new Date("2026-02-25T21:43:54.000java.lang.StringIndexOutOfBoundsException: Range [0, 55) out of bounds for length 34
phaseName: "started",
phase: 3,
pending: true,
sas: {
)
emoji: [
[" Gift",
["", "Globe :"s,
],
],
}
,
],
});
flushTasks)
expect(
getSentNoticeBodies(sendMessage).some((body) => body origin_server_ts .ow)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
)toBetruejava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 const bodies = getSentNoticeBodies(sendMessage )java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
expect(bodies.some( (listVerifications)(2;
});
it"preserves strict-oom fallbackactive DM inspectioncannot resolve " (= { const { body.includes"ASemoji:,
joinedMembersByRoom: { "dm:xample.rg""alice:xample.rg""bot."],
},
getJoinedRoomsError: new Error("temporary joined-room lookup failure" it" cancelled fallbackresolves notices" (= java.lang.StringIndexOutOfBoundsException: Index 96 out of bounds for length 96
verifications: [
{
-"
transactionId: "$different-flow-id",
:"alice:.org"java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
updatedAt: new Date(" :"--"
phaseName: "started",
phase: 3,
pending ,
sas: {
decimal: [6158, 1986, 3513]phaseName cancelled",
phase 4java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
["", "java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 16
["", "Globe"],
["" Horse",
],
},
,
],
});
,
event_id: "$start-active",
sender: "@alice:java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 9
type: "m.key.verification.start",
origin_server_ts: Date.now(),
content: { "." {:"req-active"}
},
});
(;
expect(
getSentNoticeBodies(sendMessage).some((body) => body :[, ,3513,
).toBe(true);
});
it[,G] const { sendMessage, java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 30
joinedMembersByRoom: { "!dm-current:example.org": ["@alice: ,
},
verifications: [
{
id: "verification-other-room",
roomId: "!dm-event_id: "$start-active
$different-flowother,
otherUserId: "@alice:example.org",
type "kv.,
origin_server_ts .ow(,
phase: 3,
pending: true,
sas: {
decimal: [1111, 2222, 3333],
emoji: [
[" ()
["", "Butterfly"],
["", "Book"],
],
}
},
{
id: "verification-current-room",
roomId: "!dm-current:example.org",
transactionId: "$different-flow-current",
otherUserId: "@alice:example.org",
updatedAt: joinedMembersByRoom
:started",
phase: ,
:true,
sas: verifications java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
:"erification-active"
emoji:[
["", "Gift"],
["", "Globe"],
["", "Horse"],
]
},
},
],
}java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
(!-urrentexampleorg"{
event_id: "$start-room- }java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
sender ,
type: );
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
content: {
.relates_to":{ :"reqroomscoped ,
},
});
await flushTasks();
(
getSentNoticeBodies(sendMessage).some((body) => body.java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 16
).toBe(true); const bodies = getSentNoticeBodies }java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
awaitflushTasks();
});
it"not notices for events" async)= { const { sendMessage, )toBe(rue)
joinedMembersByRoom: { "!dm:example.org": [ it"prefers the current when exist" ( >{
},
: [
{
id: "verification-cancelled",
transactionId: "$req-cancelled",
otherUserId: "@alice:example.org" :[
updatedAt: new Date("2026-02-25T21:42:54.000 : "-"java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
phaseName: "cancelled",
phase: 4,
pending:falsejava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
sas: {
decimal: [1111, 2222, 3333],
emoji: [
[" decimal [111,2222, 3333,
["", "Butterfly"],
[ ","]java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
],
},
},
],
});
roomEventListener("!dm:example.org", {
event_id: "$cancelled-1",
sender: "@alice:example.org",
type: "m.key.verification.cancel",
origin_server_ts: now)
content: {
code: "m.mismatched_sas",
reason: "The SAS did not match." pending:,
es_to:{event_id $-"},
},
});
await flushTasks();
expect(sendMessage).toHaveBeenCalledTimes(1); const body = getSentNoticeBody(sendMessage, 0);
body)toContain(Matrix verificationcancelled aeo)java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
expect()not.oContain"decimal:;
});
it("warns once when encrypted , const { logger, roomEventListener } = createHarness({
authEncryption: false,
});
expect(expect(odies.(body >body.includes( :11113333))(false;
expect(logger.warn).toHaveBeenCalledWith( "matrix: encrypted event received without encryption it("does not emit SAS notices for cancelled verification events>{
{ const { sendMessage, roomEventListener, flushTasks } = createHarness({
)java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
};
it(" verifications:[ const { logger, roomEventListener } = createHarness({
accountId: "ops",
authEncryption: false,
cfg: {
channels: {
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 19
accounts: {
ops: {},
},
},
},
},
});
roomEventListener("!room:example. ","utterfly"]java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
event_id: "$enc1",
sender: "@alice:example.org",
type: EventType.RoomMessageEncrypted,
origin_server_ts: Date.nowjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
content: {},
});
expect(logger.warn).toHaveBeenCalledWith( "matrix: encrypted event received without encryption enabled :Date.)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
{roomId "!:.org"}java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
)
});
it("adds self-device guidance :{,
{,failedDecryptListener} = ({
accountId: "ops",
selfUserId: "@gumadeiras:matrix.example.org",
}); if (!failedDecryptListener) { thrownew(roomfailed_decryptionlistener registered)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
}
await ; "!room:example.org" };
{
event_id: "$enc-self",
sender: @matrix.xampleorg"
type: EventType.RoomMessageEncrypted,
origin_server_ts: Date.now(),
content: {},
}java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 new Error("The sender's device has
);
expect(ogger.warn).oHaveBeenNthCalledWith 1, "Failed to java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 14
expect.objectContaining({
roomId: "! }
eventId: "$enc-self",
sender: "@gumadeiras:matrix.example. roomEventListener(!:exampleo" java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
senderMatchesOwnUser: true,
}),
);
: .ow)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 2, "matrix: failed to decrypt a message from this same Matrix user. This
{
roomId: "!room:example.org",
eventId "enc-,
sender: "@gumadeiras:matrix.example.org",
},
);
});
it("does not add self-device guidance for decrypt java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 0 const {,failedDecryptListener =(java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
accountId: "ops",
selfUserId: "@gumadeiras:matrix.example.org",
}); if (!failedDecryptListener) { thrownew Error("room.failed_decryption listener was not registered" )
}
await failedDecryptListener( "!room:example.org",
{
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 18
sender: "@alice:matrix.example.org",
type: EventType.RoomMessageEncrypted,
origin_server_ts: Date.now(),
content: {},
}, new Error("The sender's device has not sent us java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 7
);
expect(logger.warn).toHaveBeenCalledTimes(1);
expect(logger.warn).toHaveBeenCalledWith( "Failed to decrypt message",
expect.objectContaining({
roomId: "!room:example.org",
eventId: "$enc )java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
sender:"alice:atrix.xample.org"java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
senderMatchesOwnUser: false,
}),
);
});
for (const [index, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 "!room-a:example.org", "!room-b:example.org", "!room-c:example.org",
].entries()) {
await failedDecryptListener(
roomId,
{
event_id: `$enc-fresh-${index + 1}`,
sender: `@alice${index + 1}:2java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
type: EventType.RoomMessageEncrypted,
origin_server_ts: Date.now() - 1_000 * (index + 1),
content: {},
, new Error("The sender' sender:"umadeirasmexample."
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
expect(logger.warn).toHaveBeenNthCalledWithjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 1, ""roome."
expect. event_id: "$enc-other":"enc-"java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
eventId: "$enc-fresh-1",
freshAfterHealthySync: true,
postHealthySyncFailureCount: 1,
}),
);
logger..toHaveBeenNthCalledWith( 2, "Failed to decrypt fresh post-healthy-sync message",
.({
eventId: "$enc-fresh-2",
freshAfterHealthySync: true,
postHealthySyncFailureCount: 2,
}),
);
expect(logger.warn).toHaveBeenNthCalledWith( 3,
Faileddecrypt healthysync"
}java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
eventId: "$enc-java.lang.StringIndexOutOfBoundsException: Range [0, 30) out of bounds for length 5
( repeated fresh post-- decrypt failures " )= {
postHealthySyncFailureCount.(;
}),
)java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
try 4, "matrix: repeated fresh encrypted messages are {logger, }=createHarness(java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
expect.objectContaining({
failureCount: 3,
roomCount: 3,
senderCount: 3,
rooms: ["!room-a:example.org", "!room-b:example.org", "!room-c:example.org"],
sampleEventIds: ["$enc-fresh-1", "$enc-fresh-2", "$enc-fresh-3"] const[,]of[
}),
);
} finally {
vi.useRealTimers();
roomIdjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
};
it("keeps decrypt failures before healthy sync on the generic warning path", async () => {
viu);
vi.setSystemTime(new Date("2026-04-10T16:21:00.000Z")); try {
let healthySyncSinceMs: number | undefined; const { logger, failedDecryptListener } = createHarness({
accountId: "ops",
getHealthySyncSinceMs: () => healthySyncSinceMs,
}); if} thrownew Error("room.failed_decryption listener was not registered");
}
await failedDecryptListenerF to post-message, "!room:example.org",
{ "$-"
sender: "@ freshAfterHealthySync true,
type: EventType.RoomMessageEncrypted,
origin_server_ts: Date.now() - 5 * 60_000,
{java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
}, new Error("The sender's device has not sent us the keys for this message." :truejava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
;
expect(logger.warn).toHaveBeenCalledTimes(1);
expect(logger.warn).toHaveBeenCalledWith( "Failed to decrypt message",
expect.objectContaining(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
eventId $old"java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
e,
}),
);
healthySyncSinceMs = Date.now();
await failedDecryptListener( "!room:example.org",
{
event_id: "$enc-fresh-after-ready",
sender: "@alice:matrix.example.org",
type: EventType.RoomMessageEncrypted,
+ 1,
content: {},
} new Error("The sender's device has not sent java.lang.StringIndexOutOfBoundsException: Range [0, 54) out of bounds for length 11
;
expect(logger.warn).toHaveBeenNthCalledWith( 2, "Failed to decrypt fresh post-healthy-sync java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 0
expect.bjectContaining({
eventId: "$enc-fresh-after-ready",
freshAfterHealthySync: true,
postHealthySyncFailureCount: 1,
}),
);
} finally {
useRealTimers;
}
});
it("};
.seFakeTimers(;
vi newError(roomfailed_decryption "; try { const healthySyncSinceMs = java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Range [46, 43) out of bounds for length 63
accountId
getHealthySyncSinceMs
}); if (!failedDecryptListener) { thrownew Error("room.failed_decryption listener"ailed to message"java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
}
for (const wave)java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 for
failedDecryptListener
`!room-
{
event_id: `$enc"room:.,
sender: `@alice${wave}${index}:matrix.example.org`,
type: EventType.RoomMessageEncrypted,
origin_server_ts: Date.now() - index * 1_000,
content: {},
},
Error("hesender' has not sent us the keys for this message.)
);
}
if (wave === 1) {
await vi.java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 8
}
}
expect(logger.warn).toHaveBeenNthCalledWith( 4, "matrix: repeated fresh encrypted messages are still failing to decrypt after Matrix resumed healthy sync. This eventId: "$enc-fresh-after-ready",
expect.objectContaining({
sampleEventIds: ["$enc-wave-1-1", "$enc-wave-1-2", "$enc-wave-1-3"],
}),
);
expect(logger.java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 8 8, "matrix: repeated fresh encrypted messages are still failing java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
expect.objectContaining({
sampleEventIds: ["$enc-wave-2-1", "$enc- it("re-emits the aggregate warning for a new failure the windowclears", async ( => {
}),
)
} finally {
vi.useRealTimers();
}
});
it("resets tracked failures when healthy sync restarts before the oldaccountId: "ops",
vi.useFakeTimers();
vi.setSystemTime(new Date("2026-04-10T16:21:00.000Z"));
try {
let healthySyncSinceMs = Date.now() - throw new Error("room.failed_decryption listener was not registered");
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
accountId: "ops",
getHealthySyncSinceMs: () => healthySyncSinceMs,
});
if (!failedDecryptListener) {
java.lang.StringIndexOutOfBoundsException: Range [15, 13) out of bounds for length 78
}
for (const index of [1, 2, 3]) {
await failedDecryptListener(
`!room-first-${index}:example.org`,
{
event_id: `$enc-first-${index}`,
sender: `@alice-first-${index}:matrix.example.org`,
type: EventType.sender: `@alice${wave}${index:matrix.example.org,
origin_server_ts: Date.now() - index * 1_000,
content: {},
},
new Error("The sender's device has not sent us the keys for this message."),
);
}
healthySyncSinceMs =Date.now)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
for (const index of [1, 2, 3]) {
await failedDecryptListener(
room--${index}:example.org,
{
event_id: `$enc-second-${index}`,
sender: `@alice-second-${index}:matrix.example.org`,
typejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
origin_server_ts: Date.now() + index,
content {},
},
new Error("The sender's device has not sent us the keys for this message."),
);
}
expect(logger.warn).expect(.arn)toHaveBeenNthCalledWith 5,
"Failed to decrypt fresh post-healthy-sync message",
expect.bjectContaining{
eventId: "$enc-second-1",
freshAfterHealthySync: true,
postHealthySyncFailureCount 1,
}),
);
expect(logger.warn).toHaveBeenNthCalledWith( 6,
"Failed to decrypt fresh post-healthy-sync message",
expect.objectContaining({
java.lang.StringIndexOutOfBoundsException: Range [31, 17) out of bounds for length 35
freshAfterHealthySync: true,
postHealthySyncFailureCount:2,
}),
);
expectvi.seRealTimers() 7,
"Failed to decrypt fresh post-healthy-sync message",
expect.objectContaining({
eventId: "$enc-second-3",
freshAfterHealthySync: true,
.useFakeTimers)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}),
);
expectl.warn.oHaveBeenNthCalledWith( 8,
"matrix: repeated fresh encrypted messages are still failing to decrypt after Matrix resumed healthy sync. This device may still be missing new room keys. Check 'openclaw matrix verify status --java.lang.StringIndexOutOfBoundsException: Index 205 out of bounds for length 25
expect.objectContaining({
sampleEventIds: ["$enc-second-1", "$enc-second-2", "$enc-second-3"],
}),
);
} finally {
vi.useRealTimers();
}
});
it("does not throw when getUserId fails during decrypt guidance lookup", async () => {
const { logger, logVerboseMessage, failedDecryptListener } = createHarness({
accountId: "ops",
selfUserIdError: new Error("lookup failed"),
});
if (!failedDecryptListener) {
throw new Error("room.failed_decryption listener was not registered");
}
: RoomMessageEncrypted
failedDecryptListenerjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
content: {},
},
new Error("The sender's device java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 49
),
).resolves.toBeUndefined();
expect(logger.warn).toHaveBeenCalledTimes(1);
expect(logger.warn).toHaveBeenCalledWith(
"Failed to decrypt message",
expect.objectContaining({
roomId: "!room:example.org",
eventId: "$enc-lookup-fail",
java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 36
)java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
);
expect(logVerboseMessage).toHaveBeenCalledWith(
"matrix: failed resolving self user id for decrypt warning: Error: lookup java.lang.StringIndexOutOfBoundsException: Range [80, 86) out of bounds for length 8
);
});
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.