stytch

package
v3.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EnvTest = config.EnvTest
	EnvLive = config.EnvLive
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attributes

type Attributes struct {
	// The ip address of the user.
	IPAddress string `json:"ip_address,omitempty"`
	// The user agent of the user.
	UserAgent string `json:"user_agent,omitempty"`
}

* Structure for the custom type Attributes

type AuthenticationFactor added in v3.6.0

type AuthenticationFactor struct {
	Type                string `json:"type,omitempty"`
	DeliveryMethod      string `json:"delivery_method,omitempty"`
	LastAuthenticatedAt string `json:"last_authenticated_at,omitempty"`

	EmailFactor       EmailFactor       `json:"email_factor,omitempty"`
	PhoneNumberFactor PhoneNumberFactor `json:"phone_number_factor,omitempty"`
	GoogleOAuthFactor GoogleOAuthFactor `json:"google_oauth_factor,omitempty"`
}

type Client

type Client struct {
	Config     *config.Config
	HTTPClient *http.Client
}

func New

func New(env config.Env, projectID string, secret string) *Client

func (*Client) NewRequest

func (c *Client) NewRequest(method string, path string, queryParams map[string]string,
	body []byte, v interface{}) error

newRequest is used by Call to generate and Do a http.Request

type Email

type Email struct {
	EmailID  string `json:"email_id,omitempty"`
	Email    string `json:"email,omitempty"`
	Verified bool   `json:"verified,omitempty"`
}

type EmailFactor added in v3.6.0

type EmailFactor struct {
	EmailID      string `json:"email_id,omitempty"`
	EmailAddress string `json:"email_address,omitempty"`
}

type EmailString

type EmailString struct {
	Email string `json:"email,omitempty"`
}

type GoogleOAuthFactor added in v3.6.0

type GoogleOAuthFactor struct {
	ID              string `json:"id,omitempty"`
	EmailID         string `json:"email_id,omitempty"`
	ProviderSubject string `json:"provider_subject,omitempty"`
}

type MagicLinksAuthenticateParams

type MagicLinksAuthenticateParams struct {
	Token                  string     `json:"token,omitempty"`
	Options                Options    `json:"options,omitempty"`
	Attributes             Attributes `json:"attributes,omitempty"`
	SessionToken           string     `json:"session_token,omitempty"`
	SessionDurationMinutes int32      `json:"session_duration_minutes,omitempty"`
}

type MagicLinksAuthenticateResponse

type MagicLinksAuthenticateResponse struct {
	RequestID    string  `json:"request_id,omitempty"`
	StatusCode   int     `json:"status_code,omitempty"`
	UserID       string  `json:"user_id,omitempty"`
	MethodID     string  `json:"method_id,omitempty"`
	SessionToken string  `json:"session_token,omitempty"`
	Session      Session `json:"session,omitempty"`
}

type MagicLinksCreateParams added in v3.4.0

type MagicLinksCreateParams struct {
	UserID            string     `json:"user_id,omitempty"`
	ExpirationMinutes int32      `json:"expiration_minutes,omitempty"`
	Attributes        Attributes `json:"attributes,omitempty"`
}

type MagicLinksCreateResponse added in v3.4.0

type MagicLinksCreateResponse struct {
	RequestID  string `json:"request_id,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	UserID     string `json:"user_id,omitempty"`
	Token      string `json:"token,omitempty"`
}

type MagicLinksEmailInviteParams

type MagicLinksEmailInviteParams struct {
	Email                   string     `json:"email"`
	InviteMagicLinkURL      string     `json:"invite_magic_link_url"`
	InviteExpirationMinutes int32      `json:"invite_expiration_minutes,omitempty"`
	Name                    Name       `json:"name,omitempty"`
	Attributes              Attributes `json:"attributes,omitempty"`
}

type MagicLinksEmailInviteResponse

type MagicLinksEmailInviteResponse struct {
	RequestID  string `json:"request_id,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	UserID     string `json:"user_id,omitempty"`
	EmailID    string `json:"email_id,omitempty"`
}

