xenfra 0.3.2__py3-none-any.whl → 0.3.3__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.
- xenfra/commands/auth.py +19 -12
- xenfra/commands/intelligence.py +35 -0
- xenfra/utils/auth.py +2 -1
- {xenfra-0.3.2.dist-info → xenfra-0.3.3.dist-info}/METADATA +1 -1
- {xenfra-0.3.2.dist-info → xenfra-0.3.3.dist-info}/RECORD +7 -7
- {xenfra-0.3.2.dist-info → xenfra-0.3.3.dist-info}/WHEEL +0 -0
- {xenfra-0.3.2.dist-info → xenfra-0.3.3.dist-info}/entry_points.txt +0 -0
xenfra/commands/auth.py
CHANGED
|
@@ -114,18 +114,25 @@ def whoami(token):
|
|
|
114
114
|
return
|
|
115
115
|
|
|
116
116
|
try:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
#
|
|
121
|
-
#
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
117
|
+
import base64
|
|
118
|
+
import json
|
|
119
|
+
|
|
120
|
+
# Manually decode JWT payload without verification
|
|
121
|
+
# JWT format: header.payload.signature
|
|
122
|
+
parts = access_token.split(".")
|
|
123
|
+
if len(parts) != 3:
|
|
124
|
+
console.print("[bold red]Invalid token format[/bold red]")
|
|
125
|
+
return
|
|
126
|
+
|
|
127
|
+
# Decode payload (second part)
|
|
128
|
+
payload_b64 = parts[1]
|
|
129
|
+
# Add padding if needed
|
|
130
|
+
padding = 4 - len(payload_b64) % 4
|
|
131
|
+
if padding != 4:
|
|
132
|
+
payload_b64 += "=" * padding
|
|
133
|
+
|
|
134
|
+
payload_bytes = base64.urlsafe_b64decode(payload_b64)
|
|
135
|
+
claims = json.loads(payload_bytes)
|
|
129
136
|
|
|
130
137
|
console.print("[bold green]Logged in as:[/bold green]")
|
|
131
138
|
console.print(f" Email: {claims.get('sub', 'N/A')}")
|
xenfra/commands/intelligence.py
CHANGED
|
@@ -34,6 +34,41 @@ def get_client() -> XenfraClient:
|
|
|
34
34
|
console.print("[bold red]Not logged in. Run 'xenfra login' first.[/bold red]")
|
|
35
35
|
raise click.Abort()
|
|
36
36
|
|
|
37
|
+
# DEBUG: Show token details
|
|
38
|
+
import base64
|
|
39
|
+
import json
|
|
40
|
+
try:
|
|
41
|
+
parts = token.split(".")
|
|
42
|
+
if len(parts) == 3:
|
|
43
|
+
# Decode payload
|
|
44
|
+
payload_b64 = parts[1]
|
|
45
|
+
padding = 4 - len(payload_b64) % 4
|
|
46
|
+
if padding != 4:
|
|
47
|
+
payload_b64 += "=" * padding
|
|
48
|
+
payload_bytes = base64.urlsafe_b64decode(payload_b64)
|
|
49
|
+
claims = json.loads(payload_bytes)
|
|
50
|
+
|
|
51
|
+
console.print("[dim]━━━ DEBUG: Token Info ━━━[/dim]")
|
|
52
|
+
console.print(f"[dim] API URL: {API_BASE_URL}[/dim]")
|
|
53
|
+
console.print(f"[dim] Token prefix: {token[:20]}...[/dim]")
|
|
54
|
+
console.print(f"[dim] sub (email): {claims.get('sub', 'MISSING')}[/dim]")
|
|
55
|
+
console.print(f"[dim] user_id: {claims.get('user_id', 'MISSING')}[/dim]")
|
|
56
|
+
console.print(f"[dim] iss (issuer): {claims.get('iss', 'MISSING')}[/dim]")
|
|
57
|
+
console.print(f"[dim] aud (audience): {claims.get('aud', 'MISSING')}[/dim]")
|
|
58
|
+
|
|
59
|
+
# Check if token is expired
|
|
60
|
+
exp = claims.get('exp')
|
|
61
|
+
if exp:
|
|
62
|
+
import time
|
|
63
|
+
is_expired = time.time() >= exp
|
|
64
|
+
from datetime import datetime, timezone
|
|
65
|
+
exp_time = datetime.fromtimestamp(exp, tz=timezone.utc)
|
|
66
|
+
console.print(f"[dim] expires_at: {exp_time}[/dim]")
|
|
67
|
+
console.print(f"[dim] expired: {is_expired}[/dim]")
|
|
68
|
+
console.print("[dim]━━━━━━━━━━━━━━━━━━━━━[/dim]\n")
|
|
69
|
+
except Exception as e:
|
|
70
|
+
console.print(f"[dim]DEBUG: Could not decode token: {e}[/dim]\n")
|
|
71
|
+
|
|
37
72
|
return XenfraClient(token=token, api_url=API_BASE_URL)
|
|
38
73
|
|
|
39
74
|
|
xenfra/utils/auth.py
CHANGED
|
@@ -195,8 +195,9 @@ def get_auth_token() -> str | None:
|
|
|
195
195
|
try:
|
|
196
196
|
access_token = keyring.get_password(SERVICE_ID, "access_token")
|
|
197
197
|
refresh_token = keyring.get_password(SERVICE_ID, "refresh_token")
|
|
198
|
+
console.print("[dim]DEBUG: Token retrieved from keyring[/dim]")
|
|
198
199
|
except keyring.errors.KeyringError as e:
|
|
199
|
-
console.print(f"[dim]Keyring unavailable, using file storage: {e}[/dim]")
|
|
200
|
+
console.print(f"[dim]DEBUG: Keyring unavailable, using file storage: {e}[/dim]")
|
|
200
201
|
use_file_fallback = True
|
|
201
202
|
access_token = _get_token_from_file("access_token")
|
|
202
203
|
refresh_token = _get_token_from_file("refresh_token")
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
xenfra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
xenfra/commands/__init__.py,sha256=kTTwVnTvoxikyPUhQiyTAbnw4PYafktuE1----TqQoA,43
|
|
3
|
-
xenfra/commands/auth.py,sha256=
|
|
3
|
+
xenfra/commands/auth.py,sha256=ecReVCGl7Ys2d77mv_e4mCbs4ug6FLIb3S9dl2FUhr4,4178
|
|
4
4
|
xenfra/commands/auth_device.py,sha256=caD2UdveEZtAFjgjmnA-l5bjbbPONFjXJXgeJN7mhbk,6710
|
|
5
5
|
xenfra/commands/deployments.py,sha256=bI6d9lVYPhCDoQE3nke7s80MUQ75ILPqiEGhcbXDExo,28609
|
|
6
|
-
xenfra/commands/intelligence.py,sha256=
|
|
6
|
+
xenfra/commands/intelligence.py,sha256=leaGDzSG2rGrdNLvRHHZrWsRQXvnTj3-aX7T62xdk3Y,15572
|
|
7
7
|
xenfra/commands/projects.py,sha256=SAxF_pOr95K6uz35U-zENptKndKxJNZn6bcD45PHcpI,6696
|
|
8
8
|
xenfra/commands/security_cmd.py,sha256=EI5sjX2lcMxgMH-LCFmPVkc9YqadOrcoSgTiKknkVRY,7327
|
|
9
9
|
xenfra/main.py,sha256=2EPPuIdxjhW-I-e-Mc0i2ayeLaSJdmzddNThkXq7B7c,2033
|
|
10
10
|
xenfra/utils/__init__.py,sha256=4ZRYkrb--vzoXjBHG8zRxz2jCXNGtAoKNtkyu2WRI2A,45
|
|
11
|
-
xenfra/utils/auth.py,sha256=
|
|
11
|
+
xenfra/utils/auth.py,sha256=jyzwGrA7NEheUoggOgERMBl-45g0NNbNhjLDv8aK-SQ,11614
|
|
12
12
|
xenfra/utils/codebase.py,sha256=57GthXOvOQnUHiDwIHqxK6hNUGWlWf6Nfs3T8647Wrc,4144
|
|
13
13
|
xenfra/utils/config.py,sha256=F2zedd3JXP7TBdul0u8b4NVx-C1N6Hq4sH5szyWim6M,11947
|
|
14
14
|
xenfra/utils/security.py,sha256=EA8CIPLt8Y-QP5uZ7c5NuC6ZLRV1aZS8NapS9ix_vok,11479
|
|
15
15
|
xenfra/utils/validation.py,sha256=cvuL_AEFJ2oCoP0abCqoOIABOwz79Gkf-jh_dcFIQlM,6912
|
|
16
|
-
xenfra-0.3.
|
|
17
|
-
xenfra-0.3.
|
|
18
|
-
xenfra-0.3.
|
|
19
|
-
xenfra-0.3.
|
|
16
|
+
xenfra-0.3.3.dist-info/WHEEL,sha256=RRVLqVugUmFOqBedBFAmA4bsgFcROUBiSUKlERi0Hcg,79
|
|
17
|
+
xenfra-0.3.3.dist-info/entry_points.txt,sha256=a_2cGhYK__X6eW05Ba8uB6RIM_61c2sHtXsPY8N0mic,45
|
|
18
|
+
xenfra-0.3.3.dist-info/METADATA,sha256=uISd9cESqrhksNFb9QS9KpSeqOCs4lbs0_uT4r-5HJk,3834
|
|
19
|
+
xenfra-0.3.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|