webauthn

package
v15.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticateParams

type AuthenticateParams struct {
	// PublicKeyCredential: The response of the
	// [navigator.credentials.create()](https://www.w3.org/TR/webauthn-2/#sctn-createCredential).
	PublicKeyCredential string `json:"public_key_credential,omitempty"`
	// SessionToken: The `session_token` associated with a User's existing Session.
	SessionToken string `json:"session_token,omitempty"`
	// SessionDurationMinutes: 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.
	SessionDurationMinutes int32 `json:"session_duration_minutes,omitempty"`
	// SessionJWT: The `session_jwt` associated with a User's existing Session.
	SessionJWT string `json:"session_jwt,omitempty"`
	// SessionCustomClaims: 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.
	SessionCustomClaims map[string]any `json:"session_custom_claims,omitempty"`
}

AuthenticateParams: Request type for `WebAuthn.Authenticate`.

type AuthenticateResponse

type AuthenticateResponse struct {
	// RequestID: 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.
	RequestID string `json:"request_id,omitempty"`
	// UserID: The unique ID of the affected User.
	UserID string `json:"user_id,omitempty"`
	// WebAuthnRegistrationID: The unique ID for the Passkey or WebAuthn registration.
	WebAuthnRegistrationID string `json:"webauthn_registration_id,omitempty"`
	// SessionToken: A secret token for a given Stytch Session.
	SessionToken string `json:"session_token,omitempty"`
	// SessionJWT: The JSON Web Token (JWT) for a given Stytch Session.
	SessionJWT string `json:"session_jwt,omitempty"`
	// 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.
	User users.User `json:"user,omitempty"`
	// StatusCode: 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.
	StatusCode int32 `json:"status_code,omitempty"`
	// Session: If you initiate a Session, by including `session_duration_minutes` in your authenticate call,
	// you'll receive a full Session object in the response.
	//
	//   See [GET sessions](https://stytch.com/docs/api/session-get) for complete response fields.
	//
	Session *sessions.Session `json:"session,omitempty"`
}

AuthenticateResponse: Response type for `WebAuthn.Authenticate`.

type AuthenticateStartParams

type AuthenticateStartParams struct {
	// Domain: The domain for Passkeys or WebAuthn. Defaults to `window.location.hostname`.
	Domain string `json:"domain,omitempty"`
	// UserID: The `user_id` of an active user the Passkey or WebAuthn registration should be tied to.
	UserID string `json:"user_id,omitempty"`
	// ReturnPasskeyCredentialOptions: If true, the `public_key_credential_creation_options` returned will be
	// optimized for Passkeys with `userVerification` set to `"preferred"`.
	//
	ReturnPasskeyCredentialOptions bool `json:"return_passkey_credential_options,omitempty"`
}

AuthenticateStartParams: Request type for `WebAuthn.AuthenticateStart`.

type AuthenticateStartResponse

type AuthenticateStartResponse struct {
	// RequestID: 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.
	RequestID string `json:"request_id,omitempty"`
	// UserID: The unique ID of the affected User.
	UserID string `json:"user_id,omitempty"`
	// PublicKeyCredentialRequestOptions: Options used for Passkey or WebAuthn authentication.
	PublicKeyCredentialRequestOptions string `json:"public_key_credential_request_options,omitempty"`
	// StatusCode: 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.
	StatusCode int32 `json:"status_code,omitempty"`
}

AuthenticateStartResponse: Response type for `WebAuthn.AuthenticateStart`.

type RegisterParams

type RegisterParams struct {
	// UserID: The `user_id` of an active user the Passkey or WebAuthn registration should be tied to.
	UserID string `json:"user_id,omitempty"`
	// PublicKeyCredential: The response of the
	// [navigator.credentials.create()](https://www.w3.org/TR/webauthn-2/#sctn-createCredential).
	PublicKeyCredential string `json:"public_key_credential,omitempty"`
	// SessionToken: The `session_token` associated with a User's existing Session.
	SessionToken string `json:"session_token,omitempty"`
	// SessionDurationMinutes: 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.
	SessionDurationMinutes int32 `json:"session_duration_minutes,omitempty"`
	// SessionJWT: The `session_jwt` associated with a User's existing Session.
	SessionJWT string `json:"session_jwt,omitempty"`
	// SessionCustomClaims: 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.
	SessionCustomClaims map[string]any `json:"session_custom_claims,omitempty"`
}

