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

docs: document validation phase in README #21

Merged
merged 1 commit into from
May 24, 2018
Merged
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
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,26 @@ credential_creation_options = WebAuthn.credential_creation_options
credential_creation_options[:challenge]

# Send `credential_creation_options` to the browser, so that they can be used
# when calling `navigator.credentials.create({ "publicKey": credentialCreationOptions })`
# to call `navigator.credentials.create({ "publicKey": credentialCreationOptions })`
```

#### Validation phase

TBD
```ruby
attestation_object = "..." # As came from the browser
client_data_json = "..." # As came from the browser

attestation_response = WebAuthn::AuthenticatorAttestationResponse.new(
attestation_object: attestation_object,
client_data_json: client_data_json
)

if attestation_response.valid?(original_challenge)
# Register the new user
else
# Handle error
end
```

## Development

Expand Down