-
Notifications
You must be signed in to change notification settings - Fork 211
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
feat: decoding of url-safe base64 encoding for oobnotes #4259
Conversation
To help the transition, we first implement decoding of url-safe base64 version (accepting both that and old version) and after a while we'll switch the encoding to url-safe one. Re fedimint#4040
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4259 +/- ##
==========================================
+ Coverage 58.06% 58.09% +0.02%
==========================================
Files 197 197
Lines 43700 43702 +2
==========================================
+ Hits 25376 25390 +14
+ Misses 18324 18312 -12 ☔ View full report in Codecov by Sentry. |
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.
Great idea!
let bytes = if let Ok(bytes) = BASE64_URL_SAFE.decode(s) { | ||
bytes | ||
} else { | ||
base64::engine::general_purpose::STANDARD.decode(s)? | ||
}; |
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.
Looked at the standard and there seems to be no case where there is a valid non-URL-safe base64 string that is also a valid url-safe base64 string encoding different data.
Let's backport so we can make the window between introducing decoding and switching encoding longer/allow earlier switching without breaking backwards compat guarantees. |
I see you were already a step ahead 😆 #4260 |
To help the transition, we first implement decoding of url-safe base64 version (accepting both that and old version) and after a while we'll switch the encoding to url-safe one.
Re #4040