You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-06 12:02:40 +03:00
Lint
This commit is contained in:
@@ -43,13 +43,14 @@ const MegolmDecryption = algorithms.DECRYPTION_CLASSES['m.megolm.v1.aes-sha2'];
|
|||||||
|
|
||||||
const ROOM_ID = '!ROOM:ID';
|
const ROOM_ID = '!ROOM:ID';
|
||||||
|
|
||||||
|
const SESSION_ID = 'o+21hSjP+mgEmcfdslPsQdvzWnkdt0Wyo00Kp++R8Kc';
|
||||||
const ENCRYPTED_EVENT = new MatrixEvent({
|
const ENCRYPTED_EVENT = new MatrixEvent({
|
||||||
type: 'm.room.encrypted',
|
type: 'm.room.encrypted',
|
||||||
room_id: '!ROOM:ID',
|
room_id: '!ROOM:ID',
|
||||||
content: {
|
content: {
|
||||||
algorithm: 'm.megolm.v1.aes-sha2',
|
algorithm: 'm.megolm.v1.aes-sha2',
|
||||||
sender_key: 'SENDER_CURVE25519',
|
sender_key: 'SENDER_CURVE25519',
|
||||||
session_id: 'o+21hSjP+mgEmcfdslPsQdvzWnkdt0Wyo00Kp++R8Kc',
|
session_id: SESSION_ID,
|
||||||
ciphertext: 'AwgAEjD+VwXZ7PoGPRS/H4kwpAsMp/g+WPvJVtPEKE8fmM9IcT/N'
|
ciphertext: 'AwgAEjD+VwXZ7PoGPRS/H4kwpAsMp/g+WPvJVtPEKE8fmM9IcT/N'
|
||||||
+ 'CiwPb8PehecDKP0cjm1XO88k6Bw3D17aGiBHr5iBoP7oSw8CXULXAMTkBl'
|
+ 'CiwPb8PehecDKP0cjm1XO88k6Bw3D17aGiBHr5iBoP7oSw8CXULXAMTkBl'
|
||||||
+ 'mkufRQq2+d0Giy1s4/Cg5n13jSVrSb2q7VTSv1ZHAFjUCsLSfR0gxqcQs',
|
+ 'mkufRQq2+d0Giy1s4/Cg5n13jSVrSb2q7VTSv1ZHAFjUCsLSfR0gxqcQs',
|
||||||
@@ -222,7 +223,7 @@ describe("MegolmBackup", function() {
|
|||||||
"qx37WTQrjZLz5tId/uBX9B3/okqAbV1ofl9UnHKno1eipByCpXleAAlAZoJgYnCDOQZD"
|
"qx37WTQrjZLz5tId/uBX9B3/okqAbV1ofl9UnHKno1eipByCpXleAAlAZoJgYnCDOQZD"
|
||||||
+ "QWzo3luTSfkF9pU1mOILCbbouubs6TVeDyPfgGD9i86J8irHjA",
|
+ "QWzo3luTSfkF9pU1mOILCbbouubs6TVeDyPfgGD9i86J8irHjA",
|
||||||
ROOM_ID,
|
ROOM_ID,
|
||||||
'o+21hSjP+mgEmcfdslPsQdvzWnkdt0Wyo00Kp++R8Kc',
|
SESSION_ID,
|
||||||
).then(() => {
|
).then(() => {
|
||||||
return megolmDecryption.decryptEvent(ENCRYPTED_EVENT);
|
return megolmDecryption.decryptEvent(ENCRYPTED_EVENT);
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
@@ -236,10 +237,10 @@ describe("MegolmBackup", function() {
|
|||||||
rooms: {
|
rooms: {
|
||||||
[ROOM_ID]: {
|
[ROOM_ID]: {
|
||||||
sessions: {
|
sessions: {
|
||||||
'o+21hSjP+mgEmcfdslPsQdvzWnkdt0Wyo00Kp++R8Kc': KEY_BACKUP_DATA,
|
SESSION_ID: KEY_BACKUP_DATA,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
return client.restoreKeyBackups(
|
return client.restoreKeyBackups(
|
||||||
|
@@ -1032,7 +1032,9 @@ MatrixClient.prototype.restoreKeyBackups = function(
|
|||||||
if (!roomData.sessions) continue;
|
if (!roomData.sessions) continue;
|
||||||
|
|
||||||
totalKeyCount += Object.keys(roomData.sessions).length;
|
totalKeyCount += Object.keys(roomData.sessions).length;
|
||||||
const roomKeys = keysFromRecoverySession(roomData.sessions, decryption, roomId, roomKeys);
|
const roomKeys = keysFromRecoverySession(
|
||||||
|
roomData.sessions, decryption, roomId, roomKeys,
|
||||||
|
);
|
||||||
for (const k of roomKeys) {
|
for (const k of roomKeys) {
|
||||||
k.room_id = roomId;
|
k.room_id = roomId;
|
||||||
keys.push(k);
|
keys.push(k);
|
||||||
|
@@ -974,7 +974,7 @@ Crypto.prototype._backupPayloadForSession = function(
|
|||||||
exportFormat,
|
exportFormat,
|
||||||
) {
|
) {
|
||||||
// new session.
|
// new session.
|
||||||
const session = new Olm.InboundGroupSession();
|
const session = new global.Olm.InboundGroupSession();
|
||||||
try {
|
try {
|
||||||
if (exportFormat) {
|
if (exportFormat) {
|
||||||
session.import_session(sessionKey);
|
session.import_session(sessionKey);
|
||||||
|
@@ -53,7 +53,10 @@ export function decodeRecoveryKey(recoverykey) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.length !== OLM_RECOVERY_KEY_PREFIX.length + global.Olm.PRIVATE_KEY_LENGTH + 1) {
|
if (
|
||||||
|
result.length !==
|
||||||
|
OLM_RECOVERY_KEY_PREFIX.length + global.Olm.PRIVATE_KEY_LENGTH + 1
|
||||||
|
) {
|
||||||
throw new Error("Incorrect length");
|
throw new Error("Incorrect length");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user