class Stytch::WebAuthn
def register_start(
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
status_code::
The type of this field is +String+.
Options used for Passkey or WebAuthn registration.
public_key_credential_creation_options::
The type of this field is +String+.
The unique ID of the affected User.
user_id::
The type of this field is +String+.
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
request_id::
An object with the following fields:
== Returns:
The type of this field is nilable +Boolean+.
If true, the `public_key_credential_creation_options` returned will be optimized for Passkeys with `residentKey` set to `"required"` and `userVerification` set to `"preferred"`.
return_passkey_credential_options::
The type of this field is nilable +String+.
The requested authenticator type of the Passkey or WebAuthn device. The two valid values are platform and cross-platform. If no value passed, we assume both values are allowed.
authenticator_type::
The type of this field is nilable +String+.
The user agent of the User.
user_agent::
The type of this field is +String+.
The domain for Passkeys or WebAuthn. Defaults to `window.location.hostname`.
domain::
The type of this field is +String+.
The `user_id` of an active user the Passkey or WebAuthn registration should be tied to.
user_id::
== Parameters:
If you are not using the [webauthn-json](https://github.com/github/webauthn-json) library, the `public_key_credential_creation_options` will need to be converted to a suitable public key by unmarshalling the JSON, base64 decoding the user ID field, and converting user ID and the challenge fields into an array buffer.
After calling this endpoint, the browser will need to call [navigator.credentials.create()](https://www.w3.org/TR/webauthn-2/#sctn-createCredential) with the data from [public_key_credential_creation_options](https://w3c.github.io/webauthn/#dictionary-makecredentialoptions) passed to the [navigator.credentials.create()](https://www.w3.org/TR/webauthn-2/#sctn-createCredential) request via the public key argument. We recommend using the `create()` wrapper provided by the webauthn-json library.
To optimize for Passkeys, set the `return_passkey_credential_options` field to `true`.
Initiate the process of creating a new Passkey or WebAuthn registration.
def register_start( user_id:, domain:, user_agent: nil, authenticator_type: nil, return_passkey_credential_options: nil ) headers = {} request = { user_id: user_id, domain: domain } request[:user_agent] = user_agent unless user_agent.nil? request[:authenticator_type] = authenticator_type unless authenticator_type.nil? request[:return_passkey_credential_options] = return_passkey_credential_options unless return_passkey_credential_options.nil? post_request('/v1/webauthn/register/start', request, headers) end