Page MenuHomePhabricator

[lib] Send logout message to primary device in useSecondaryDeviceLogOut
ClosedPublic

Authored by bartek on May 28 2024, 4:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 23, 4:17 PM
Unknown Object (File)
Mon, Dec 23, 4:17 PM
Unknown Object (File)
Mon, Dec 23, 4:17 PM
Unknown Object (File)
Mon, Dec 23, 4:17 PM
Unknown Object (File)
Mon, Dec 23, 4:17 PM
Unknown Object (File)
Mon, Dec 23, 4:17 PM
Unknown Object (File)
Wed, Dec 4, 5:54 PM
Unknown Object (File)
Sun, Dec 1, 10:29 AM
Subscribers

Details

Summary
  • Added Tunnelbroker message types, the same way as in D12133
  • Extend useSecondaryDeviceLogOut() to send Olm-encrypted TB message to the primary device before performing actual logout

Depends on D12223, D12240

Test Plan

Pressing "Secondary device logout" dev button makes primary device print a log:

LOG  Decrypted message from device mJc0HgRtPM1WTp+SWy/VE4C+243IznJPf2TGvriZ4A4: {"type":"LOG_OUT_SECONDARY_DEVICE"}

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

bartek held this revision as a draft.
bartek edited the test plan for this revision. (Show Details)
bartek retitled this revision from [DRAFT] Send logout message to primary device to [lib] Send logout message to primary device in useSecondaryDeviceLogOut.May 29 2024, 9:55 AM
bartek published this revision for review.May 29 2024, 10:14 AM
bartek added inline comments.
lib/actions/user-actions.js
263–273 ↗(On Diff #40754)

Not sure about this part but it works. I took it from the stack of D12133.

I used olmAPI.encrypt instead of encryptAndPersist because we're about to log out so there's no point in persisting this. Correct me if I'm wrong

lib/actions/user-actions.js
64–65 ↗(On Diff #40754)

can be merged

246 ↗(On Diff #40754)

debug leftover?

263–273 ↗(On Diff #40754)

Not sure about this part but it works. I took it from the stack of D12133.

I used olmAPI.encrypt instead of encryptAndPersist because we're about to log out so there's no point in persisting this. Correct me if I'm wrong

makes sense

However, in that case, you should first attempt to encrypt, and only if the session does not exist call createOlmSessionWithPeer - if there is a session this code will overwrite the existing one and use the new session to encrypt which could cause some issues, and is not what we want.

279–282 ↗(On Diff #40754)

what if the user e.g. has no internet connection but logs out anyway and his device cannot send messages through TB?

lib/actions/user-actions.js
263–273 ↗(On Diff #40754)

Good to know, I'll add a try-catch

279–282 ↗(On Diff #40754)

Review feedback, add try-catch before creating a new Olm session

This revision is now accepted and ready to land.Jun 6 2024, 1:26 AM