web_authn
web_authn copied to clipboard
Documentation on how to generate values for context
Hello,
We're trying out your library and we're running into issues when generating values to build a context object. Specifically, any documentation on how to generate the following values would be great:
- client_data_json
- challenge
Could we help you document this in the Readme?
We're currently stuck at this step:
challenge = 'random-string-generated-by-rp-server'
client_data_json = Base64.urlsafe_encode64({
type: "webauthn.create",
challenge: challenge,
origin: request.base_url,
}.to_json, padding: false)
context = WebAuthn.context_for(
client_data_json, # NOTE: URL-safe Base64 encoded
origin: request.base_url,
challenge: challenge
)
This fails with Invalid Challenge. We're testing this in localhost, do we need https for the origin to be valid?
Thanks in advance.