Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

KeyBackup: Int instead of boolean when using sqlite #6977

Closed
bmarty opened this issue Feb 24, 2020 · 3 comments
Closed

KeyBackup: Int instead of boolean when using sqlite #6977

bmarty opened this issue Feb 24, 2020 · 3 comments
Assignees
Labels
z-bug (Deprecated Label) z-p2 (Deprecated Label)

Comments

@bmarty
Copy link

bmarty commented Feb 24, 2020

When using sqlite db, as when using the demo script, keys backup requests

GET /_matrix/client/r0/room_keys/keys

return integer 0 or 1 for "is_verified" field.

Checking in the homeserver.sql file, we have:

sqlite> .dump e2e_room_keys
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "e2e_room_keys" ( user_id TEXT NOT NULL, room_id TEXT NOT NULL, session_id TEXT NOT NULL, version BIGINT NOT NULL, first_message_index INT, forwarded_count INT, is_verified BOOLEAN, session_data TEXT NOT NULL );
INSERT INTO e2e_room_keys VALUES('@alice_1548254180889ff0df4f9-254c-43ff-996f-82bf99814e0d:localhost:8480','!tnFrsAWORkbEsLMFMt:localhost:8480','QkA5mEsnmg5irnRwV7E1DiGioSFiFKC0gWikaZVNw0w',1,0,0,1,'{"ciphertext": "dMCa5hP4M25FYhC+JsQQzZ9QGH2SWlW66GsbNCSkgG75Gnv8dxFd/RtCKGVCMSI83Pv1eKWd5iXOm0fsoi09gy8t+0KO1a63KyUfjWaq8G/dPP7vxgUj+lonFpCFxjX1yGjBj2+buj5OBFl1s0wYAMzbqzfVhrYQQykvFfBCDCo9D01tSc/ieOyaQoHm+b6UC7xNZMpXOuqKR5MogQXbsCh3wD/pKxyGyBeEzGIl/hJbU7b7LDVhdxzv5HMlzqC4bkCE0ALf+KXrB7fkiD8JlWubEBOVq1DslVSw/04w/cO/DG6GQ8zLWaiRm8HG0zzOE1mdYsTjqCbhxJkp6bp6oJc8KXDlcJOyOp3BKDln1mHhZrm5RxtwWpO/eU7B7TPw3Ui7PxH0Z/wooaRPHZOOdtYFhoCxIcaKAPmzX0VPRQ/+t1w5IjAestHF/q8RTOI1I2WX1Vj6Bumzsm1/XDUbiqigaDz5CbKO7IdmJAPtYUDD4tcw8/8CmzVXTNQnUNU+nwxRdkca7ZZfc4k7zS4/yOAp9MEQk1ugKgWwrQgDh1qmBpk3YnXTv8q1oRvpNIZ2Ut5m9RnUwDIt+ZWusDtIIkie2M+ADIZZDf3yzDvzRP4", "ephemeral": "u7mRyE3BLQjmfSoiYDrhiDTm70oA4egqFJajo9HmgGw", "mac": "UXLXgh8IDzo"}');
...

So is_verified BOOLEAN, but 0 for the value

It break the parsing client side, at least for RiotX (Riot iOS is robust to that mistake)

matrix.org uses postgres and boolean are sent for is_verified, so no problem when using matrix.org

It's maybe just a serialization issue?

@bmarty bmarty changed the title Int instead of boolean KeyBackup: Int instead of boolean when using sqlite Feb 24, 2020
@erikjohnston
Copy link
Member

This is because sqlite doesn't really have booleans. We should stick a bool(...) around is_verified when we pull it out the database.

bmarty added a commit to element-hq/element-android that referenced this issue Feb 24, 2020
@neilisfragile neilisfragile added z-bug (Deprecated Label) z-p2 (Deprecated Label) labels Mar 9, 2020
@anoadragon453 anoadragon453 self-assigned this Mar 26, 2020
@anoadragon453
Copy link
Member

This should be fixed by #6977

@richvdh
Copy link
Member

richvdh commented Mar 27, 2020

This should be fixed by #6977

#7150 I think

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
z-bug (Deprecated Label) z-p2 (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

5 participants