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 TrustedPhoneSelectionError
- type TwoFactorChallenge
- type TwoFactorPreference
- type UnsupportedTwoFactorMethodError
Constants ¶
View Source
const ( TwoFactorMethodTrustedDevice = "trusted-device" TwoFactorMethodPhone = "phone" )
View Source
const TwoFactorDeliverySMS = "sms"
TwoFactorDeliverySMS asks Apple to text the verification code to a trusted phone number even when trusted devices could receive it.
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
TwoFactorPreference() TwoFactorPreference
SetPreparedTwoFactorState(method string, phoneID int, phoneMode, destination string, requested bool)
SetTwoFactorCodeRequested(requested bool)
}
type TrustedPhoneNumber ¶
type TrustedPhoneSelectionError ¶
type TrustedPhoneSelectionError struct {
RequestedID int
Phones []TrustedPhoneNumber
}
TrustedPhoneSelectionError reports that the requested trusted phone number could not be resolved. RequestedID is zero when several numbers matched.
func (*TrustedPhoneSelectionError) Error ¶
func (e *TrustedPhoneSelectionError) Error() string
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 TwoFactorPreference ¶
type TwoFactorPreference struct {
Delivery string
// PhoneID selects a trusted phone number; zero means the only one.
PhoneID int
}
TwoFactorPreference is the caller's requested verification delivery. The zero value keeps Apple's default: trusted devices first, phone fallback after.
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.