lib/stytch/webauthn.rb in stytch-6.5.2 vs lib/stytch/webauthn.rb in stytch-6.6.0
- old
+ new
@@ -29,14 +29,14 @@
# The type of this field is +String+.
# user_agent::
# The user agent of the User.
# The type of this field is nilable +String+.
# authenticator_type::
- # The requested authenticator type of the WebAuthn device. The two valid value are platform and cross-platform. If no value passed, we assume both values are allowed.
+ # The requested authenticator type of the WebAuthn device. The two valid values are platform and cross-platform. If no value passed, we assume both values are allowed.
# The type of this field is nilable +String+.
# return_passkey_credential_options::
- # If true, the public_key_credential_creation_options returned will be optimized for Passkeys.
+ # If true, the `public_key_credential_creation_options` returned will be optimized for Passkeys. This includes making `residentKey` required, `userVerification` preferred, and ignoring the `authenticator_type` passed.
# The type of this field is nilable +Boolean+.
#
# == Returns:
# An object with the following fields:
# request_id::
@@ -79,17 +79,25 @@
# The type of this field is +String+.
# public_key_credential::
# The response of the [navigator.credentials.create()](https://www.w3.org/TR/webauthn-2/#sctn-createCredential).
# The type of this field is +String+.
# session_token::
- # The session token to authenticate.
+ # The `session_token` associated with a User's existing Session.
# The type of this field is nilable +String+.
# session_duration_minutes::
- # Set the session lifetime to be this many minutes from now; minimum of 5 and a maximum of 527040 minutes (366 days). Note that a successful authentication will continue to extend the session this many minutes.
+ # Set the session lifetime to be this many minutes from now. This will start a new session if one doesn't already exist,
+ # returning both an opaque `session_token` and `session_jwt` for this session. Remember that the `session_jwt` will have a fixed lifetime of
+ # five minutes regardless of the underlying session duration, and will need to be refreshed over time.
+ #
+ # This value must be a minimum of 5 and a maximum of 527040 minutes (366 days).
+ #
+ # If a `session_token` or `session_jwt` is provided then a successful authentication will continue to extend the session this many minutes.
+ #
+ # If the `session_duration_minutes` parameter is not specified, a Stytch session will not be created.
# The type of this field is nilable +Integer+.
# session_jwt::
- # The JWT to authenticate. You may provide a JWT that has expired according to its `exp` claim and needs to be refreshed. If the signature is valid and the underlying session is still active then Stytch will return a new JWT.
+ # The `session_jwt` associated with a User's existing Session.
# The type of this field is nilable +String+.
# session_custom_claims::
# Add a custom claims map to the Session being authenticated. Claims are only created if a Session is initialized by providing a value in `session_duration_minutes`. Claims will be included on the Session object and in the JWT. To update a key in an existing Session, supply a new value. To delete a key, supply a null value.
#
# Custom claims made with reserved claims ("iss", "sub", "aud", "exp", "nbf", "iat", "jti") will be ignored. Total custom claims size cannot exceed four kilobytes.
@@ -111,11 +119,11 @@
# The type of this field is +String+.
# session_jwt::
# The JSON Web Token (JWT) for a given Stytch Session.
# The type of this field is +String+.
# user::
- # The `user` object affected by this API call. See the [Get user endpoint](https://stytch.com/docs/api/get-user) for complete response field details.
+ # (no documentation yet)
# The type of this field is +User+ (+object+).
# status_code::
# 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.
# The type of this field is +Integer+.
# session::
@@ -135,12 +143,12 @@
request = {
user_id: user_id,
public_key_credential: public_key_credential
}
request[:session_token] = session_token unless session_token.nil?
- request[:session_jwt] = session_jwt unless session_jwt.nil?
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
+ request[:session_jwt] = session_jwt unless session_jwt.nil?
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
post_request('/v1/webauthn/register', request)
end
@@ -154,11 +162,11 @@
# The type of this field is +String+.
# user_id::
# The `user_id` of an active user the WebAuthn registration should be tied to.
# The type of this field is nilable +String+.
# return_passkey_credential_options::
- # If true, the public_key_credential_creation_options returned will be optimized for Passkeys.
+ # If true, the `public_key_credential_creation_options` returned will be optimized for Passkeys. This includes making `userVerification` preferred.
# The type of this field is nilable +Boolean+.
#
# == Returns:
# An object with the following fields:
# request_id::
@@ -263,9 +271,30 @@
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
post_request('/v1/webauthn/authenticate', request)
end
+ # Updates a WebAuthn registration.
+ #
+ # == Parameters:
+ # webauthn_registration_id::
+ # Globally unique UUID that identifies a WebAuthn registration in the Stytch API. The `webautn_registration_id` is used when you need to operate on a specific User's WebAuthn registartion.
+ # The type of this field is +String+.
+ # name::
+ # The `name` of the WebAuthn registration.
+ # The type of this field is +String+.
+ #
+ # == Returns:
+ # An object with the following fields:
+ # request_id::
+ # 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.
+ # The type of this field is +String+.
+ # status_code::
+ # 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.
+ # The type of this field is +Integer+.
+ # webauthn_registration::
+ # A WebAuthn registration.
+ # The type of this field is nilable +WebAuthnRegistration+ (+object+).
def update(
webauthn_registration_id:,
name:
)
request = {