Versions in this module Expand all Collapse all v0 v0.0.1 Dec 10, 2025 Changes in this version + const AppleService + const GoogleService + const StripeService + const SubscriptionTypeOneTime + const SubscriptionTypeSubscription + const TierFree + const TierPro + var ErrInvalidCode = errors.New("invalid code") + var ErrNoSalt = errors.New("not salt available, call GetSalt/Signup first") + var ErrNotLoggedIn = errors.New("not logged in") + type APIClient struct + func NewAPIClient(httpClient *http.Client, userInfo common.UserInfo, dataDir string) *APIClient + func (a *APIClient) CompleteChangeEmail(ctx context.Context, newEmail, password, code string) error + func (a *APIClient) CompleteRecoveryByEmail(ctx context.Context, email, newPassword, code string) error + func (a *APIClient) DataCapInfo(ctx context.Context) (*DataCapInfo, error) + func (a *APIClient) DeleteAccount(ctx context.Context, email, password string) error + func (a *APIClient) Devices() ([]Device, error) + func (a *APIClient) Login(ctx context.Context, email string, password string, deviceId string) (*protos.LoginResponse, error) + func (a *APIClient) Logout(ctx context.Context, email string) error + func (a *APIClient) OAuthLoginUrl(ctx context.Context, provider string) (string, error) + func (a *APIClient) ReferralAttach(ctx context.Context, code string) (bool, error) + func (a *APIClient) RemoveDevice(ctx context.Context, deviceID string) (*LinkResponse, error) + func (a *APIClient) SignUp(ctx context.Context, email, password string) error + func (a *APIClient) SignupEmailConfirmation(ctx context.Context, email, code string) error + func (a *APIClient) SignupEmailResendCode(ctx context.Context, email string) error + func (a *APIClient) StartChangeEmail(ctx context.Context, newEmail string, password string) error + func (a *APIClient) StartRecoveryByEmail(ctx context.Context, email string) error + func (a *APIClient) ValidateEmailRecoveryCode(ctx context.Context, email, code string) error + func (ac *APIClient) ActivationCode(ctx context.Context, email, resellerCode string) (*PurchaseResponse, error) + func (ac *APIClient) NewStripeSubscription(ctx context.Context, email, planID string) (*SubscriptionResponse, error) + func (ac *APIClient) NewUser(ctx context.Context) (*UserDataResponse, error) + func (ac *APIClient) PaymentRedirect(ctx context.Context, data PaymentRedirectData) (string, error) + func (ac *APIClient) StripeBillingPortalUrl(ctx context.Context) (string, error) + func (ac *APIClient) SubscriptionPaymentRedirectURL(ctx context.Context, data PaymentRedirectData) (string, error) + func (ac *APIClient) SubscriptionPlans(ctx context.Context, channel string) (*SubscriptionPlans, error) + func (ac *APIClient) UserData(ctx context.Context) (*UserDataResponse, error) + func (ac *APIClient) VerifySubscription(ctx context.Context, service SubscriptionService, data map[string]string) (status, subID string, err error) + type AuthClient interface + ChangeEmail func(ctx context.Context, loginData *protos.ChangeEmailRequest) error + CompleteChangeEmail func(ctx context.Context, loginData *protos.CompleteChangeEmailRequest) error + CompleteRecoveryByEmail func(ctx context.Context, loginData *protos.CompleteRecoveryByEmailRequest) error + DeleteAccount func(ctc context.Context, loginData *protos.DeleteUserRequest) error + GetSalt func(ctx context.Context, email string) (*protos.GetSaltResponse, error) + Login func(ctx context.Context, email, password, deviceID string, salt []byte) (*protos.LoginResponse, error) + LoginPrepare func(ctx context.Context, loginData *protos.PrepareRequest) (*protos.PrepareResponse, error) + SignOut func(ctx context.Context, logoutData *protos.LogoutRequest) error + SignUp func(ctx context.Context, email string, password string) ([]byte, error) + SignupEmailConfirmation func(ctx context.Context, data *protos.ConfirmSignupRequest) error + SignupEmailResendCode func(ctx context.Context, data *protos.SignupEmailResendRequest) error + StartRecoveryByEmail func(ctx context.Context, loginData *protos.StartRecoveryByEmailRequest) error + ValidateEmailRecoveryCode func(ctx context.Context, loginData *protos.ValidateRecoveryCodeRequest) (*protos.ValidateRecoveryCodeResponse, error) + type DataCapInfo struct + AllotmentEnd time.Time + AllotmentStart time.Time + BytesAllotted int + BytesRemaining int + type Device struct + ID string + Name string + type LinkResponse struct + ProToken string + UserID int + type PaymentRedirectData struct + BillingType SubscriptionType + DeviceName string + Email string + Plan string + Provider string + type PurchaseResponse struct + PaymentStatus string + Plan protos.Plan + Status string + type SubscriptionPlans struct + Plans []*protos.Plan + Providers map[string][]*protos.PaymentMethod + type SubscriptionResponse struct + ClientSecret string + CustomerId string + PublishableKey string + SubscriptionId string + type SubscriptionService string + type SubscriptionType string + type Tier int + type UserDataResponse struct