diff --git a/lib/tunnelbroker/peer-to-peer-context.js b/lib/tunnelbroker/peer-to-peer-context.js --- a/lib/tunnelbroker/peer-to-peer-context.js +++ b/lib/tunnelbroker/peer-to-peer-context.js @@ -146,7 +146,7 @@ }; await sendMessageToPeer(encryptedMessage); } catch (e) { - if (!e.message?.includes(olmSessionErrors.sessionDoesNotExists)) { + if (!e.message?.includes(olmSessionErrors.sessionDoesNotExist)) { console.log(`Error sending messages to peer ${peerDeviceID}`, e); break; } @@ -325,7 +325,7 @@ payload: JSON.stringify(encryptedMessage), }); } catch (e) { - if (!e.message?.includes(olmSessionErrors.sessionDoesNotExists)) { + if (!e.message?.includes(olmSessionErrors.sessionDoesNotExist)) { console.log( `Error sending messages to peer ${recipient.deviceID}`, e, diff --git a/lib/utils/olm-utils.js b/lib/utils/olm-utils.js --- a/lib/utils/olm-utils.js +++ b/lib/utils/olm-utils.js @@ -129,7 +129,7 @@ // This definition should remain in sync with the value defined in // the corresponding .cpp file // at `native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp`. - sessionDoesNotExists: 'SESSION_DOES_NOT_EXISTS', + sessionDoesNotExist: 'SESSION_DOES_NOT_EXIST', // Error thrown when attempting to decrypt a message encrypted // with an already replaced old session. // This definition should remain in sync with the value defined in diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp --- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp +++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp @@ -14,7 +14,7 @@ // This definition should remain in sync with the value defined in // the corresponding JavaScript file at `lib/utils/olm-utils.js`. -const std::string SESSION_DOES_NOT_EXISTS_ERROR{"SESSION_DOES_NOT_EXISTS"}; +const std::string SESSION_DOES_NOT_EXIST_ERROR{"SESSION_DOES_NOT_EXIST"}; const std::string INVALID_SESSION_VERSION_ERROR{"INVALID_SESSION_VERSION"}; CryptoModule::CryptoModule(std::string id) : id{id} { @@ -386,7 +386,7 @@ const std::string &targetDeviceId, const std::string &content) { if (!this->hasSessionFor(targetDeviceId)) { - throw std::runtime_error{SESSION_DOES_NOT_EXISTS_ERROR}; + throw std::runtime_error{SESSION_DOES_NOT_EXIST_ERROR}; } return this->sessions.at(targetDeviceId)->encrypt(content); } @@ -395,7 +395,7 @@ const std::string &targetDeviceId, EncryptedData &encryptedData) { if (!this->hasSessionFor(targetDeviceId)) { - throw std::runtime_error{SESSION_DOES_NOT_EXISTS_ERROR}; + throw std::runtime_error{SESSION_DOES_NOT_EXIST_ERROR}; } auto session = this->sessions.at(targetDeviceId); if (encryptedData.sessionVersion.has_value() && diff --git a/web/shared-worker/worker/worker-crypto.js b/web/shared-worker/worker/worker-crypto.js --- a/web/shared-worker/worker/worker-crypto.js +++ b/web/shared-worker/worker/worker-crypto.js @@ -555,7 +555,7 @@ } const olmSession = cryptoStore.contentSessions[deviceID]; if (!olmSession) { - throw new Error(olmSessionErrors.sessionDoesNotExists); + throw new Error(olmSessionErrors.sessionDoesNotExist); } const encryptedContent = olmSession.session.encrypt(content); @@ -577,7 +577,7 @@ } const olmSession = cryptoStore.contentSessions[deviceID]; if (!olmSession) { - throw new Error(olmSessionErrors.sessionDoesNotExists); + throw new Error(olmSessionErrors.sessionDoesNotExist); } const encryptedContent = olmSession.session.encrypt(content); @@ -632,7 +632,7 @@ const olmSession = cryptoStore.contentSessions[deviceID]; if (!olmSession) { - throw new Error(olmSessionErrors.sessionDoesNotExists); + throw new Error(olmSessionErrors.sessionDoesNotExist); } if ( @@ -663,7 +663,7 @@ const olmSession = cryptoStore.contentSessions[deviceID]; if (!olmSession) { - throw new Error(olmSessionErrors.sessionDoesNotExists); + throw new Error(olmSessionErrors.sessionDoesNotExist); } if (