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

Allow specifying expected origin and rp_id when verifying public key credentials #425

Closed
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 4 additions & 2 deletions lib/webauthn/public_key_credential_with_assertion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ def self.response_class
WebAuthn::AuthenticatorAssertionResponse
end

def verify(challenge, public_key:, sign_count:, user_verification: nil)
def verify(challenge, expected_origin: nil, public_key:, sign_count:,
user_verification: nil, rp_id: (appid_extension_output ? appid : nil))
super

response.verify(
encoder.decode(challenge),
expected_origin,
public_key: encoder.decode(public_key),
sign_count: sign_count,
user_verification: user_verification,
rp_id: appid_extension_output ? appid : nil
rp_id: rp_id
)

true
Expand Down
5 changes: 3 additions & 2 deletions lib/webauthn/public_key_credential_with_attestation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ def self.response_class
WebAuthn::AuthenticatorAttestationResponse
end

def verify(challenge, user_verification: nil)
def verify(challenge, expected_origin: nil, user_verification: nil, rp_id: nil)
super

response.verify(encoder.decode(challenge), user_verification: user_verification)
response.verify(encoder.decode(challenge), expected_origin,
user_verification: user_verification, rp_id: rp_id)

true
end
Expand Down
Loading