appleauth

package
v0.35.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearIrisSessions

func ClearIrisSessions()

ClearIrisSessions removes all stored iris session files.

func LoadIrisCookies

func LoadIrisCookies() (http.CookieJar, error)

LoadIrisCookies restores saved iris session cookies into a cookie jar. Returns the jar or an error if no session is available.

func SaveIrisCookies

func SaveIrisCookies(appleID string, jar http.CookieJar) error

SaveIrisCookies persists iris session cookies for future use.

Types

type AuthState

type AuthState struct {
	TrustedPhones     []TrustedPhone
	CodeLength        int
	HasTrustedDevices bool
}

AuthState holds the 2FA state after SRP authentication.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client handles Apple IDMSA SRP authentication and 2FA.

func NewClient

func NewClient() (*Client, error)

NewClient creates a new Apple authentication client.

func (*Client) CookieJar

func (c *Client) CookieJar() http.CookieJar

CookieJar returns the HTTP cookie jar for session persistence.

func (*Client) FetchServiceKey

func (c *Client) FetchServiceKey(ctx context.Context) error

FetchServiceKey fetches the Apple auth service key from Olympus.

func (*Client) RequestSMSCode

func (c *Client) RequestSMSCode(ctx context.Context, phoneID int) error

RequestSMSCode sends an SMS verification code to the specified phone.

func (*Client) SignIn

func (c *Client) SignIn(ctx context.Context, appleID, password string) (*AuthState, error)

SignIn performs SRP authentication with Apple ID. Returns an AuthState if 2FA is required, nil if sign-in completed directly.

func (*Client) TrustSession

func (c *Client) TrustSession(ctx context.Context) error

TrustSession establishes a trusted session after 2FA verification.

func (*Client) VerifyDeviceCode

func (c *Client) VerifyDeviceCode(ctx context.Context, code string) error

VerifyDeviceCode verifies a trusted device OTP code.

func (*Client) VerifySMSCode

func (c *Client) VerifySMSCode(ctx context.Context, code string, phoneID int) error

VerifySMSCode verifies an SMS OTP code.

type OnboardingResult

type OnboardingResult struct {
	KeyID    string
	IssuerID string
	TeamName string
}

OnboardingResult holds the outcome of the full onboarding flow.

func RunOnboarding

func RunOnboarding(ctx context.Context, client *Client, appleID string) (*OnboardingResult, error)

RunOnboarding executes the full onboarding flow after web authentication:

  1. Use session cookies from IDMSA auth
  2. GET /iris/v1/contentProviders -> issuer ID + team name
  3. POST /iris/v1/apiKeys -> key ID + .p8 content
  4. asc auth login -> register the key for CLI usage

type TrustedPhone

type TrustedPhone struct {
	ID                 int    `json:"id"`
	NumberWithDialCode string `json:"numberWithDialCode"`
}

TrustedPhone represents a phone number for SMS 2FA.

Jump to

Keyboard shortcuts

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