Skip to content
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 String.fromBase64Url() extension. #771

Merged
merged 1 commit into from
Nov 6, 2024
Merged

Fix String.fromBase64Url() extension. #771

merged 1 commit into from
Nov 6, 2024

Conversation

davidz25
Copy link
Contributor

@davidz25 davidz25 commented Nov 4, 2024

Turns out that Base64.UrlSafe.decode() changed its behavior in Kotlin 2.0 and we missed this and EU PID documents no longer has SD-JWT VC credentials as a result.

The root problem is that Base64.UrlSafe.decode() no longer ignores padding and our API contract in String.fromBase64Url() extension says it will. Fix this by using withPadding(PaddingOption.ABSENT_OPTIONAL) available in Kotlin 2.0.21.

See https://youtrack.jetbrains.com/issue/KT-69846 for more details.

Also fix errornous credential.delete() call in the catch handler invoked when that call had already thrown.

Test: EU PID now has SD-JWT VC credentials again.

Copy link
Contributor

@kdeus kdeus left a comment

Choose a reason for hiding this comment

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

Looks fine to me (including removing the extra delete), but I'd like Peter to take a look also.

Turns out that Base64.UrlSafe.decode() changed its behavior in Kotlin
2.0 and we missed this and EU PID documents no longer has SD-JWT VC
credentials as a result.

The root problem is that Base64.UrlSafe.decode() no longer ignores
padding and our API contract in String.fromBase64Url() extension says
it will. Fix this by using withPadding(PaddingOption.ABSENT_OPTIONAL)
available in Kotlin 2.0.21.

See https://youtrack.jetbrains.com/issue/KT-69846 for more details.

Test: EU PID now has SD-JWT VC credentials again.
Signed-off-by: David Zeuthen <[email protected]>
@davidz25 davidz25 merged commit 711b6ec into main Nov 6, 2024
5 checks passed
@davidz25 davidz25 deleted the fix-base64-bug branch November 6, 2024 16:41
@kdeus kdeus self-requested a review November 6, 2024 17:45
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.

3 participants