Skip to content

Support binary token message#1

Open
mdimas wants to merge 5 commits intomasterfrom
md_support_binary_message
Open

Support binary token message#1
mdimas wants to merge 5 commits intomasterfrom
md_support_binary_message

Conversation

@mdimas
Copy link

@mdimas mdimas commented Mar 8, 2019

By default the module expects the token message to be UTF-8. That causes a problem in our current usage where the token content is gzipped during creation. After toString('utf-8') is called on the message buffer there is no way to get the original binary back. The goal of this PR is to add the ability to specify that the content is binary without breaking any backward compatibility.

@change/platform @change/fe-platform


[ data, footer, nonce ] = (utils.parse('utf-8'))(data, footer, nonce);
if (this._binary) {
[ data ] = (utils.parse('utf-8'))(data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be "binary" rather than "utf-8"?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I have no idea how the test was passing.

Copy link
Member

@quaelin quaelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good... but as getting character encoding conversions right can be tricky in practice, have you tested that this actually works with tokens generated by our Ruby library?

@mdimas
Copy link
Author

mdimas commented Mar 8, 2019

I did test it by manually editing the module in node_modules when I was tracking down the problem. I should test it with this approach though.

@mdimas
Copy link
Author

mdimas commented Mar 8, 2019

Tested with this branch now and it verifies and unzips the ruby token successfully. 🕺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants