-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
optimization: some small optimizations on base64 encoding&decoding. #467
Conversation
88bcc4b
to
f890fbc
Compare
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 looks good to me. Would you please add yourself to the AUTHORS file?
Actually the test failures when running the github action here are real, I can also reproduce them locally. See https://github.com/zmartzone/lua-resty-openidc#running-tests for running the tests. |
for the errors in
Likewise To me it looks as if we can not replace I'll have to find the root cause of the error for the PKCE test failures at a different time, but this test is executing the SHA1 changes. |
After a second look the I will fix the test JWK in master - so once you rebase these tests should pass - but I believe we still need the extra-code that adds the necessary padding, we may just not have any test that requires it. As a reference: https://openid.net/specs/draft-jones-json-web-key-03.html#base64urllogic - so when parsing JWKs the code must expect values to not be padded. |
save the following code as t.lua local b64url = require("ngx.base64").encode_base64url
local unb64url = require("ngx.base64").decode_base64url
print(b64url("1"))
print(b64url("12"))
print(b64url("123"))
print(b64url("1234"))
print(unb64url(b64url("1")))
print(unb64url(b64url("12")))
print(unb64url(b64url("123")))
print(unb64url(b64url("1234")))
and then run resty t.lua, we can see that the urlencode is not padding, so the decode is not need to be padded. $ resty t.lua
MQ
MTI
MTIz
MTIzNA
1
12
123
1234 |
The test run on my site. Does the pending test matter? @bodewig |
sorry for the delay @zhuizhuhaomeng this looks fine. Could you please rebase your branch and squash your commits? Thank you. |
1 similar comment
sorry for the delay @zhuizhuhaomeng this looks fine. Could you please rebase your branch and squash your commits? Thank you. |
@bodewig I have rebased and squashed to the lastest master. |
Thank you for your patience |
No description provided.