diff --git a/lib/tunnelbroker/peer-to-peer-context.js b/lib/tunnelbroker/peer-to-peer-context.js index 308b8c4055..bf7eea5b36 100644 --- a/lib/tunnelbroker/peer-to-peer-context.js +++ b/lib/tunnelbroker/peer-to-peer-context.js @@ -146,7 +146,7 @@ async function processOutboundP2PMessages( }; 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 @@ function PeerToPeerProvider(props: Props): React.Node { 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 index 544d7c354c..50e34ca180 100644 --- a/lib/utils/olm-utils.js +++ b/lib/utils/olm-utils.js @@ -129,7 +129,7 @@ const olmSessionErrors = Object.freeze({ // 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 index 698f4ef740..53e429127b 100644 --- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp +++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp @@ -14,7 +14,7 @@ namespace crypto { // 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 @@ EncryptedData CryptoModule::encrypt( 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 @@ std::string CryptoModule::decrypt( 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 index 46dd948fcf..7775deb138 100644 --- a/web/shared-worker/worker/worker-crypto.js +++ b/web/shared-worker/worker/worker-crypto.js @@ -555,7 +555,7 @@ const olmAPI: OlmAPI = { } 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 olmAPI: OlmAPI = { } 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 olmAPI: OlmAPI = { const olmSession = cryptoStore.contentSessions[deviceID]; if (!olmSession) { - throw new Error(olmSessionErrors.sessionDoesNotExists); + throw new Error(olmSessionErrors.sessionDoesNotExist); } if ( @@ -663,7 +663,7 @@ const olmAPI: OlmAPI = { const olmSession = cryptoStore.contentSessions[deviceID]; if (!olmSession) { - throw new Error(olmSessionErrors.sessionDoesNotExists); + throw new Error(olmSessionErrors.sessionDoesNotExist); } if (