matrix-appservice-kakaotalk/matrix_appservice_kakaotalk/kt/types/api/auth_api_client.py

101 lines
2.8 KiB
Python

# matrix-appservice-kakaotalk - A Matrix-KakaoTalk puppeting bridge.
# Copyright (C) 2022 Tulir Asokan, Andrew Ferrazzutti
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from attr import dataclass
from enum import IntEnum
from mautrix.types import SerializableAttrs
from ..oauth import OAuthCredential
@dataclass
class LoginData(OAuthCredential):
countryIso: str
countryCode: str
accountId: int
serverTime: int
resetUserData: bool
storyURL: str
tokenType: str
autoLoginAccountId: str
displayAccountId: str
mainDeviceAgentName: str
mainDeviceAppVersion: str
@dataclass
class LoginForm(SerializableAttrs):
email: str
password: str
@dataclass
class TokenLoginForm(LoginForm):
autowithlock: bool
class KnownAuthStatusCode(IntEnum):
INVALID_PHONE_NUMBER = 1
SUCCESS_WITH_ACCOUNT = 10
SUCCESS_WITH_DEVICE_CHANGED = 11
MISMATCH_PASSWORD = 12
EXCEED_LOGIN_LIMIT = 13
MISMATCH_PHONE_NUMBER = 14
EXCEED_PHONE_NUMBER_CHECK_LIMIT = 15
NOT_EXIST_ACCOUNT = 16
NEED_CHECK_PHONE_NUMBER = 20
NEED_CHECK_QUIZ = 25
DORMANT_ACCOUNT = 26
RESTRICTED_ACCOUNT = 27
LOGIN_FAILED = 30
NOT_VERIFIED_EMAIL = 31
MOBILE_UNREGISTERED = 32
UNKNOWN_PHONE_NUMBER = 99
SUCCESS_SAME_USER = 100
SUCCESS_SAME_USER_BY_MIGRATION = 101
TOO_MANY_REQUEST_A_DAY = -20
TOO_MANY_REQUEST_AT_A_TIME = -30
MISMATCH_PASSCODE = -31
EXCEED_DAILY_REQUEST_LIMIT = -32
EXCEED_DAILY_REQUEST_LIMIT_VOICECALL = -33
EXCEED_DAILY_REQUEST_LIMIT_WITHOUT_TOKEN = -34
DEVICE_NOT_REGISTERED = -100
ANOTHER_LOGON = -101
DEVICE_REGISTER_FAILED = -102
INVALID_DEVICE_REGISTER = -110
INVALID_PASSCODE = -111
PASSCODE_REQUEST_FAILED = -112
NEED_TERMS_AGREE = -126
DENIED_DEVICE_MODEL = -132
RESET_STEP = -940
NEED_PROTECTOR_AGREE = -991
ACCOUNT_RESTRICTED = -997
INVALID_STAGE_ERROR = -998
UPGRADE_REQUIRED = -999
VOICE_CALL_ONLY = -10002
ACCESSIBILITY_ARS_ONLY = -10003
MIGRATION_FAILURE = -100001
INVAILD_TOKEN = -100002
UNDEFINED = -999999
__all__ = [
"LoginData",
"LoginForm",
"TokenLoginForm",
"KnownAuthStatusCode",
]