With reference to:
While testing of Omemo messaging on aTalk, I encountered the following problem i.e.
neither the swordfish nor leopard is able to launch omemo session. I traced and found that the problem is due to corrupted session records in both the leopard and swordfish devices. The corruption session is with swordfish but different deviceID on the two devices.
Before an omemo session can be launched on aTalk, it checks for any UndecidedOmemoIdentity by sending a message: mOmemoManager.encrypt(bareJid, “Hi buddy!”);
However this causes SessionCipher#encrypt() to throw an UntrustedIdentityException on executed sessionState.getSenderChainKey(); as it contains zero key. The exception return only a simple error message i.e. “empty key” on swordfish and “key.length == 0” on leopard.
On swordfish, I am able to unlock the state by “purge unused identities” which purges the inactive omemoDevices and all its associated data. It happen that the corrupted session record belong to an inactive device.
However this cannot apply to leopard as the corrupted session is with swordfish and not leopard. I have tried but look like there is no simple solution to this problem.
Following are some alternatives I can think of:
- Filter through all the session records and delete any corrupted record, but this requires user action.
- Smack omemoManager auto repair/delete the corrupted session record
- Smack UntrustedIdentityException to include the omemoDevice that is having the corrupted record, so apk can proceed to delete it.
Do you have other alternatives on how to resolve the lock up problem?
=============== new update (20180816) ==============
After I have created the method to filter for corrupted session records, the test result shows that the locked up problem was not due to corrupted session record (in fact all session records on leopard are intact), but a missing session record for swordfish@atalk.org:1123277467. So the earlier proposal would not work.
swordfish@atalk.org:1123277467 is the new active omemoDevice get generated for account swordfish on Note-8. This omemoDevice is listed in the leopard identities table as active, but there is no record in its session table.
Any idea what has led to this problem; and the correct approach to unlock this state?
When is the session table record get generated, and what is the relationship between identity and session record, are they inter-dependent;
====== New input (20180817) =========
I have tried everything i.e. identity regen, purge inactive identities on both the devices. But none can unlock and get both device to have proper omemo messaging operation.
Finally I have to purge the whole omemo tables on both devices and rebuilt the omemo table data from scratch. Only then it works. However this option is only available in my debug version. I would really hope you are able to provide some insight to the whole problem, and a better and cleaner way to unlock the situation instead of purging the whole omemo tables.