You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-12-04 05:02:41 +03:00
fix linting errors
This commit is contained in:
@@ -88,7 +88,10 @@ describe("OlmDevice", function() {
|
|||||||
// At this moment only Alice (the “initiator” in setupSession) has a session
|
// At this moment only Alice (the “initiator” in setupSession) has a session
|
||||||
expect(exported.sessions).toEqual([]);
|
expect(exported.sessions).toEqual([]);
|
||||||
|
|
||||||
const MESSAGE = "The olm or proteus is an aquatic salamander in the family Proteidae";
|
const MESSAGE = (
|
||||||
|
"The olm or proteus is an aquatic salamander"
|
||||||
|
+ " in the family Proteidae"
|
||||||
|
);
|
||||||
const ciphertext = await aliceOlmDevice.encryptMessage(
|
const ciphertext = await aliceOlmDevice.encryptMessage(
|
||||||
bobOlmDevice.deviceCurve25519Key,
|
bobOlmDevice.deviceCurve25519Key,
|
||||||
sessionId,
|
sessionId,
|
||||||
@@ -109,7 +112,10 @@ describe("OlmDevice", function() {
|
|||||||
// this time we expect Bob to have a session to export
|
// this time we expect Bob to have a session to export
|
||||||
expect(exportedAgain.sessions).toHaveLength(1);
|
expect(exportedAgain.sessions).toHaveLength(1);
|
||||||
|
|
||||||
const MESSAGE_2 = "In contrast to most amphibians, the olm is entirely aquatic";
|
const MESSAGE_2 = (
|
||||||
|
"In contrast to most amphibians,"
|
||||||
|
+ " the olm is entirely aquatic"
|
||||||
|
);
|
||||||
const ciphertext_2 = await aliceOlmDevice.encryptMessage(
|
const ciphertext_2 = await aliceOlmDevice.encryptMessage(
|
||||||
bobOlmDevice.deviceCurve25519Key,
|
bobOlmDevice.deviceCurve25519Key,
|
||||||
sessionId,
|
sessionId,
|
||||||
|
|||||||
@@ -256,9 +256,17 @@ export function MatrixClient(opts) {
|
|||||||
|
|
||||||
if (opts.deviceToImport) {
|
if (opts.deviceToImport) {
|
||||||
if (this.deviceId) {
|
if (this.deviceId) {
|
||||||
logger.warn('not importing device because device ID is provided to constructor independently of exported data');
|
logger.warn(
|
||||||
|
'not importing device because'
|
||||||
|
+ ' device ID is provided to constructor'
|
||||||
|
+ ' independently of exported data',
|
||||||
|
);
|
||||||
} else if (this.credentials.userId) {
|
} else if (this.credentials.userId) {
|
||||||
logger.warn('not importing device because user ID is provided to constructor independently of exported data');
|
logger.warn(
|
||||||
|
'not importing device because'
|
||||||
|
+ ' user ID is provided to constructor'
|
||||||
|
+ ' independently of exported data',
|
||||||
|
);
|
||||||
} else if (!(opts.deviceToImport.deviceId)) {
|
} else if (!(opts.deviceToImport.deviceId)) {
|
||||||
logger.warn('not importing device because no device ID in exported data');
|
logger.warn('not importing device because no device ID in exported data');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -126,7 +126,12 @@ OlmDevice.prototype.init = async function(fromExportedDevice) {
|
|||||||
if (fromExportedDevice) {
|
if (fromExportedDevice) {
|
||||||
this._pickleKey = fromExportedDevice.pickleKey;
|
this._pickleKey = fromExportedDevice.pickleKey;
|
||||||
}
|
}
|
||||||
await _initialiseAccount(fromExportedDevice, this._cryptoStore, this._pickleKey, account);
|
await _initialiseAccount(
|
||||||
|
fromExportedDevice,
|
||||||
|
this._cryptoStore,
|
||||||
|
this._pickleKey,
|
||||||
|
account,
|
||||||
|
);
|
||||||
e2eKeys = JSON.parse(account.identity_keys());
|
e2eKeys = JSON.parse(account.identity_keys());
|
||||||
|
|
||||||
this._maxOneTimeKeys = account.max_number_of_one_time_keys();
|
this._maxOneTimeKeys = account.max_number_of_one_time_keys();
|
||||||
@@ -157,12 +162,20 @@ async function _initialiseAccount(fromExportedDevice, cryptoStore, pickleKey, ac
|
|||||||
session: session.session,
|
session: session.session,
|
||||||
lastReceivedMessageTs: session.lastReceivedMessageTs,
|
lastReceivedMessageTs: session.lastReceivedMessageTs,
|
||||||
};
|
};
|
||||||
cryptoStore.storeEndToEndSession(deviceKey, sessionId, sessionInfo, txn);
|
cryptoStore.storeEndToEndSession(
|
||||||
|
deviceKey,
|
||||||
|
sessionId,
|
||||||
|
sessionInfo,
|
||||||
|
txn,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
account.unpickle(pickleKey, fromExportedDevice.pickledAccount);
|
account.unpickle(pickleKey, fromExportedDevice.pickledAccount);
|
||||||
} else {
|
} else {
|
||||||
await cryptoStore.doTxn('readwrite', [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {
|
await cryptoStore.doTxn(
|
||||||
|
'readwrite',
|
||||||
|
[IndexedDBCryptoStore.STORE_ACCOUNT],
|
||||||
|
(txn) => {
|
||||||
cryptoStore.getAccount(txn, (pickledAccount) => {
|
cryptoStore.getAccount(txn, (pickledAccount) => {
|
||||||
if (pickledAccount !== null) {
|
if (pickledAccount !== null) {
|
||||||
account.unpickle(pickleKey, pickledAccount);
|
account.unpickle(pickleKey, pickledAccount);
|
||||||
@@ -172,7 +185,8 @@ async function _initialiseAccount(fromExportedDevice, cryptoStore, pickleKey, ac
|
|||||||
cryptoStore.storeAccount(txn, pickledAccount);
|
cryptoStore.storeAccount(txn, pickledAccount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ Crypto.prototype.init = async function(kwargs) {
|
|||||||
logger.log(
|
logger.log(
|
||||||
exportedOlmDevice
|
exportedOlmDevice
|
||||||
? "Crypto: initialising Olm device from exported device..."
|
? "Crypto: initialising Olm device from exported device..."
|
||||||
: "Crypto: initialising Olm device..."
|
: "Crypto: initialising Olm device...",
|
||||||
);
|
);
|
||||||
await this._olmDevice.init(exportedOlmDevice);
|
await this._olmDevice.init(exportedOlmDevice);
|
||||||
logger.log("Crypto: loading device list...");
|
logger.log("Crypto: loading device list...");
|
||||||
|
|||||||
Reference in New Issue
Block a user