fastapi-betterauth 0.2.2__tar.gz → 0.2.4__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi-betterauth
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: FastAPI helpers for Better Auth JWT verification
5
5
  Project-URL: Homepage, https://github.com/lukonik/fastapi-betterauth
6
6
  Project-URL: Repository, https://github.com/lukonik/fastapi-betterauth
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fastapi-betterauth"
3
- version = "0.2.2"
3
+ version = "0.2.4"
4
4
  description = "FastAPI helpers for Better Auth JWT verification"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -1,6 +1,5 @@
1
- from dataclasses import dataclass
2
1
  from ssl import SSLContext
3
- from typing import Any
2
+ from typing import Any, TypedDict, cast
4
3
 
5
4
  import jwt
6
5
  from fastapi import HTTPException, Request, status
@@ -17,14 +16,13 @@ def _get_authorization_scheme_param(
17
16
  return scheme, param.strip()
18
17
 
19
18
 
20
- @dataclass
21
- class User:
19
+ class User(TypedDict, total=False):
22
20
  aud: str
23
21
  createdAt: str
24
22
  email: str
25
- emailVerified: str
26
- exp: str
27
- iat: str
23
+ emailVerified: bool
24
+ exp: int
25
+ iat: int
28
26
  id: str
29
27
  image: str
30
28
  iss: str
@@ -76,7 +74,7 @@ class BetterAuth(OAuth2):
76
74
  issuer=self.base_url,
77
75
  audience=self.base_url,
78
76
  )
79
- return User(**response)
77
+ return cast(User, response)
80
78
  except (jwt.PyJWTError, TypeError) as exc:
81
79
  raise TokenValidationError("Invalid bearer token") from exc
82
80