1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2026-01-03 23:22:30 +03:00

Support for marking devices as verified

Add a 'verified' property to the response from MatrixClient.listDeviceKeys, and
add MatrixClient.setDeviceVerified to set it. Also changes the format of data
stored for user devices in the session store slightly (in a
backwards-compatible way).
This commit is contained in:
Richard van der Hoff
2016-06-08 12:55:09 +01:00
parent 7c3104b2ae
commit 9feeb0c580
3 changed files with 157 additions and 24 deletions

View File

@@ -183,8 +183,8 @@ describe("MatrixClient", function() {
describe("downloadKeys", function() {
it("should do an HTTP request and then store the keys", function(done) {
var borisKeys = {dev1: {a: 1}};
var chazKeys = {dev2: {a: 2}};
var borisKeys = {dev1: {algorithms: ["1"], keys: { "ed25519:dev1": "k1" }}};
var chazKeys = {dev2: {algorithms: ["2"], keys: { "ed25519:dev2": "k2" }}};
httpBackend.when("POST", "/keys/query").check(function(req) {
expect(req.data).toEqual({device_keys: {boris: {}, chaz: {}}});
@@ -197,8 +197,20 @@ describe("MatrixClient", function() {
client.downloadKeys(["boris", "chaz"]).then(function(res) {
expect(res).toEqual({
boris: borisKeys,
chaz: chazKeys
boris: {
dev1: {
verified: false,
keys: { "ed25519:dev1": "k1" },
algorithms: ["1"],
},
},
chaz: {
dev2: {
verified: false,
keys: { "ed25519:dev2" : "k2" },
algorithms: ["2"],
},
},
});
}).catch(utils.failTest).done(done);