Skip to content

Commit

Permalink
docs: document validation phase in README
Browse files Browse the repository at this point in the history
  • Loading branch information
grzuy committed May 24, 2018
1 parent 1332caf commit d698cda
Showing 1 changed file with 16 additions and 2 deletions.
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

0 comments on commit d698cda

Please sign in to comment.