github.com/tada-team/tdproto@v1.51.57/tdapi/auth.go (about)

     1  package tdapi
     2  
     3  import "github.com/tada-team/tdproto"
     4  
     5  // RecoveryStatus:
     6  const (
     7  	Unknown2fa     = "unknown"
     8  	Unconfirmed2fa = "unconfirmed"
     9  	Confirmed2fa   = "confirmed"
    10  	Declined2fa    = "declined"
    11  )
    12  
    13  type Auth struct {
    14  	Token       string             `json:"token,omitempty"`
    15  	Me          tdproto.UserWithMe `json:"me"`
    16  	Required2fa bool               `json:"required2fa"`
    17  	Recovery2fa bool               `json:"recovery2fa"`
    18  	Method2fa   string             `json:"method2fa"`
    19  }
    20  
    21  type Auth2faSettingsResponse struct {
    22  	Enabled        bool   `json:"enabled"`
    23  	RecoveryStatus string `json:"recovery_status"`
    24  }
    25  
    26  type Auth2faMailRecovery struct {
    27  	CodeValidUntil tdproto.ISODateTimeString `json:"code_valid_until"`
    28  	NextCodeAt     tdproto.ISODateTimeString `json:"next_code_at"`
    29  	CodeLength     int                       `json:"code_length"`
    30  	Email          string                    `json:"email"`
    31  }
    32  
    33  type Auth2faSettingsMailValidation struct {
    34  	Enabled        bool                      `json:"enabled"`
    35  	RecoveryStatus string                    `json:"recovery_status"`
    36  	CodeValidUntil tdproto.ISODateTimeString `json:"code_valid_until"`
    37  	NextCodeAt     string                    `json:"next_code_at"`
    38  	CodeLength     int                       `json:"code_length"`
    39  }
    40  
    41  type basicPasswordUpdate struct {
    42  	NewPassword       string `json:"new_password"`
    43  	NewPasswordRepeat string `json:"new_password_repeat"`
    44  	Hint              string `json:"hint"`
    45  }
    46  
    47  type basicToken struct {
    48  	Token string `json:"token"`
    49  }
    50  
    51  type basicPassword struct {
    52  	Password string `json:"password"`
    53  }
    54  
    55  type basicEmail struct {
    56  	Email string `json:"email"`
    57  }
    58  
    59  type basicCode struct {
    60  	Code string `json:"code"`
    61  }
    62  
    63  type Auth2faForm struct {
    64  	basicToken
    65  	basicPassword
    66  }
    67  
    68  type Create2faPasswordForm struct {
    69  	basicPasswordUpdate
    70  }
    71  
    72  type Update2faPasswordForm struct {
    73  	basicPasswordUpdate
    74  	basicPassword
    75  }
    76  
    77  type Internal2faPasswordForm struct {
    78  	basicPassword
    79  }
    80  
    81  type SendMail2faConfirmForm struct {
    82  	basicPassword
    83  	basicEmail
    84  }
    85  
    86  type ConfirmMail2faForm struct {
    87  	basicPassword
    88  	basicCode
    89  	basicEmail
    90  }
    91  
    92  type AuthToken2faForm struct {
    93  	basicToken
    94  }
    95  
    96  type AuthCheckCode2faForm struct {
    97  	basicToken
    98  	basicCode
    99  }
   100  
   101  type AuthPasswordRecovery2faForm struct {
   102  	basicPasswordUpdate
   103  	basicToken
   104  	basicCode
   105  }