66from io import BytesIO
77from typing import Any , BinaryIO
88
9- from otdf_python .config import NanoTDFConfig , TDFConfig
9+ from otdf_python .config import KASInfo , NanoTDFConfig , TDFConfig
1010from otdf_python .nanotdf import NanoTDF
1111from otdf_python .sdk_exceptions import SDKException
1212from otdf_python .tdf import TDF , TDFReader , TDFReaderConfig
1313
1414
15- # Stubs for service client interfaces (to be implemented)
16- class AttributesServiceClientInterface : ...
17-
18-
19- class NamespaceServiceClientInterface : ...
20-
21-
22- class SubjectMappingServiceClientInterface : ...
23-
24-
25- class ResourceMappingServiceClientInterface : ...
26-
27-
28- class AuthorizationServiceClientInterface : ...
29-
30-
31- class KeyAccessServerRegistryServiceClientInterface : ...
32-
33-
34- # Placeholder for ProtocolClient and Interceptor
35- class ProtocolClient : ...
36-
37-
38- class Interceptor : ... # Can be dict in Python implementation
39-
40-
41- # Placeholder for TrustManager
42- class TrustManager : ...
43-
44-
4515class KAS (AbstractContextManager ):
4616 """
4717 KAS (Key Access Service) interface to define methods related to key access and management.
@@ -71,7 +41,6 @@ def __init__(
7141 token_source = None ,
7242 sdk_ssl_verify = True ,
7343 use_plaintext = False ,
74- auth_headers : dict | None = None ,
7544 ):
7645 """
7746 Initialize the KAS client
@@ -81,7 +50,6 @@ def __init__(
8150 token_source: Function that returns an authentication token
8251 sdk_ssl_verify: Whether to verify SSL certificates
8352 use_plaintext: Whether to use plaintext HTTP connections instead of HTTPS
84- auth_headers: Dictionary of authentication headers to include in requests
8553 """
8654 from .kas_client import KASClient
8755
@@ -94,7 +62,6 @@ def __init__(
9462 # Store the parameters for potential use
9563 self ._sdk_ssl_verify = sdk_ssl_verify
9664 self ._use_plaintext = use_plaintext
97- self ._auth_headers = auth_headers
9865
9966 def get_ec_public_key (self , kas_info : Any , curve : Any ) -> Any :
10067 """
@@ -179,12 +146,14 @@ def __exit__(self, exc_type, exc_val, exc_tb):
179146
180147class SDK (AbstractContextManager ):
181148 def new_tdf_config (
182- self , attributes : list [str ] | None = None , ** kwargs
149+ self ,
150+ attributes : list [str ] | None = None ,
151+ kas_info_list : list [KASInfo ] | None = None ,
152+ ** kwargs ,
183153 ) -> TDFConfig :
184154 """
185155 Create a TDFConfig with default kas_info_list from the SDK's platform_url.
186156 """
187- from otdf_python .config import KASInfo
188157
189158 if self .platform_url is None :
190159 raise SDKException ("Cannot create TDFConfig: SDK platform_url is not set." )
@@ -232,10 +201,8 @@ def new_tdf_config(
232201 # Use existing port with the determined scheme
233202 kas_url = f"{ scheme } ://{ parsed_url .hostname } :{ parsed_url .port } { parsed_url .path .rstrip ('/' )} /kas"
234203
235- kas_info = KASInfo (url = kas_url , default = True )
236- # Accept user override for kas_info_list if provided
237- kas_info_list = kwargs .pop ("kas_info_list" , None )
238204 if kas_info_list is None :
205+ kas_info = KASInfo (url = kas_url , default = True )
239206 kas_info_list = [kas_info ]
240207 return TDFConfig (
241208 kas_info_list = kas_info_list , attributes = attributes or [], ** kwargs
@@ -251,30 +218,6 @@ class Services(AbstractContextManager):
251218 The Services interface provides access to various platform service clients and KAS.
252219 """
253220
254- def attributes (self ) -> AttributesServiceClientInterface :
255- """Returns the attributes service client"""
256- raise NotImplementedError
257-
258- def namespaces (self ) -> NamespaceServiceClientInterface :
259- """Returns the namespaces service client"""
260- raise NotImplementedError
261-
262- def subject_mappings (self ) -> SubjectMappingServiceClientInterface :
263- """Returns the subject mappings service client"""
264- raise NotImplementedError
265-
266- def resource_mappings (self ) -> ResourceMappingServiceClientInterface :
267- """Returns the resource mappings service client"""
268- raise NotImplementedError
269-
270- def authorization (self ) -> AuthorizationServiceClientInterface :
271- """Returns the authorization service client"""
272- raise NotImplementedError
273-
274- def kas_registry (self ) -> KeyAccessServerRegistryServiceClientInterface :
275- """Returns the KAS registry service client"""
276- raise NotImplementedError
277-
278221 def kas (self ) -> KAS :
279222 """
280223 Returns the KAS client for key access operations.
@@ -292,9 +235,6 @@ def __exit__(self, exc_type, exc_val, exc_tb):
292235 def __init__ (
293236 self ,
294237 services : "SDK.Services" ,
295- trust_manager : TrustManager | None = None ,
296- auth_interceptor : Interceptor | dict [str , str ] | None = None ,
297- platform_services_client : ProtocolClient | None = None ,
298238 platform_url : str | None = None ,
299239 ssl_verify : bool = True ,
300240 use_plaintext : bool = False ,
@@ -304,17 +244,11 @@ def __init__(
304244
305245 Args:
306246 services: The services interface implementation
307- trust_manager: Optional trust manager for SSL validation
308- auth_interceptor: Optional auth interceptor for API requests
309- platform_services_client: Optional client for platform services
310247 platform_url: Optional platform base URL
311248 ssl_verify: Whether to verify SSL certificates (default: True)
312249 use_plaintext: Whether to use HTTP instead of HTTPS (default: False)
313250 """
314251 self .services = services
315- self .trust_manager = trust_manager
316- self .auth_interceptor = auth_interceptor
317- self .platform_services_client = platform_services_client
318252 self .platform_url = platform_url
319253 self .ssl_verify = ssl_verify
320254 self ._use_plaintext = use_plaintext
@@ -332,18 +266,6 @@ def get_services(self) -> "SDK.Services":
332266 """Returns the services interface"""
333267 return self .services
334268
335- def get_trust_manager (self ) -> TrustManager | None :
336- """Returns the trust manager if set"""
337- return self .trust_manager
338-
339- def get_auth_interceptor (self ) -> Interceptor | dict [str , str ] | None :
340- """Returns the auth interceptor if set"""
341- return self .auth_interceptor
342-
343- def get_platform_services_client (self ) -> ProtocolClient | None :
344- """Returns the platform services client if set"""
345- return self .platform_services_client
346-
347269 def get_platform_url (self ) -> str | None :
348270 """Returns the platform URL if set"""
349271 return self .platform_url
0 commit comments