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 registration payload encoding #7

Merged
merged 2 commits into from
May 21, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: base64url-encode user id
  • Loading branch information
grzuy committed May 21, 2018
commit 224bde82bc7b6b7c603b89925400e09424b62c28
2 changes: 1 addition & 1 deletion lib/webauthn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.registration_payload
challenge: Base64.urlsafe_encode64(SecureRandom.random_bytes(16)),
pubKeyCredParams: [ES256_ALGORITHM],
rp: { name: RP_NAME },
user: { name: USER_NAME, displayName: USER_NAME, id: Base64.encode64(USER_ID) }
user: { name: USER_NAME, displayName: USER_NAME, id: Base64.urlsafe_encode64(USER_ID) }
}
}
end
Expand Down
2 changes: 1 addition & 1 deletion spec/webauthn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
user_info = @payload[:publicKey][:user]
expect(user_info[:name]).to eq("web-user")
expect(user_info[:displayName]).to eq("web-user")
expect(user_info[:id]).to eq("MQ==\n")
expect(user_info[:id]).to eq("MQ==")
end
end

Expand Down