CRNS-4: Updating dev token method (for compatibility with RN)#213
CRNS-4: Updating dev token method (for compatibility with RN)#213
Conversation
|
@vishalnarkhede I think copying code is bad since we won't get changes to the copied code. Isn't it better to add |
@ferhatelmas My thoughts behind it!!
|
Thanks for the detailed explanation.
I wish so but the package is at v0.1.0 so not stable, I believe. Also, there are better packages like universal-base64.
Then, it should be their responsibility to sign the token as they want.
Yes, (~7KB gzipped), that's why it's the less preferred solution. My suggestion is adding a dependency and using its api, instead of copying its source. See the above suggested package, for example but bynens' base64 or something else doesn't matter much as soon as we can update easily on changes. |
|
@ferhatelmas universal-base64 won't work for our purpose. If you check the source code, it's doing exactly what we were doing so far - And the reason I went for copying the function is because of this performance issue issue raised on github repo - mathiasbynens/base64#19 This issue is fixed in this PR (which is not merged yet) - mathiasbynens/base64#20 So I have used a code from this PR. I think then instead of adding it directly as dependency, we can create a fork of it and publish NPM package on our end for the same. But I am just not sure if its that necessary!! What do you think? Also @tbarbugli |
|
This exchange is educating for me, thanks. We're iterating and finding the best solution. I think it's unlikely to expect that PR to be merged in the current state because it is simply rewriting the whole source (fixes indentation, uses newer js, breaks old module syntax instead of fixing only the bug and there is an error in the implementation as you commented) In this PR, my concern is copying. Two drawbacks of copying I see:
Your suggestion sounds better to me since it resolves the second point of mine. When upstream is updated, we can update one line in package.json and good to go. On the other hand, to resolve the first point too. You might check other packages that work with RN by default. The package I mentioned was just an example. Since it's a core piece, there should be something (or we can even have ours). |
|
@tbarbugli @ferhatelmas Done!! |
0e3f1d7 to
9cadd0b
Compare
|
@vishalnarkhede it seems this PR does multiple things in addition to base64. Can we extract them? |
|
@ferhatelmas those other changes are very small. Don't think they are worth going through trouble of separating !! |
|
@vishalnarkhede I think yes for better tracking. For example, you fixed one of the typescript issues but it's actually a completely different fix and in its fix PR, it should close #216. |
Submit a pull request
CLA
Description of the pull request
If devToken is used on React Native, then
window.btoais not available (for obvious reasons). Thus we need some alternative ... hence adding a common method compatible with all clients.