diff --git a/web/push-notif/notif-crypto-utils.js b/web/push-notif/notif-crypto-utils.js --- a/web/push-notif/notif-crypto-utils.js +++ b/web/push-notif/notif-crypto-utils.js @@ -840,14 +840,15 @@ encryptedPayload: string, type: OlmEncryptedMessageTypes, ): DecryptionResult { + // Memory is freed below after pickling. const session = new olm.Session(); - session.unpickle(picklingKey, pickledSession); const decryptedNotification: T = JSON.parse( session.decrypt(type, encryptedPayload), ); - const newPendingSessionUpdate = session.pickle(picklingKey); + session.free(); + const newUpdateCreationTimestamp = Date.now(); return { @@ -963,11 +964,13 @@ new TextDecoder().decode(serializedOlmData), ); + // Memory is freed below after pickling. const session = new olm.Session(); session.unpickle(picklingKey, pendingSessionUpdate); const encryptedNotification = session.encrypt(payload); - const newPendingSessionUpdate = session.pickle(picklingKey); + session.free(); + const updatedOlmData: NotificationsOlmDataType = { mainSession, pendingSessionUpdate: newPendingSessionUpdate,