xn-auth 0.2.29.dev1__py3-none-any.whl → 0.2.31__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
x_auth/controller.py CHANGED
@@ -7,7 +7,7 @@ from litestar.exceptions import NotAuthorizedException
7
7
  from litestar.security.jwt import JWTCookieAuth
8
8
 
9
9
  from x_auth.middleware import JWTAuthMiddleware, Tok
10
- from x_auth.models import UserTg
10
+ from x_auth.models import User
11
11
  from x_auth.types import AuthUser
12
12
 
13
13
 
@@ -20,7 +20,7 @@ async def revoked_token_handler(token: Tok, _cn: ASGIConnection) -> bool:
20
20
 
21
21
 
22
22
  class Auth:
23
- def __init__(self, sec: str, user_model: type[UserTg] = UserTg, exc_paths: list[str] = None):
23
+ def __init__(self, sec: str, user_model: type[User] = User, exc_paths: list[str] = None):
24
24
  self.jwt = JWTCookieAuth( # [AuthUser, Tok]
25
25
  retrieve_user_handler=retrieve_user_handler,
26
26
  revoked_token_handler=revoked_token_handler,
x_auth/models.py CHANGED
@@ -142,10 +142,38 @@ class Proxy(Model, TsTrait):
142
142
  return reps
143
143
 
144
144
 
145
+ class Dc(TortModel):
146
+ id: int = SmallIntField(True)
147
+ ip = CharField(15, unique=True)
148
+ pub = CharField(495)
149
+
150
+ apps: BackwardFKRelation["App"]
151
+
152
+
153
+ class Fcm(TortModel):
154
+ id: int = SmallIntField(True)
155
+ json: dict = JSONField(default={})
156
+
157
+ apps: BackwardFKRelation["App"]
158
+
159
+
160
+ class App(TortModel):
161
+ hsh = CharField(32, unique=True)
162
+ dc: ForeignKeyRelation[Dc] = ForeignKeyField("models.Dc", "apps", default=2)
163
+ dc_id: int
164
+ title = CharField(127)
165
+ short = CharField(95)
166
+ fcm: ForeignKeyNullableRelation[Fcm] = ForeignKeyField("models.Fcm", "apps", null=True)
167
+ fcm_id: int
168
+
169
+ sessions: BackwardFKRelation["Session"]
170
+
171
+
145
172
  class Session(TortModel):
146
173
  id = CharField(127, primary_key=True)
147
174
  dc_id = IntField(null=True)
148
- api_id = IntField(null=True)
175
+ api: ForeignKeyRelation[App] = ForeignKeyField("models.App", "sessions")
176
+ api_id: int
149
177
  test_mode = BooleanField(default=False)
150
178
  auth_key = BinaryField(null=True)
151
179
  date = IntField(null=True) # todo: refact to datetime?
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xn-auth
3
- Version: 0.2.29.dev1
3
+ Version: 0.2.31
4
4
  Summary: Auth adapter for XN-Api framework
5
5
  Author-email: Artemiev <mixartemev@gmail.com>
6
6
  License: MIT
@@ -0,0 +1,10 @@
1
+ x_auth/controller.py,sha256=0QhqmqXOqFaWIUTWHlJKITQNmJQ5kXZOkLg7wSUTh60,2240
2
+ x_auth/enums.py,sha256=kmkX-j1bWNpel6_-fw2YtMEmJSAj9w2iizkG03s3ZSU,631
3
+ x_auth/exceptions.py,sha256=2B4okJxhPyNqTJXlSTfblJUQJ60bLGXdgJIu6ue7S6w,162
4
+ x_auth/middleware.py,sha256=JfssQomDv0J_69GfS2a_2_uyRzs26zSY6IW1Vk7m8K0,2900
5
+ x_auth/models.py,sha256=etxzc8ejaF4c2zhP6S1X4ysLW3By0dl3OfbxfgfKIrM,7396
6
+ x_auth/types.py,sha256=j3WGcyH24DmFEdTT6U7xzb_fEm1tFcBZsANKMy7bydo,689
7
+ xn_auth-0.2.31.dist-info/METADATA,sha256=O7wgwTNe1P4Vy0YHJ3jjJlEGCWzHRGW1cJPLnl_vs2E,799
8
+ xn_auth-0.2.31.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
9
+ xn_auth-0.2.31.dist-info/top_level.txt,sha256=ydMDkzxgQPtW-E_MNDfUAroAFZvWSqU-x_kZSA7NSFo,7
10
+ xn_auth-0.2.31.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- x_auth/controller.py,sha256=0Z9kogEQ3tgXiO9Wv06dzb7RtWfIuybjqqAJoQ46j5I,2246
2
- x_auth/enums.py,sha256=kmkX-j1bWNpel6_-fw2YtMEmJSAj9w2iizkG03s3ZSU,631
3
- x_auth/exceptions.py,sha256=2B4okJxhPyNqTJXlSTfblJUQJ60bLGXdgJIu6ue7S6w,162
4
- x_auth/middleware.py,sha256=JfssQomDv0J_69GfS2a_2_uyRzs26zSY6IW1Vk7m8K0,2900
5
- x_auth/models.py,sha256=5mfvjbARdRFeDq_XIUmQxyFKoK8jQI6CrO1Fbp6glT0,6684
6
- x_auth/types.py,sha256=j3WGcyH24DmFEdTT6U7xzb_fEm1tFcBZsANKMy7bydo,689
7
- xn_auth-0.2.29.dev1.dist-info/METADATA,sha256=vkBOI_MFfz8UYe9alir17Ugg2ZKAL2yHgtY_onbIElI,804
8
- xn_auth-0.2.29.dev1.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
9
- xn_auth-0.2.29.dev1.dist-info/top_level.txt,sha256=ydMDkzxgQPtW-E_MNDfUAroAFZvWSqU-x_kZSA7NSFo,7
10
- xn_auth-0.2.29.dev1.dist-info/RECORD,,