Giter Club home page Giter Club logo

Comments (3)

mohitpubnub avatar mohitpubnub commented on June 10, 2024 1

Also,

Would it be possible to fix this and achieve the old behavior of returning null as expected?

one possible solution is:
If PubNub instance is initialised with cryptoModule and if subscription received unencrypted message then
listener with receive message as it's original form and message.error will contain error message.
you can implement a quick logic to return null from there if there is any failure.

or try catch-error with manual decryption if that is compatible with other app logic!

from javascript.

mohitpubnub avatar mohitpubnub commented on June 10, 2024

Initialising PubNub instance along with cryptoModule(legacyCryptoModule or aesCbcCryptoModule) won't break the listener in case of mixture of encrypted/unencrypted messages. pubnub initialisation with cryptoModule example snippet is here

In the description code snippet, Message is being decrypted manually. In case of possible unencrypted message, we need to catch the error and return null. If we want to return null instead original unencrypted message

Reason: cryptoModules are able to decrypted both 128 and 256 bit encrypted messages for backward compatibility. So now decrypt method throws Error with error message about failure reason instead returning null. So that user of native decrypt method can handle various scenarios based on failure reason.

from javascript.

simform-manan-mankodi avatar simform-manan-mankodi commented on June 10, 2024

Initialising PubNub instance along with cryptoModule(legacyCryptoModule or aesCbcCryptoModule) won't break the listener in case of mixture of encrypted/unencrypted messages. pubnub initialisation with cryptoModule example snippet is here

In the description code snippet, Message is being decrypted manually. In case of possible unencrypted message, we need to catch the error and return null. If we want to return null instead original unencrypted message

Reason: cryptoModules are able to decrypted both 128 and 256 bit encrypted messages for backward compatibility. So now decrypt method throws Error with error message about failure reason instead returning null. So that user of native decrypt method can handle various scenarios based on failure reason.

Thank you so much for the quick response. We need to use manual decryption for now so will catch & handle the error accordingly. 👍

Also would like to request a couple of updates in the guide here in the section If you are not specifying the cipher key as part of your PubNub configuration but encrypting messages as needed:

  • About mentioning the error handling change for the manual decryption method.
  • About updating the statement adding the CryptoModule to the SDKs was a non-breaking change in the best feasible manner, as this small issue might be a breaking change for some users of JS SDK.

Thanks again!

from javascript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.