-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix:signature mistmatch with encrypted data #122
Conversation
@@ -55,3 +55,6 @@ ${'$body' == 'null' ? '' : '$body'}'''; | |||
.replaceAll(RegExp(r'\/'), '_') | |||
.replaceAll(RegExp(r'\=*$'), ''); | |||
} | |||
|
|||
String encodePathSegament(String pathSegment) => | |||
Uri.encodeFull(pathSegment).replaceAll('/', '%2F').replaceAll('#', '%23'); |
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'm just curious, why Uri.encodeFull
method doesn't encode the whole path segment? Looks like you have to still replace /
with %2F
and #
with %23
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.
encodeFull consider /
as path segment separation character which is correct.
We may use encodecomponent but It encodes all special characters which doesn't fit our requirement for signature calculation and we may need to reverse by selecting like this:
Uri.encodeComponent(pathSegment).replaceAllMapped(
RegExp('%3D|%2B|%3A|%2A|%2C|%40|%24|%26|%28|%29'),
(match) => {
'%3D': '=',
'%2B': '+',
'%3A': ':',
'%2A': '*',
'%2C': ',',
'%40': '@',
'%24': '\$',
'%26': '&',
'%28': '(',
'%29': ')',
}[match.group(0)]!);
@pubnub-release-bot release dart as v4.3.2 |
🚀 Release successfully completed 🚀 |
fix: signature mismatch due to encoding difference
Fixes issue of getting signature mismatch exception while publishing encrypted data.