-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ECO-4995] Fix base64 url encoding/decoding #43
Conversation
Caution Review failedThe pull request is closed. WalkthroughThe changes involve updates to the JWT parsing and encoding functions in the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
3e22022
to
adfc1b7
Compare
export const toText = (base64: string) => { | ||
const base64Encoded = base64.replace(/-/g, '+').replace(/_/g, '/'); | ||
const padding = base64.length % 4 === 0 ? '' : '='.repeat(4 - (base64.length % 4)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we really need to add padding as per
https://gist.github.com/tatsuyasusukida/ce71456081748242a0bd4cbfcfe44eb7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe padding it's not necessary, message will be decoded without padding, but I think it's better to keep it, since padding is a part of base64 spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, this is helpful
export const toText = (base64: string) => { | ||
const base64Encoded = base64.replace(/-/g, '+').replace(/_/g, '/'); | ||
const padding = base64.length % 4 === 0 ? '' : '='.repeat(4 - (base64.length % 4)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe padding it's not necessary, message will be decoded without padding, but I think it's better to keep it, since padding is a part of base64 spec
Summary by CodeRabbit
New Features
Bug Fixes
socketId
method to return a base64 URL encoded JSON string for improved consistency.Documentation
socketId
method to reflect the change to base64 URL encoding.