From de1b545df14e1de8cf84e482367bf6f319275f12 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 28 Oct 2019 15:42:42 +0000 Subject: [PATCH] lint --- spec/unit/crypto/cross-signing.spec.js | 8 +++++--- spec/unit/crypto/verification/sas.spec.js | 21 ++++++++++++++------- src/client.js | 2 -- src/crypto/DeviceList.js | 4 ++-- src/crypto/Secrets.js | 2 +- src/crypto/index.js | 7 +++++-- 6 files changed, 27 insertions(+), 17 deletions(-) diff --git a/spec/unit/crypto/cross-signing.spec.js b/spec/unit/crypto/cross-signing.spec.js index 7d8ec5129..b38aa8d37 100644 --- a/spec/unit/crypto/cross-signing.spec.js +++ b/spec/unit/crypto/cross-signing.spec.js @@ -144,7 +144,9 @@ describe("Cross Signing", function() { alice.uploadKeySignatures = expect.createSpy().andCall(async (content) => { await olmlib.verifySignature( alice._crypto._olmDevice, - content["@alice:example.com"]["nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk"], + content["@alice:example.com"][ + "nqOvzeuGWT/sRx3h7+MHoInYj3Uk2LD/unI9kDYcHwk" + ], "@alice:example.com", "Osborne2", alice._crypto._olmDevice.deviceEd25519Key, ); @@ -694,7 +696,7 @@ describe("Cross Signing", function() { it("should offer to upgrade device verifications to cross-signing", async function() { const alice = await makeTestClient( - {userId: "@alice:example.com", deviceId: "Osborne2"} + {userId: "@alice:example.com", deviceId: "Osborne2"}, ); const bob = await makeTestClient( {userId: "@bob:example.com", deviceId: "Dynabook"}, @@ -720,7 +722,7 @@ describe("Cross Signing", function() { }, verified: 1, known: true, - } + }, }); alice._crypto._deviceList.storeCrossSigningForUser( "@bob:example.com", diff --git a/spec/unit/crypto/verification/sas.spec.js b/spec/unit/crypto/verification/sas.spec.js index e4ec05c33..8f64304ef 100644 --- a/spec/unit/crypto/verification/sas.spec.js +++ b/spec/unit/crypto/verification/sas.spec.js @@ -27,7 +27,6 @@ import olmlib from '../../../../lib/crypto/olmlib'; import sdk from '../../../..'; import {verificationMethods} from '../../../../lib/crypto'; -import DeviceInfo from '../../../../lib/crypto/deviceinfo'; import SAS from '../../../../lib/crypto/verification/SAS'; @@ -109,12 +108,16 @@ describe("SAS verification", function() { }, }; - alice.client._crypto._deviceList.storeDevicesForUser("@bob:example.com", BOB_DEVICES); + alice.client._crypto._deviceList.storeDevicesForUser( + "@bob:example.com", BOB_DEVICES, + ); alice.downloadKeys = () => { return Promise.resolve(); }; - bob.client._crypto._deviceList.storeDevicesForUser("@alice:example.com", ALICE_DEVICES); + bob.client._crypto._deviceList.storeDevicesForUser( + "@alice:example.com", ALICE_DEVICES, + ); bob.downloadKeys = () => { return Promise.resolve(); }; @@ -265,7 +268,9 @@ describe("SAS verification", function() { it("should verify a cross-signing key", async function() { const privateKeys = {}; - alice.httpBackend.when('POST', '/keys/device_signing/upload').respond(200, {}); + alice.httpBackend.when('POST', '/keys/device_signing/upload').respond( + 200, {}, + ); alice.httpBackend.when('POST', '/keys/signatures/upload').respond(200, {}); alice.client.on("cross-signing.savePrivateKeys", function(e) { privateKeys.alice = e; @@ -288,9 +293,11 @@ describe("SAS verification", function() { await bob.client.resetCrossSigningKeys(); - bob.client._crypto._deviceList.storeCrossSigningForUser("@alice:example.com", { - keys: alice.client._crypto._crossSigningInfo.keys, - }); + bob.client._crypto._deviceList.storeCrossSigningForUser( + "@alice:example.com", { + keys: alice.client._crypto._crossSigningInfo.keys, + }, + ); alice.httpBackend.when('POST', '/keys/query').respond(200, { failures: {}, diff --git a/src/client.js b/src/client.js index feb834ffb..8e8957221 100644 --- a/src/client.js +++ b/src/client.js @@ -53,8 +53,6 @@ import { encodeRecoveryKey, decodeRecoveryKey } from './crypto/recoverykey'; import { keyForNewBackup, keyForExistingBackup } from './crypto/backup_password'; import { randomString } from './randomstring'; -import IndexedDBCryptoStore from './crypto/store/indexeddb-crypto-store'; - // Disable warnings for now: we use deprecated bluebird functions // and need to migrate, but they spam the console with warnings. Promise.config({warnings: false}); diff --git a/src/crypto/DeviceList.js b/src/crypto/DeviceList.js index a8c02c98a..55cae532b 100644 --- a/src/crypto/DeviceList.js +++ b/src/crypto/DeviceList.js @@ -756,7 +756,7 @@ class DeviceListUpdateSerialiser { downloadUsers, opts, ).then((res) => { const dk = res.device_keys || {}; - const master_keys = res.master_keys || {}; + const masterKeys = res.masterKeys || {}; const ssks = res.self_signing_keys || {}; const usks = res.user_signing_keys || {}; @@ -770,7 +770,7 @@ class DeviceListUpdateSerialiser { prom = prom.delay(5).then(() => { return this._processQueryResponseForUser( userId, dk[userId], { - master: master_keys[userId], + master: masterKeys[userId], self_signing: ssks[userId], user_signing: usks[userId], }, diff --git a/src/crypto/Secrets.js b/src/crypto/Secrets.js index 31c610fea..e4aa36416 100644 --- a/src/crypto/Secrets.js +++ b/src/crypto/Secrets.js @@ -19,7 +19,7 @@ import logger from '../logger'; import olmlib from './olmlib'; import { randomString } from '../randomstring'; import { keyForNewBackup } from './backup_password'; -import { encodeRecoveryKey, decodeRecoveryKey } from './recoverykey'; +import { encodeRecoveryKey } from './recoverykey'; /** * Implements secret storage and sharing (MSC-1946) diff --git a/src/crypto/index.js b/src/crypto/index.js index 5f538e9b7..9379026c9 100644 --- a/src/crypto/index.js +++ b/src/crypto/index.js @@ -104,7 +104,8 @@ const KEY_BACKUP_KEYS_PER_REQUEST = 200; */ export default function Crypto(baseApis, sessionStore, userId, deviceId, clientStore, cryptoStore, roomList, verificationMethods) { - this._onDeviceListUserCrossSigningUpdated = this._onDeviceListUserCrossSigningUpdated.bind(this); + this._onDeviceListUserCrossSigningUpdated = + this._onDeviceListUserCrossSigningUpdated.bind(this); this._reEmitter = new ReEmitter(this); this._baseApis = baseApis; @@ -147,7 +148,9 @@ export default function Crypto(baseApis, sessionStore, userId, deviceId, ); // XXX: This isn't removed at any point, but then none of the event listeners // this class sets seem to be removed at any point... :/ - this._deviceList.on('userCrossSigningUpdated', this._onDeviceListUserCrossSigningUpdated); + this._deviceList.on( + 'userCrossSigningUpdated', this._onDeviceListUserCrossSigningUpdated, + ); this._reEmitter.reEmit(this._deviceList, ["crypto.devicesUpdated"]); // the last time we did a check for the number of one-time-keys on the