Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

tcloud

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tcloud - npm Package Compare versions

Comparing version
2.9.4
to
2.9.5
+1
-1
PKG-INFO
Metadata-Version: 2.1
Name: tcloud
Version: 2.9.4
Version: 2.9.5
Author: TobikoData Inc.

@@ -5,0 +5,0 @@ Author-email: engineering@tobikodata.com

@@ -234,3 +234,3 @@

'readme': 'README.md',
'version': '2.9.4',
'version': '2.9.5',
})
Metadata-Version: 2.1
Name: tcloud
Version: 2.9.4
Version: 2.9.5
Author: TobikoData Inc.

@@ -5,0 +5,0 @@ Author-email: engineering@tobikodata.com

@@ -1,1 +0,1 @@

__version__ = version = '2.9.4'
__version__ = version = '2.9.5'

@@ -578,3 +578,43 @@ from __future__ import annotations

def vscode_initiate_device_flow(self) -> t.Dict:
response = self.session.request(
"POST",
self.auth_url + "/device",
data={
"client_id": self.client_id,
"scope": self.scope,
},
withhold_token=True,
)
if response.status_code != 200:
raise ValueError("Failed to initiate device flow")
return response.json()
def vscode_poll_device_flow(self, device_code: str) -> bool:
"""
Poll the device flow for VSCode integration.
Returns True if the device flow is successful, False otherwise. Throws an error if the device flow fails.
"""
response = self.session.request(
"POST",
self.token_url,
data={
"grant_type": "urn:ietf:params:oauth:grant-type:device_code",
"device_code": device_code,
"client_id": self.client_id,
},
withhold_token=True,
)
if response.status_code == 400:
device_pending = response.json().get("error", "").startswith("authorization_pending")
if device_pending:
return False
raise ValueError("Failed to poll device flow")
if response.status_code != 200:
raise ValueError("Failed to poll device flow")
self._create_token_info(response.json())
return True
class BearerAuth(Auth):

@@ -581,0 +621,0 @@ def __init__(self, token: str) -> None:

import json
import time
import typing as t

@@ -144,1 +145,48 @@

print(json.dumps({"is_logged_in": logged_in, "id_token": id_token}))
@vscode.command("device")
def vscode_device() -> None:
"""
Initiate device flow for VSCode integration
"""
device_info = SSO.vscode_initiate_device_flow()
print(json.dumps(device_info))
@vscode.command("poll_device")
@click.argument("device_code", type=str, required=True)
@click.option(
"-i",
"--interval",
type=int,
default=5,
help="The interval between polling attempts in seconds",
)
@click.option(
"-t",
"--timeout",
type=int,
default=300,
help="The timeout for the device flow in seconds",
)
def vscode_poll_device(device_code: str, interval: int, timeout: int) -> None:
"""
Poll the device flow for VSCode integration
"""
start_time = time.time()
while time.time() - start_time < timeout:
try:
success = SSO.vscode_poll_device_flow(device_code)
if success:
print(json.dumps({"success": True}))
return
# Wait before trying again
time.sleep(interval)
except Exception as e:
print(json.dumps({"success": False, "error": str(e)}))
return
# If we get here, we timed out
print(json.dumps({"success": False, "error": "Device flow polling timed out after 5 minutes"}))