RegisterParams: Request type for `WebAuthn.Register`.

type RegisterResponse

type RegisterResponse struct {
	// RequestID: 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.
	RequestID string `json:"request_id,omitempty"`
	// UserID: The unique ID of the affected User.
	UserID string `json:"user_id,omitempty"`
	// WebAuthnRegistrationID: The unique ID for the Passkey or WebAuthn registration.
	WebAuthnRegistrationID string `json:"webauthn_registration_id,omitempty"`
	// SessionToken: A secret token for a given Stytch Session.
	SessionToken string `json:"session_token,omitempty"`
	// SessionJWT: The JSON Web Token (JWT) for a given Stytch Session.
	SessionJWT string     `json:"session_jwt,omitempty"`
	User       users.User `json:"user,omitempty"`
	// StatusCode: 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.
	StatusCode int32 `json:"status_code,omitempty"`
	// Session: If you initiate a Session, by including `session_duration_minutes` in your authenticate call,
	// you'll receive a full Session object in the response.
	//
	//   See [GET sessions](https://stytch.com/docs/api/session-get) for complete response fields.
	//
	Session *sessions.Session `json:"session,omitempty"`
}

RegisterResponse: Response type for `WebAuthn.Register`.

type RegisterStartParams

type RegisterStartParams struct {
	// UserID: The `user_id` of an active user the Passkey or WebAuthn registration should be tied to.
	UserID string `json:"user_id,omitempty"`
	// Domain: The domain for Passkeys or WebAuthn. Defaults to `window.location.hostname`.
	Domain string `json:"domain,omitempty"`
	// UserAgent: The user agent of the User.
	UserAgent string `json:"user_agent,omitempty"`
	// AuthenticatorType: 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.
	AuthenticatorType string `json:"authenticator_type,omitempty"`
	// ReturnPasskeyCredentialOptions: If true, the `public_key_credential_creation_options` returned will be
	// optimized for Passkeys with `residentKey` set to `"required"` and `userVerification` set to
	// `"preferred"`.
	//
	ReturnPasskeyCredentialOptions bool `json:"return_passkey_credential_options,omitempty"`
}

RegisterStartParams: Request type for `WebAuthn.RegisterStart`.

type RegisterStartResponse

type RegisterStartResponse struct {
	// RequestID: 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.
	RequestID string `json:"request_id,omitempty"`
	// UserID: The unique ID of the affected User.
	UserID string `json:"user_id,omitempty"`
	// PublicKeyCredentialCreationOptions: Options used for Passkey or WebAuthn registration.
	PublicKeyCredentialCreationOptions string `json:"public_key_credential_creation_options,omitempty"`
	// StatusCode: 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.
	StatusCode int32 `json:"status_code,omitempty"`
}

RegisterStartResponse: Response type for `WebAuthn.RegisterStart`.

type UpdateParams

type UpdateParams struct {
	// WebAuthnRegistrationID: Globally unique UUID that identifies a Passkey or WebAuthn registration in the
	// Stytch API. The `webauthn_registration_id` is used when you need to operate on a specific User's
	// WebAuthn registration.
	WebAuthnRegistrationID string `json:"webauthn_registration_id,omitempty"`
	// Name: The `name` of the WebAuthn registration or Passkey.
	Name string `json:"name,omitempty"`
}

UpdateParams: Request type for `WebAuthn.Update`.

type UpdateResponse

type UpdateResponse struct {
	// RequestID: 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.
	RequestID string `json:"request_id,omitempty"`
	// StatusCode: 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.
	StatusCode int32 `json:"status_code,omitempty"`
	// WebAuthnRegistration: A Passkey or WebAuthn registration.
	WebAuthnRegistration *users.WebAuthnRegistration `json:"webauthn_registration,omitempty"`
}

UpdateResponse: Response type for `WebAuthn.Update`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL