Skip to content

Commit d9ebcb8

Browse files
committed
fix(Cluster): remove Fief client; copy code for login auth callback
1 parent f2509d3 commit d9ebcb8

File tree

5 files changed

+952
-13
lines changed

5 files changed

+952
-13
lines changed

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,15 @@
7272
"ethpm-types>=0.6.10", # lower pin only, `eth-ape` governs upper pin
7373
"eth-pydantic-types", # Use same version as eth-ape
7474
"exceptiongroup; python_version < '3.11'", # Used with TaskGroup
75+
"httpx>=0.28,<1", # Use for Cluster client, auth
76+
"jwcrypto>=1.4,<2", # Use for auth
7577
"packaging", # Use same version as eth-ape
7678
"pycron>=3.1,<4", # Checking/triggering cron tasks
7779
"pydantic_settings", # Use same version as eth-ape
7880
"quattro>=25.2,<26", # Manage task groups and background tasks
7981
"taskiq[metrics]>=0.11.16,<0.12",
8082
"tomlkit>=0.12,<1", # For reading/writing global platform profile
81-
"fief_client @ git+https://github.com/ApeWorX/fief-python@fix/support-ory#egg=fief_client[cli]", # for platform auth/cluster login # noqa: E501
82-
"yaspin", # NOTE: Required by fief-client
83+
"yaspin>=3.1,<4", # Display a nice spinner when logging in
8384
"web3>=7.7,<8", # TODO: Remove when Ape v0.9 is released (Ape v0.8 allows web3 v6)
8485
],
8586
entry_points={

silverback/_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
if TYPE_CHECKING:
3838
from ape.api import AccountAPI, EcosystemAPI, NetworkAPI, ProviderAPI
3939
from ape.contracts import ContractInstance
40-
from fief_client.integrations.cli import FiefAuth
4140

42-
from silverback.cluster.client import Bot, ClusterClient, PlatformClient
41+
from .cluster.auth import Auth
42+
from .cluster.client import Bot, ClusterClient, PlatformClient
4343

4444
LOCAL_DATETIME = "%Y-%m-%d %H:%M:%S %Z"
4545

@@ -232,7 +232,7 @@ def worker(cli_ctx, account, workers, max_exceptions, shutdown_timeout, debug, b
232232

233233
@cli.command(section="Cloud Commands (https://silverback.apeworx.io)")
234234
@auth_required
235-
def login(auth: "FiefAuth"):
235+
def login(auth: "Auth"):
236236
"""Login to ApeWorX Authorization Service (https://account.apeworx.io)"""
237237

238238
state = secrets.token_urlsafe()

silverback/_click_ext.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
from typing import TYPE_CHECKING, Any
66

77
import click
8-
from fief_client import Fief
9-
from fief_client.integrations.cli import FiefAuth, FiefAuthNotAuthenticatedError
108

11-
from silverback.cluster.settings import (
9+
from .cluster.auth import Auth, AuthClient, NotAuthenticatedError
10+
from .cluster.settings import (
1211
PROFILE_PATH,
1312
BaseProfile,
1413
ClusterProfile,
1514
PlatformProfile,
1615
ProfileSettings,
1716
)
18-
from silverback.exceptions import ImportFromStringError
17+
from .exceptions import ImportFromStringError
1918

2019
if TYPE_CHECKING:
2120
from ape.contracts import ContractInstance
@@ -219,8 +218,8 @@ def add_auth(ctx: click.Context, *args, **kwargs):
219218

220219
if isinstance(profile, PlatformProfile):
221220
auth_info = settings.auth[profile.auth]
222-
fief = Fief(auth_info.host, auth_info.client_id)
223-
ctx.obj["auth"] = FiefAuth(fief, str(PROFILE_PATH.parent / f"{profile.auth}.json"))
221+
client = AuthClient(auth_info.host, auth_info.client_id)
222+
ctx.obj["auth"] = Auth(client, str(PROFILE_PATH.parent / f"{profile.auth}.json"))
224223

225224
if expose_value:
226225
kwargs["auth"] = ctx.obj["auth"]
@@ -245,10 +244,10 @@ def get_platform_client(ctx: click.Context, *args, **kwargs):
245244
raise click.UsageError("This command only works with the Silverback Platform")
246245

247246
# NOTE: `auth` should be set if `profile` is set and is `PlatformProfile`
248-
auth: FiefAuth = ctx.obj["auth"]
247+
auth: Auth = ctx.obj["auth"]
249248
try:
250249
userinfo = auth.current_user()
251-
except FiefAuthNotAuthenticatedError as e:
250+
except NotAuthenticatedError as e:
252251
raise click.UsageError(
253252
"Not authenticated, please use `silverback login` first."
254253
) from e

0 commit comments

Comments
 (0)