type MagicLinksEmailLoginOrCreateParams

type MagicLinksEmailLoginOrCreateParams struct {
	Email                   string     `json:"email"`
	LoginMagicLinkURL       string     `json:"login_magic_link_url"`
	SignupMagicLinkURL      string     `json:"signup_magic_link_url"`
	LoginExpirationMinutes  int32      `json:"login_expiration_minutes,omitempty"`
	SignupExpirationMinutes int32      `json:"signup_expiration_minutes,omitempty"`
	CreateUserAsPending     bool       `json:"create_user_as_pending,omitempty"`
	Attributes              Attributes `json:"attributes,omitempty"`
}

type MagicLinksEmailLoginOrCreateResponse

type MagicLinksEmailLoginOrCreateResponse struct {
	RequestID   string `json:"request_id,omitempty"`
	StatusCode  int    `json:"status_code,omitempty"`
	UserID      string `json:"user_id,omitempty"`
	EmailID     string `json:"email_id,omitempty"`
	UserCreated bool   `json:"user_created,omitempty"`
}

type MagicLinksEmailRevokeInviteParams

type MagicLinksEmailRevokeInviteParams struct {
	Email string `json:"email"`
}

type MagicLinksEmailRevokeInviteResponse

type MagicLinksEmailRevokeInviteResponse struct {
	RequestID  string `json:"request_id,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
}

type MagicLinksEmailSendParams

type MagicLinksEmailSendParams struct {
	Email                   string     `json:"email"`
	LoginMagicLinkURL       string     `json:"login_magic_link_url"`
	SignupMagicLinkURL      string     `json:"signup_magic_link_url"`
	LoginExpirationMinutes  int32      `json:"login_expiration_minutes,omitempty"`
	SignupExpirationMinutes int32      `json:"signup_expiration_minutes,omitempty"`
	Attributes              Attributes `json:"attributes,omitempty"`
}

MAGIC LINK - EMAIL

type MagicLinksEmailSendResponse

type MagicLinksEmailSendResponse struct {
	RequestID  string `json:"request_id,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	UserID     string `json:"user_id,omitempty"`
	EmailID    string `json:"email_id,omitempty"`
}

type Name

type Name struct {
	FirstName  string `json:"firstName,omitempty"`
	MiddleName string `json:"middleName,omitempty"`
	LastName   string `json:"lastName,omitempty"`
}

type OAuthAuthenticateParams added in v3.5.0

type OAuthAuthenticateParams struct {
	Token                  string                `json:"token,omitempty"`
	SessionManagementType  SessionManagementType `json:"session_management_type,omitempty"`
	SessionToken           string                `json:"session_token,omitempty"`
	SessionDurationMinutes int32                 `json:"session_duration_minutes,omitempty"`
}

type OAuthAuthenticateResponse added in v3.5.0

type OAuthAuthenticateResponse struct {
	RequestID       string        `json:"request_id,omitempty"`
	StatusCode      int           `json:"status_code,omitempty"`
	UserID          string        `json:"user_id,omitempty"`
	ProviderSubject string        `json:"provider_subject,omitempty"`
	ProviderType    ProviderType  `json:"provider_type,omitempty"`
	Session         *OAuthSession `json:"session,omitempty"`
}

type OAuthSession added in v3.5.0

type OAuthSession struct {
	Idp           *OAuthSessionIdp `json:"idp,omitempty"`
	StytchSession *StytchSession   `json:"stytch_session,omitempty"`
}

type OAuthSessionIdp added in v3.5.0

type OAuthSessionIdp struct {
	AccessToken  string `json:"access_token,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty"`
}

type OTPsAuthenticateParams

