auth

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppDir = home + "/.forestvpn/"
View Source
var Client = resty.New()
View Source
var DeviceFile = AppDir + "device.json"

var DeviceDir = AppDir + "device/"

View Source
var FirebaseAuthFile = AppDir + "firebase.json"

var AuthDir = AppDir + "auth/"

View Source
var SessionFile = AppDir + "session.json"
View Source
var WireguardConfig = AppDir + "fvpn0.conf"

var WireguardDir = AppDir + "wireguard/"

Functions

func BuyPremiumDialog

func BuyPremiumDialog() error

func HandleFirebaseAuthResponse

func HandleFirebaseAuthResponse(response *resty.Response) error

func HandleFirebaseSignInResponse

func HandleFirebaseSignInResponse(response *resty.Response) error

func Init

func Init() error

Creates directories structure

func IsAuthenticated

func IsAuthenticated() bool

func IsDeviceCreated

func IsDeviceCreated() bool

func IsRefreshTokenExists

func IsRefreshTokenExists() bool

func JsonDump

func JsonDump(data []byte, filepath string) error

func JsonLoad

func JsonLoad(filepath string) (map[string]string, error)

func LoadAccessToken

func LoadAccessToken() (string, error)

func LoadDeviceID

func LoadDeviceID() (string, error)

func LoadRefreshToken

func LoadRefreshToken() (string, error)

Types

type AuthClient

type AuthClient struct {
	ApiKey string
}

func (AuthClient) ExchangeRefreshForIdToken

func (c AuthClient) ExchangeRefreshForIdToken() (*resty.Response, error)

func (AuthClient) GetAccessToken

func (c AuthClient) GetAccessToken() (*resty.Response, error)

func (AuthClient) SignIn

func (c AuthClient) SignIn(form SignInForm) (*resty.Response, error)

func (AuthClient) SignUp

func (c AuthClient) SignUp(form SignUpForm) (*resty.Response, error)

type EmailField

type EmailField struct {
	Value string
}

func GetEmailField

func GetEmailField(email string) (EmailField, error)

func (EmailField) Validate

func (f EmailField) Validate() error

type Info

type Info struct {
	AdditionalProperties string
}

type InfoForm

type InfoForm struct {
	Type string
	Info Info
}

type LocationWrapper

type LocationWrapper struct {
	Location forestvpn_api.Location
	Type     string
}

type PasswordConfirmationField

type PasswordConfirmationField struct {
	Value []byte
}

Password confirmation is used in the *forest.auth.forms.SignUpForm

type PasswordField

type PasswordField struct {
	Value []byte
}

func (PasswordField) Validate

func (p PasswordField) Validate() error

type SignInForm

type SignInForm struct {
	EmailField
	PasswordField
}

func GetSignInForm

func GetSignInForm(email string, password []byte) (SignInForm, error)

Prompts user and fills the *forest.auth.forms.SignInForm with *forest.auth.forms.fields.EmailField and *forest.auth.forms.fields.PasswordField

type SignUpForm

type SignUpForm struct {
	SignInForm
	PasswordConfirmationField
}

func (SignUpForm) ValidatePasswordConfirmation

func (s SignUpForm) ValidatePasswordConfirmation() error

Compares *forest.auth.forms.SignUpForm.SignInForm.PasswordField and *forest.auth.forms.SignUpForm.PasswordConfirmationField

Jump to

Keyboard shortcuts

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