mirror of https://github.com/openclaw/openclaw.git
Matrix: give humans time to confirm SAS
This commit is contained in:
parent
ce07255393
commit
ff85b50fe0
|
|
@ -256,7 +256,7 @@ describe("MatrixVerificationManager", () => {
|
|||
expect(manager.getVerificationSas(tracked.id).decimal).toEqual([1234, 5678, 9012]);
|
||||
});
|
||||
|
||||
it("auto-confirms inbound SAS after a short delay", async () => {
|
||||
it("auto-confirms inbound SAS after a human-safe delay", async () => {
|
||||
vi.useFakeTimers();
|
||||
const confirm = vi.fn(async () => {});
|
||||
const verifier = new MockVerifier(
|
||||
|
|
@ -285,10 +285,10 @@ describe("MatrixVerificationManager", () => {
|
|||
const manager = new MatrixVerificationManager();
|
||||
manager.trackVerificationRequest(request);
|
||||
|
||||
await vi.advanceTimersByTimeAsync(1000);
|
||||
await vi.advanceTimersByTimeAsync(29_000);
|
||||
expect(confirm).not.toHaveBeenCalled();
|
||||
|
||||
await vi.advanceTimersByTimeAsync(600);
|
||||
await vi.advanceTimersByTimeAsync(1_100);
|
||||
expect(confirm).toHaveBeenCalledTimes(1);
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ type MatrixVerificationSession = {
|
|||
|
||||
const MAX_TRACKED_VERIFICATION_SESSIONS = 256;
|
||||
const TERMINAL_SESSION_RETENTION_MS = 24 * 60 * 60 * 1000;
|
||||
const SAS_AUTO_CONFIRM_DELAY_MS = 1500;
|
||||
const SAS_AUTO_CONFIRM_DELAY_MS = 30_000;
|
||||
|
||||
export class MatrixVerificationManager {
|
||||
private readonly verificationSessions = new Map<string, MatrixVerificationSession>();
|
||||
|
|
|
|||
Loading…
Reference in New Issue