type OTPsAuthenticateParams struct {
	MethodID               string     `json:"method_id"`
	Code                   string     `json:"code"`
	Options                Options    `json:"options,omitempty"`
	Attributes             Attributes `json:"attributes,omitempty"`
	SessionToken           string     `json:"session_token,omitempty"`
	SessionDurationMinutes int32      `json:"session_duration_minutes,omitempty"`
}

type OTPsAuthenticateResponse

type OTPsAuthenticateResponse struct {
	RequestID    string  `json:"request_id,omitempty"`
	StatusCode   int     `json:"status_code,omitempty"`
	UserID       string  `json:"user_id,omitempty"`
	MethodID     string  `json:"method_id,omitempty"`
	SessionToken string  `json:"session_token,omitempty"`
	Session      Session `json:"session,omitempty"`
}

type OTPsEmailLoginOrCreateParams added in v3.3.0

type OTPsEmailLoginOrCreateParams struct {
	Email               string     `json:"email"`
	ExpirationMinutes   int32      `json:"expiration_minutes,omitempty"`
	Attributes          Attributes `json:"attributes,omitempty"`
	CreateUserAsPending bool       `json:"create_user_as_pending,omitempty"`
}

type OTPsEmailLoginOrCreateResponse added in v3.3.0

type OTPsEmailLoginOrCreateResponse struct {
	RequestID   string `json:"request_id,omitempty"`
	StatusCode  int    `json:"status_code,omitempty"`
	UserID      string `json:"user_id,omitempty"`
	EmailID     string `json:"email_id,omitempty"`
	UserCreated bool   `json:"user_created,omitempty"`
}

type OTPsEmailSendParams added in v3.3.0

type OTPsEmailSendParams struct {
	Email             string     `json:"email"`
	ExpirationMinutes int32      `json:"expiration_minutes,omitempty"`
	Attributes        Attributes `json:"attributes,omitempty"`
}

OTP - Email

type OTPsEmailSendResponse added in v3.3.0

type OTPsEmailSendResponse struct {
	RequestID  string `json:"request_id,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	UserID     string `json:"user_id,omitempty"`
	EmailID    string `json:"email_id,omitempty"`
}

type OTPsSMSLoginOrCreateParams

type OTPsSMSLoginOrCreateParams struct {
	PhoneNumber         string     `json:"phone_number"`
	ExpirationMinutes   int32      `json:"expiration_minutes,omitempty"`
	Attributes          Attributes `json:"attributes,omitempty"`
	CreateUserAsPending bool       `json:"create_user_as_pending,omitempty"`
}

type OTPsSMSLoginOrCreateResponse

type OTPsSMSLoginOrCreateResponse struct {
	RequestID   string `json:"request_id,omitempty"`
	StatusCode  int    `json:"status_code,omitempty"`
	UserID      string `json:"user_id,omitempty"`
	PhoneID     string `json:"phone_id,omitempty"`
	UserCreated bool   `json:"user_created,omitempty"`
}

type OTPsSMSSendParams

type OTPsSMSSendParams struct {
	PhoneNumber       string     `json:"phone_number"`
	ExpirationMinutes int32      `json:"expiration_minutes,omitempty"`
	Attributes        Attributes `json:"attributes,omitempty"`
}

OTP - SMS

type OTPsSMSSendResponse

type OTPsSMSSendResponse struct {
	RequestID  string `json:"request_id,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	UserID     string `json:"user_id,omitempty"`
	PhoneID    string `json:"phone_id,omitempty"`
}

type OTPsWhatsAppLoginOrCreateParams added in v3.1.0

type OTPsWhatsAppLoginOrCreateParams struct {
	PhoneNumber         string     `json:"phone_number"`
	ExpirationMinutes   int32      `json:"expiration_minutes,omitempty"`
	Attributes          Attributes `json:"attributes,omitempty"`
	CreateUserAsPending bool       `json:"create_user_as_pending,omitempty"`
}

type OTPsWhatsAppLoginOrCreateResponse added in v3.1.0

