model

package
v0.96.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeTypeNone      = 0
	CodeTypeApp       = 1
	CodeTypeSms       = 2
	CodeTypeCall      = 3
	CodeTypeFlashCall = 4
)
View Source
const (
	CodeStateOk      = 1
	CodeStateSend    = 2
	CodeStateSent    = 3
	CodeStateReSent  = 6
	CodeStateSignIn  = 4
	CodeStateSignUp  = 5
	CodeStateDeleted = -1
)
View Source
const (
	QRCodeStateNew      = 1
	QRCodeStateAccepted = 2
	QRCodeStateSuccess  = 3
)

Variables

This section is empty.

Functions

func MakeCodeType

func MakeCodeType(phoneRegistered, allowFlashCall, currentNumber bool) (int, int)

FIXME(@benqi): ignore it.

Types

type PhoneCodeTransaction

type PhoneCodeTransaction struct {
	AuthKeyId             int64  `json:"auth_key_id"`
	SessionId             int64  `json:"session_id"`
	PhoneNumber           string `json:"phone_number"`
	PhoneNumberRegistered bool   `json:"phone_number_registered"`
	PhoneCode             string `json:"phone_code"`
	PhoneCodeHash         string `json:"phone_code_hash"`
	PhoneCodeExpired      int32  `json:"phone_code_expired"`
	PhoneCodeExtraData    string `json:"phone_code_extra_data"`
	SentCodeType          int    `json:"sent_code_type"`
	FlashCallPattern      string `json:"flash_call_pattern"`
	NextCodeType          int    `json:"next_code_type"`
	State                 int    `json:"state"`
}

TODO(@benqi): Add phone region

func (*PhoneCodeTransaction) ToAuthSentCode

func (m *PhoneCodeTransaction) ToAuthSentCode() *mtproto.Auth_SentCode

/////////////////////////////////////////////////////////////////////////////////////////////////// TODO(@benqi): 如果手机号已经注册,检查是否有其他设备在线,有则使用sentCodeTypeApp

否则使用sentCodeTypeSms

TODO(@benqi): 有则使用sentCodeTypeFlashCall和entCodeTypeCall??

type QRCodeTransaction

type QRCodeTransaction struct {
	AuthKeyId int64  `json:"auth_key_id"`
	ServerId  string `json:"server_id"`
	SessionId int64  `json:"session_id"`
	ApiId     int32  `json:"api_id"`
	ApiHash   string `json:"api_hash"`
	CodeHash  string `json:"code_hash"`
	ExpireAt  int64  `json:"expire_at"`
	UserId    int64  `json:"user_id"`
	State     int    `json:"state"`
}

func (*QRCodeTransaction) CheckByToken

func (m *QRCodeTransaction) CheckByToken(token []byte) bool

func (*QRCodeTransaction) Token

func (m *QRCodeTransaction) Token() []byte

Jump to

Keyboard shortcuts

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