fedcm

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package fedcm implements the FedCM domain. This domain allows interacting with the FedCM dialog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(conn *rpcc.Conn) *domainClient

NewClient returns a client for the FedCM domain with the connection set to conn.

Types

type Account

type Account struct {
	AccountID         string     `json:"accountId"`                   // No description.
	Email             string     `json:"email"`                       // No description.
	Name              string     `json:"name"`                        // No description.
	GivenName         string     `json:"givenName"`                   // No description.
	PictureURL        string     `json:"pictureUrl"`                  // No description.
	IDPConfigURL      string     `json:"idpConfigUrl"`                // No description.
	IDPLoginURL       string     `json:"idpLoginUrl"`                 // No description.
	LoginState        LoginState `json:"loginState"`                  // No description.
	TermsOfServiceURL *string    `json:"termsOfServiceUrl,omitempty"` // These two are only set if the loginState is signUp
	PrivacyPolicyURL  *string    `json:"privacyPolicyUrl,omitempty"`  // No description.
}

Account Corresponds to IdentityRequestAccount

type AccountURLType

type AccountURLType string

AccountURLType The URLs that each account has

const (
	AccountURLTypeNotSet         AccountURLType = ""
	AccountURLTypeTermsOfService AccountURLType = "TermsOfService"
	AccountURLTypePrivacyPolicy  AccountURLType = "PrivacyPolicy"
)

AccountURLType as enums.

func (AccountURLType) String

func (e AccountURLType) String() string

func (AccountURLType) Valid

func (e AccountURLType) Valid() bool

type ClickDialogButtonArgs

type ClickDialogButtonArgs struct {
	DialogID     string       `json:"dialogId"`     // No description.
	DialogButton DialogButton `json:"dialogButton"` // No description.
}

ClickDialogButtonArgs represents the arguments for ClickDialogButton in the FedCM domain.

func NewClickDialogButtonArgs

func NewClickDialogButtonArgs(dialogID string, dialogButton DialogButton) *ClickDialogButtonArgs

NewClickDialogButtonArgs initializes ClickDialogButtonArgs with the required arguments.

type DialogButton

type DialogButton string

DialogButton The buttons on the FedCM dialog.

const (
	DialogButtonNotSet                  DialogButton = ""
	DialogButtonConfirmIDPLoginContinue DialogButton = "ConfirmIdpLoginContinue"
	DialogButtonErrorGotIt              DialogButton = "ErrorGotIt"
	DialogButtonErrorMoreDetails        DialogButton = "ErrorMoreDetails"
)

DialogButton as enums.

func (DialogButton) String

func (e DialogButton) String() string

func (DialogButton) Valid

func (e DialogButton) Valid() bool

type DialogClosedClient

type DialogClosedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*DialogClosedReply, error)
	rpcc.Stream
}

DialogClosedClient is a client for DialogClosed events. Triggered when a dialog is closed, either by user action, JS abort, or a command below.

type DialogClosedReply

type DialogClosedReply struct {
	DialogID string `json:"dialogId"` // No description.
}

DialogClosedReply is the reply for DialogClosed events.

type DialogShownClient

type DialogShownClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*DialogShownReply, error)
	rpcc.Stream
}

DialogShownClient is a client for DialogShown events.

type DialogShownReply

type DialogShownReply struct {
	DialogID   string     `json:"dialogId"`           // No description.
	DialogType DialogType `json:"dialogType"`         // No description.
	Accounts   []Account  `json:"accounts"`           // No description.
	Title      string     `json:"title"`              // These exist primarily so that the caller can verify the RP context was used appropriately.
	Subtitle   *string    `json:"subtitle,omitempty"` // No description.
}

DialogShownReply is the reply for DialogShown events.

type DialogType

type DialogType string

DialogType The types of FedCM dialogs.

const (
	DialogTypeNotSet          DialogType = ""
	DialogTypeAccountChooser  DialogType = "AccountChooser"
	DialogTypeAutoReauthn     DialogType = "AutoReauthn"
	DialogTypeConfirmIDPLogin DialogType = "ConfirmIdpLogin"
	DialogTypeError           DialogType = "Error"
)

DialogType as enums.

func (DialogType) String

func (e DialogType) String() string

func (DialogType) Valid

func (e DialogType) Valid() bool

type DismissDialogArgs

type DismissDialogArgs struct {
	DialogID        string `json:"dialogId"`                  // No description.
	TriggerCooldown *bool  `json:"triggerCooldown,omitempty"` // No description.
}

DismissDialogArgs represents the arguments for DismissDialog in the FedCM domain.

func NewDismissDialogArgs

func NewDismissDialogArgs(dialogID string) *DismissDialogArgs

NewDismissDialogArgs initializes DismissDialogArgs with the required arguments.

func (*DismissDialogArgs) SetTriggerCooldown

func (a *DismissDialogArgs) SetTriggerCooldown(triggerCooldown bool) *DismissDialogArgs

SetTriggerCooldown sets the TriggerCooldown optional argument.

type EnableArgs

type EnableArgs struct {
	DisableRejectionDelay *bool `json:"disableRejectionDelay,omitempty"` // Allows callers to disable the promise rejection delay that would normally happen, if this is unimportant to what's being tested. (step 4 of https://fedidcg.github.io/FedCM/#browser-api-rp-sign-in)
}

EnableArgs represents the arguments for Enable in the FedCM domain.

func NewEnableArgs

func NewEnableArgs() *EnableArgs

NewEnableArgs initializes EnableArgs with the required arguments.

func (*EnableArgs) SetDisableRejectionDelay

func (a *EnableArgs) SetDisableRejectionDelay(disableRejectionDelay bool) *EnableArgs

SetDisableRejectionDelay sets the DisableRejectionDelay optional argument. Allows callers to disable the promise rejection delay that would normally happen, if this is unimportant to what's being tested. (step 4 of https://fedidcg.github.io/FedCM/#browser-api-rp-sign-in)

type LoginState

type LoginState string

LoginState Whether this is a sign-up or sign-in action for this account, i.e. whether this account has ever been used to sign in to this RP before.

const (
	LoginStateNotSet LoginState = ""
	LoginStateSignIn LoginState = "SignIn"
	LoginStateSignUp LoginState = "SignUp"
)

LoginState as enums.

func (LoginState) String

func (e LoginState) String() string

func (LoginState) Valid

func (e LoginState) Valid() bool

type OpenURLArgs

type OpenURLArgs struct {
	DialogID       string         `json:"dialogId"`       // No description.
	AccountIndex   int            `json:"accountIndex"`   // No description.
	AccountURLType AccountURLType `json:"accountUrlType"` // No description.
}

OpenURLArgs represents the arguments for OpenURL in the FedCM domain.

func NewOpenURLArgs

func NewOpenURLArgs(dialogID string, accountIndex int, accountURLType AccountURLType) *OpenURLArgs

NewOpenURLArgs initializes OpenURLArgs with the required arguments.

type SelectAccountArgs

type SelectAccountArgs struct {
	DialogID     string `json:"dialogId"`     // No description.
	AccountIndex int    `json:"accountIndex"` // No description.
}

SelectAccountArgs represents the arguments for SelectAccount in the FedCM domain.

func NewSelectAccountArgs

func NewSelectAccountArgs(dialogID string, accountIndex int) *SelectAccountArgs

NewSelectAccountArgs initializes SelectAccountArgs with the required arguments.

Jump to

Keyboard shortcuts

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