diff --git a/src/phase/utils/crypto.py b/src/phase/utils/crypto.py index a008d95..3fac249 100644 --- a/src/phase/utils/crypto.py +++ b/src/phase/utils/crypto.py @@ -2,25 +2,15 @@ from typing import Tuple import string from nacl.secret import SecretBox -from typing import List -from nacl.encoding import RawEncoder import functools import nacl.bindings -from nacl.encoding import HexEncoder -from nacl.public import PrivateKey from nacl.bindings import ( crypto_kx_keypair, crypto_aead_xchacha20poly1305_ietf_encrypt, crypto_aead_xchacha20poly1305_ietf_decrypt, - randombytes, - crypto_secretbox_NONCEBYTES, - crypto_kx_server_session_keys, - crypto_kx_client_session_keys, - crypto_kx_seed_keypair, ) from nacl.hash import blake2b from nacl.utils import random -from base64 import b64encode, b64decode from .const import __ph_version__ diff --git a/src/phase/utils/misc.py b/src/phase/utils/misc.py index 0b3e2f6..1a4a77c 100644 --- a/src/phase/utils/misc.py +++ b/src/phase/utils/misc.py @@ -1,45 +1,7 @@ -import os import platform -import subprocess -import webbrowser import getpass -import json from .exceptions import EnvironmentNotFoundException -from urllib.parse import urlparse -from typing import Union, List -from .const import __version__, PHASE_CLOUD_API_HOST, cross_env_pattern, local_ref_pattern - - -def get_default_user_token() -> str: - """ - Fetch the default user's personal access token from the config file in PHASE_SECRETS_DIR. - - Returns: - - str: The default user's personal access token. - - Raises: - - ValueError: If the config file is not found, the default user's ID is missing, or the token is not set. - """ - config_file_path = os.path.join(PHASE_SECRETS_DIR, 'config.json') - - if not os.path.exists(config_file_path): - raise ValueError("Config file not found. Please login with phase auth or supply a PHASE_SERVICE_TOKEN as an environment variable.") - - with open(config_file_path, 'r') as f: - config_data = json.load(f) - - default_user_id = config_data.get("default-user") - if not default_user_id: - raise ValueError("Default user ID is missing in the config file.") - - for user in config_data.get("phase-users", []): - if user['id'] == default_user_id: - token = user.get("token") - if not token: - raise ValueError(f"Token for the default user (ID: {default_user_id}) is not found in the config file.") - return token - - raise ValueError("Default user not found in the config file.") +from .const import __version__ def phase_get_context(user_data, app_name=None, env_name=None, app_id=None):