Documentation
¶
Index ¶
- Constants
- Variables
- func DoTwoFactorJSONRequest(ctx context.Context, client *http.Client, headers http.Header, ...) (int, []byte, error)
- func ExtractServiceErrorCodes(respBody []byte) []string
- func IsAppleAccountActionRequiredSigninComplete(status int, respBody []byte) bool
- func SubmitTwoFactorCode(ctx context.Context, session SessionState, code string, ...) error
- type AuthOptions
- type AuthOptionsResponse
- type MarshalPayloadError
- type PhoneCodeRequestedError
- type RequestLogger
- type SessionState
- type TrustedPhoneNumber
- type TwoFactorChallenge
- type UnsupportedTwoFactorMethodError
Constants ¶
View Source
const ( TwoFactorMethodTrustedDevice = "trusted-device" TwoFactorMethodPhone = "phone" )
Variables ¶
View Source
var ErrNoTrustedPhoneNumbers = errors.New("no trusted phone numbers available")
Functions ¶
func DoTwoFactorJSONRequest ¶
func SubmitTwoFactorCode ¶
func SubmitTwoFactorCode(ctx context.Context, session SessionState, code string, getAuthOptions func(context.Context) (*AuthOptions, error), requestPhoneCode func(context.Context, int, string) error, submitTrustedDeviceCode func(context.Context, string) error, submitPhoneCode func(context.Context, string, int, string) error, finalize func(context.Context) error) error
Types ¶
type AuthOptions ¶
type AuthOptions struct {
NoTrustedDevices bool
TrustedPhoneNumbers []TrustedPhoneNumber
}
type AuthOptionsResponse ¶
type AuthOptionsResponse struct {
NoTrustedDevices bool `json:"noTrustedDevices"`
TrustedDevices []map[string]any `json:"trustedDevices"`
TrustedPhoneNumbers []TrustedPhoneNumber `json:"trustedPhoneNumbers"`
SecurityCode struct {
Length int `json:"length"`
} `json:"securityCode"`
}
func (*AuthOptionsResponse) AuthOptions ¶
func (opts *AuthOptionsResponse) AuthOptions() *AuthOptions
type MarshalPayloadError ¶
type MarshalPayloadError struct {
Err error
}
func (*MarshalPayloadError) Error ¶
func (e *MarshalPayloadError) Error() string
func (*MarshalPayloadError) Unwrap ¶
func (e *MarshalPayloadError) Unwrap() error
type PhoneCodeRequestedError ¶
func (*PhoneCodeRequestedError) Error ¶
func (e *PhoneCodeRequestedError) Error() string
func (*PhoneCodeRequestedError) Unwrap ¶
func (e *PhoneCodeRequestedError) Unwrap() error
type RequestLogger ¶
type SessionState ¶
type SessionState interface {
TwoFactorMethod() string
TwoFactorPhoneID() int
TwoFactorPhoneMode() string
TwoFactorDestination() string
TwoFactorCodeRequested() bool
SetPreparedTwoFactorState(method string, phoneID int, phoneMode, destination string, requested bool)
SetTwoFactorCodeRequested(requested bool)
}
type TrustedPhoneNumber ¶
type TwoFactorChallenge ¶
type TwoFactorChallenge struct {
Method string
Destination string
Requested bool
PhoneFallbackAvailable bool
}
func EnsureTwoFactorCodeRequested ¶
func EnsureTwoFactorCodeRequested(ctx context.Context, session SessionState, getAuthOptions func(context.Context) (*AuthOptions, error), requestPhoneCode func(context.Context, int, string) error) (*TwoFactorChallenge, error)
func PrepareTwoFactorChallenge ¶
func PrepareTwoFactorChallenge(ctx context.Context, session SessionState, getAuthOptions func(context.Context) (*AuthOptions, error)) (*TwoFactorChallenge, error)
func (*TwoFactorChallenge) IsPhoneMethod ¶
func (c *TwoFactorChallenge) IsPhoneMethod() bool
IsPhoneMethod reports whether the challenge uses Apple phone-code delivery.
type UnsupportedTwoFactorMethodError ¶
type UnsupportedTwoFactorMethodError struct {
Method string
}
func (*UnsupportedTwoFactorMethodError) Error ¶
func (e *UnsupportedTwoFactorMethodError) Error() string
Click to show internal directories.
Click to hide internal directories.