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

Make code sort of work with some base64 URL decoding. #1

Merged
merged 1 commit into from
Jul 25, 2022

Conversation

jeroenleenarts
Copy link
Contributor

No description provided.

public enum WebAuthn {
public static func validateAssertion(_ data: AssertionCredential, challengeProvided: String, publicKey: P256.Signing.PublicKey, logger: Logger) throws {
guard let clientObjectData = Data(base64Encoded: data.response.clientDataJSON) else {
guard let clientObjectData = data.response.clientDataJSON.base64URLDecodedData else {
Copy link
Member

Choose a reason for hiding this comment

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

I'll need to check the spec here. In my testing the assertion was not base64 USL decoded, so it may depend on the assertion and we might need to check some data to see which path to go down

Copy link
Member

Choose a reason for hiding this comment

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

Yep it's URL encoded, thanks!

@0xTim 0xTim mentioned this pull request Jul 4, 2022
Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

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

Thanks!

public enum WebAuthn {
public static func validateAssertion(_ data: AssertionCredential, challengeProvided: String, publicKey: P256.Signing.PublicKey, logger: Logger) throws {
guard let clientObjectData = Data(base64Encoded: data.response.clientDataJSON) else {
guard let clientObjectData = data.response.clientDataJSON.base64URLDecodedData else {
Copy link
Member

Choose a reason for hiding this comment

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

Yep it's URL encoded, thanks!

@0xTim 0xTim merged commit b385078 into brokenhandsio:main Jul 25, 2022
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.

None yet

2 participants