type OTPsWhatsAppLoginOrCreateResponse struct {
	RequestID   string `json:"request_id,omitempty"`
	StatusCode  int    `json:"status_code,omitempty"`
	UserID      string `json:"user_id,omitempty"`
	PhoneID     string `json:"phone_id,omitempty"`
	UserCreated bool   `json:"user_created,omitempty"`
}

type OTPsWhatsAppSendParams added in v3.1.0

type OTPsWhatsAppSendParams struct {
	PhoneNumber       string     `json:"phone_number"`
	ExpirationMinutes int32      `json:"expiration_minutes,omitempty"`
	Attributes        Attributes `json:"attributes,omitempty"`
}

OTP - WhatsApp

type OTPsWhatsAppSendResponse added in v3.1.0

type OTPsWhatsAppSendResponse struct {
	RequestID  string `json:"request_id,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	UserID     string `json:"user_id,omitempty"`
	PhoneID    string `json:"phone_id,omitempty"`
}

type Options

type Options struct {
	// Require that the ip address the magic link was requested from
	// matches the ip address it's clicked from.
	IPMatchRequired bool `json:"ip_match_required,omitempty"`
	// Require that the user agent the magic link was requested from
	// matches the user agent it's clicked from.
	UserAgentMatchRequired bool `json:"user_agent_match_required,omitempty"`
}

* Structure for the custom type Options

type PendingUsers

type PendingUsers struct {
	UserID       string        `json:"user_id,omitempty"`
	Name         Name          `json:"name,omitempty"`
	Emails       []Email       `json:"emails,omitempty"`
	PhoneNumbers []PhoneNumber `json:"phone_numbers,omitempty"`
	Status       string        `json:"status,omitempty"`
	InvitedAt    string        `json:"invited_at,omitempty"`
}

type PhoneNumber

type PhoneNumber struct {
	PhoneID     string `json:"phone_id,omitempty"`
	PhoneNumber string `json:"phone_number,omitempty"`
	Verified    bool   `json:"verified,omitempty"`
}

type PhoneNumberFactor added in v3.6.0

type PhoneNumberFactor struct {
	PhoneID     string `json:"phone_id,omitempty"`
	PhoneNumber string `json:"phone_number,omitempty"`
}

type PhoneNumberString

type PhoneNumberString struct {
	PhoneNumber string `json:"phone_number,omitempty"`
}

type ProviderType added in v3.5.0

type ProviderType string
const (
	ProviderTypeGoogle ProviderType = "Google"
)

type Session added in v3.2.0

type Session struct {
	SessionID             string                  `json:"session_id,omitempty"`
	UserID                string                  `json:"user_id,omitempty"`
	StartedAt             string                  `json:"started_at,omitempty"`
	LastAccessedAt        string                  `json:"last_accessed_at,omitempty"`
	ExpiresAt             string                  `json:"expires_at,omitempty"`
	Attributes            Attributes              `json:"attributes,omitempty"`
	AuthenticationFactors []*AuthenticationFactor `json:"authentication_factors,omitempty"`
}

* Structure for the custom type Session

type SessionManagementType added in v3.5.0

type SessionManagementType string
const (
	SessionManagementTypeIDP    SessionManagementType = "idp"
	SessionManagementTypeNone   SessionManagementType = "none"
	SessionManagementTypeStytch SessionManagementType = "stytch"
)

type SessionsAuthenticateParams added in v3.2.0

type SessionsAuthenticateParams struct {
	SessionToken           string `json:"session_token,omitempty"`
	SessionDurationMinutes int32  `json:"session_duration_minutes,omitempty"`
}

type SessionsAuthenticateResponse added in v3.2.0

type SessionsAuthenticateResponse struct {
	RequestID    string  `json:"request_id,omitempty"`
	Session      Session `json:"session,omitempty"`
	SessionToken string  `json:"session_token,omitempty"`
}

type SessionsGetParams added in v3.2.0

type SessionsGetParams struct {
	UserID string `json:"user_id"`
}

type SessionsGetResponse added in v3.2.0

type SessionsGetResponse struct {
	RequestID string    `json:"request_id,omitempty"`
	Sessions  []Session `json:"sessions,omitempty"`
}

type SessionsRevokeParams added in v3.2.0

type SessionsRevokeParams struct {
	SessionID    string `json:"session_id,omitempty"`
	SessionToken string `json:"session_token,omitempty"`
}

type SessionsRevokeResponse added in v3.2.0

type SessionsRevokeResponse struct {
	RequestID string `json:"request_id,omitempty"`
}

type StytchSession added in v3.6.0

type StytchSession struct {
	Session      Session `json:"session,omitempty"`
	SessionToken string  `json:"session_token,omitempty"`
}

type UsersCreateParams

type UsersCreateParams struct {
	Email               string     `json:"email,omitempty"`
	PhoneNumber         string     `json:"phone_number,omitempty"`
	Name                Name       `json:"name,omitempty"`
	CreateUserAsPending bool       `json:"create_user_as_pending,omitempty"`
	Attributes          Attributes `json:"attributes,omitempty"`
}

type UsersCreateResponse

type UsersCreateResponse struct {
	RequestID  string `json:"request_id,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	UserID     string `json:"user_id,omitempty"`
	EmailID    string `json:"email_id,omitempty"`
	PhoneID    string `json:"phone_id,omitempty"`
	Status     string `json:"status,omitempty"`
}

type UsersDeleteEmailResponse

type UsersDeleteEmailResponse struct {
	RequestID  string `json:"request_id,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	UserID     string `json:"user_id,omitempty"`
}

type UsersDeletePhoneNumberResponse

type UsersDeletePhoneNumberResponse struct {
	RequestID  string `json:"request_id,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	UserID     string `json:"user_id,omitempty"`
}

type UsersDeleteResponse

type UsersDeleteResponse struct {
	RequestID  string `json:"request_id,omitempty"`
	StatusCode int    `json:"status_code,omitempty"`
	UserID     string `json:"user_id,omitempty"`
}

type UsersGetPendingParams

type UsersGetPendingParams struct {
	Limit           int32  `json:"limit,omitempty"`
	StartingAfterID string `json:"starting_after_id,omitempty"`
}

type UsersGetPendingResponse

type UsersGetPendingResponse struct {
	RequestID       string         `json:"request_id,omitempty"`
	StatusCode      int            `json:"status_code,omitempty"`
	Users           []PendingUsers `json:"users,omitempty"`
	HasMore         bool           `json:"has_more,omitempty"`
	StartingAfterID string         `json:"starting_after_id,omitempty"`
	Total           int            `json:"total,omitempty"`
}

type UsersGetResponse

type UsersGetResponse struct {
	RequestID    string        `json:"request_id,omitempty"`
	StatusCode   int           `json:"status_code,omitempty"`
	UserID       string        `json:"user_id,omitempty"`
	Name         Name          `json:"name,omitempty"`
	Emails       []Email       `json:"emails,omitempty"`
	PhoneNumbers []PhoneNumber `json:"phone_numbers,omitempty"`
	Status       string        `json:"status,omitempty"`
}

type UsersUpdateParams

type UsersUpdateParams struct {
	Name         Name                `json:"name,omitempty"`
	Emails       []EmailString       `json:"emails,omitempty"`
	PhoneNumbers []PhoneNumberString `json:"phone_numbers,omitempty"`
	Attributes   Attributes          `json:"attributes,omitempty"`
}

type UsersUpdateResponse

type UsersUpdateResponse struct {
	RequestID    string        `json:"request_id,omitempty"`
	StatusCode   int           `json:"status_code,omitempty"`
	UserID       string        `json:"user_id,omitempty"`
	Emails       []Email       `json:"emails,omitempty"`
	PhoneNumbers []PhoneNumber `json:"phone_numbers,omitempty"`
}

Directories

Path Synopsis
otp
sms

Jump to

Keyboard shortcuts

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