otdf-python 0.1.10__py3-none-any.whl → 0.3.0__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.
- otdf_python/__init__.py +25 -0
- otdf_python/__main__.py +12 -0
- otdf_python/address_normalizer.py +84 -0
- otdf_python/aesgcm.py +55 -0
- otdf_python/assertion_config.py +84 -0
- otdf_python/asym_crypto.py +85 -0
- otdf_python/asym_decryption.py +53 -0
- otdf_python/asym_encryption.py +75 -0
- otdf_python/auth_headers.py +21 -0
- otdf_python/autoconfigure_utils.py +113 -0
- otdf_python/cli.py +570 -0
- otdf_python/collection_store.py +41 -0
- otdf_python/collection_store_impl.py +22 -0
- otdf_python/config.py +69 -0
- otdf_python/connect_client.py +0 -0
- otdf_python/constants.py +1 -0
- otdf_python/crypto_utils.py +78 -0
- otdf_python/dpop.py +81 -0
- otdf_python/ecc_mode.py +32 -0
- otdf_python/eckeypair.py +75 -0
- otdf_python/header.py +143 -0
- otdf_python/invalid_zip_exception.py +8 -0
- otdf_python/kas_client.py +603 -0
- otdf_python/kas_connect_rpc_client.py +207 -0
- otdf_python/kas_info.py +25 -0
- otdf_python/kas_key_cache.py +52 -0
- otdf_python/key_type.py +31 -0
- otdf_python/key_type_constants.py +43 -0
- otdf_python/manifest.py +215 -0
- otdf_python/nanotdf.py +553 -0
- otdf_python/nanotdf_ecdsa_struct.py +132 -0
- otdf_python/nanotdf_type.py +43 -0
- otdf_python/policy_binding_serializer.py +39 -0
- otdf_python/policy_info.py +78 -0
- otdf_python/policy_object.py +22 -0
- otdf_python/policy_stub.py +2 -0
- otdf_python/resource_locator.py +44 -0
- otdf_python/sdk.py +528 -0
- otdf_python/sdk_builder.py +448 -0
- otdf_python/sdk_exceptions.py +16 -0
- otdf_python/symmetric_and_payload_config.py +30 -0
- otdf_python/tdf.py +479 -0
- otdf_python/tdf_reader.py +153 -0
- otdf_python/tdf_writer.py +23 -0
- otdf_python/token_source.py +34 -0
- otdf_python/version.py +57 -0
- otdf_python/zip_reader.py +47 -0
- otdf_python/zip_writer.py +70 -0
- otdf_python-0.3.0.dist-info/METADATA +231 -0
- otdf_python-0.3.0.dist-info/RECORD +137 -0
- {otdf_python-0.1.10.dist-info → otdf_python-0.3.0.dist-info}/WHEEL +1 -2
- {otdf_python-0.1.10.dist-info → otdf_python-0.3.0.dist-info/licenses}/LICENSE +1 -1
- otdf_python_proto/__init__.py +37 -0
- otdf_python_proto/authorization/__init__.py +1 -0
- otdf_python_proto/authorization/authorization_pb2.py +80 -0
- otdf_python_proto/authorization/authorization_pb2.pyi +161 -0
- otdf_python_proto/authorization/authorization_pb2_connect.py +191 -0
- otdf_python_proto/authorization/v2/authorization_pb2.py +105 -0
- otdf_python_proto/authorization/v2/authorization_pb2.pyi +134 -0
- otdf_python_proto/authorization/v2/authorization_pb2_connect.py +233 -0
- otdf_python_proto/common/__init__.py +1 -0
- otdf_python_proto/common/common_pb2.py +52 -0
- otdf_python_proto/common/common_pb2.pyi +61 -0
- otdf_python_proto/entity/__init__.py +1 -0
- otdf_python_proto/entity/entity_pb2.py +47 -0
- otdf_python_proto/entity/entity_pb2.pyi +50 -0
- otdf_python_proto/entityresolution/__init__.py +1 -0
- otdf_python_proto/entityresolution/entity_resolution_pb2.py +57 -0
- otdf_python_proto/entityresolution/entity_resolution_pb2.pyi +55 -0
- otdf_python_proto/entityresolution/entity_resolution_pb2_connect.py +149 -0
- otdf_python_proto/entityresolution/v2/entity_resolution_pb2.py +55 -0
- otdf_python_proto/entityresolution/v2/entity_resolution_pb2.pyi +55 -0
- otdf_python_proto/entityresolution/v2/entity_resolution_pb2_connect.py +149 -0
- otdf_python_proto/kas/__init__.py +9 -0
- otdf_python_proto/kas/kas_pb2.py +103 -0
- otdf_python_proto/kas/kas_pb2.pyi +170 -0
- otdf_python_proto/kas/kas_pb2_connect.py +192 -0
- otdf_python_proto/legacy_grpc/__init__.py +1 -0
- otdf_python_proto/legacy_grpc/authorization/authorization_pb2_grpc.py +163 -0
- otdf_python_proto/legacy_grpc/authorization/v2/authorization_pb2_grpc.py +206 -0
- otdf_python_proto/legacy_grpc/common/common_pb2_grpc.py +4 -0
- otdf_python_proto/legacy_grpc/entity/entity_pb2_grpc.py +4 -0
- otdf_python_proto/legacy_grpc/entityresolution/entity_resolution_pb2_grpc.py +122 -0
- otdf_python_proto/legacy_grpc/entityresolution/v2/entity_resolution_pb2_grpc.py +120 -0
- otdf_python_proto/legacy_grpc/kas/kas_pb2_grpc.py +172 -0
- otdf_python_proto/legacy_grpc/logger/audit/test_pb2_grpc.py +4 -0
- otdf_python_proto/legacy_grpc/policy/actions/actions_pb2_grpc.py +249 -0
- otdf_python_proto/legacy_grpc/policy/attributes/attributes_pb2_grpc.py +873 -0
- otdf_python_proto/legacy_grpc/policy/kasregistry/key_access_server_registry_pb2_grpc.py +602 -0
- otdf_python_proto/legacy_grpc/policy/keymanagement/key_management_pb2_grpc.py +251 -0
- otdf_python_proto/legacy_grpc/policy/namespaces/namespaces_pb2_grpc.py +427 -0
- otdf_python_proto/legacy_grpc/policy/objects_pb2_grpc.py +4 -0
- otdf_python_proto/legacy_grpc/policy/registeredresources/registered_resources_pb2_grpc.py +524 -0
- otdf_python_proto/legacy_grpc/policy/resourcemapping/resource_mapping_pb2_grpc.py +516 -0
- otdf_python_proto/legacy_grpc/policy/selectors_pb2_grpc.py +4 -0
- otdf_python_proto/legacy_grpc/policy/subjectmapping/subject_mapping_pb2_grpc.py +551 -0
- otdf_python_proto/legacy_grpc/policy/unsafe/unsafe_pb2_grpc.py +485 -0
- otdf_python_proto/legacy_grpc/wellknownconfiguration/wellknown_configuration_pb2_grpc.py +77 -0
- otdf_python_proto/logger/__init__.py +1 -0
- otdf_python_proto/logger/audit/test_pb2.py +43 -0
- otdf_python_proto/logger/audit/test_pb2.pyi +45 -0
- otdf_python_proto/policy/__init__.py +1 -0
- otdf_python_proto/policy/actions/actions_pb2.py +75 -0
- otdf_python_proto/policy/actions/actions_pb2.pyi +87 -0
- otdf_python_proto/policy/actions/actions_pb2_connect.py +275 -0
- otdf_python_proto/policy/attributes/attributes_pb2.py +234 -0
- otdf_python_proto/policy/attributes/attributes_pb2.pyi +328 -0
- otdf_python_proto/policy/attributes/attributes_pb2_connect.py +863 -0
- otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2.py +266 -0
- otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2.pyi +450 -0
- otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2_connect.py +611 -0
- otdf_python_proto/policy/keymanagement/key_management_pb2.py +79 -0
- otdf_python_proto/policy/keymanagement/key_management_pb2.pyi +87 -0
- otdf_python_proto/policy/keymanagement/key_management_pb2_connect.py +275 -0
- otdf_python_proto/policy/namespaces/namespaces_pb2.py +117 -0
- otdf_python_proto/policy/namespaces/namespaces_pb2.pyi +147 -0
- otdf_python_proto/policy/namespaces/namespaces_pb2_connect.py +443 -0
- otdf_python_proto/policy/objects_pb2.py +150 -0
- otdf_python_proto/policy/objects_pb2.pyi +464 -0
- otdf_python_proto/policy/registeredresources/registered_resources_pb2.py +139 -0
- otdf_python_proto/policy/registeredresources/registered_resources_pb2.pyi +196 -0
- otdf_python_proto/policy/registeredresources/registered_resources_pb2_connect.py +527 -0
- otdf_python_proto/policy/resourcemapping/resource_mapping_pb2.py +139 -0
- otdf_python_proto/policy/resourcemapping/resource_mapping_pb2.pyi +194 -0
- otdf_python_proto/policy/resourcemapping/resource_mapping_pb2_connect.py +527 -0
- otdf_python_proto/policy/selectors_pb2.py +57 -0
- otdf_python_proto/policy/selectors_pb2.pyi +90 -0
- otdf_python_proto/policy/subjectmapping/subject_mapping_pb2.py +127 -0
- otdf_python_proto/policy/subjectmapping/subject_mapping_pb2.pyi +189 -0
- otdf_python_proto/policy/subjectmapping/subject_mapping_pb2_connect.py +569 -0
- otdf_python_proto/policy/unsafe/unsafe_pb2.py +113 -0
- otdf_python_proto/policy/unsafe/unsafe_pb2.pyi +145 -0
- otdf_python_proto/policy/unsafe/unsafe_pb2_connect.py +485 -0
- otdf_python_proto/wellknownconfiguration/__init__.py +1 -0
- otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2.py +51 -0
- otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2.pyi +32 -0
- otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2_connect.py +107 -0
- otdf_python/_gotdf_python.cpython-312-darwin.so +0 -0
- otdf_python/build.py +0 -190
- otdf_python/go.py +0 -1478
- otdf_python/gotdf_python.py +0 -383
- otdf_python-0.1.10.dist-info/METADATA +0 -149
- otdf_python-0.1.10.dist-info/RECORD +0 -10
- otdf_python-0.1.10.dist-info/top_level.txt +0 -1
otdf_python/gotdf_python.py
DELETED
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
# python wrapper for package gotdf_python within overall package gotdf_python
|
|
3
|
-
# This is what you import to use the package.
|
|
4
|
-
# File is generated by gopy. Do not edit.
|
|
5
|
-
# gopy build --output=otdf_python -vm=python3 .
|
|
6
|
-
|
|
7
|
-
# the following is required to enable dlopen to open the _go.so file
|
|
8
|
-
import os,sys,inspect,collections
|
|
9
|
-
try:
|
|
10
|
-
import collections.abc as _collections_abc
|
|
11
|
-
except ImportError:
|
|
12
|
-
_collections_abc = collections
|
|
13
|
-
|
|
14
|
-
cwd = os.getcwd()
|
|
15
|
-
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
|
|
16
|
-
os.chdir(currentdir)
|
|
17
|
-
from . import _gotdf_python
|
|
18
|
-
from . import go
|
|
19
|
-
|
|
20
|
-
os.chdir(cwd)
|
|
21
|
-
|
|
22
|
-
# to use this code in your end-user python file, import it as follows:
|
|
23
|
-
# from gotdf_python import gotdf_python
|
|
24
|
-
# and then refer to everything using gotdf_python. prefix
|
|
25
|
-
# packages imported by this package listed below:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# ---- Types ---
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
#---- Enums from Go (collections of consts with same type) ---
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
#---- Constants from Go: Python can only ask that you please don't change these! ---
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
# ---- Global Variables: can only use functions to access ---
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
# ---- Interfaces ---
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
# ---- Structs ---
|
|
46
|
-
|
|
47
|
-
# Python type for struct gotdf_python.EncryptionConfig
|
|
48
|
-
class EncryptionConfig(go.GoClass):
|
|
49
|
-
"""In a pure golang library, we'd probably embed\nthe 'DecryptionConfig' struct into the\n'EncryptionConfig' struct. However, this makes\nusage from Python / Gopy difficult, so\nit's not worthwhile.\n"""
|
|
50
|
-
def __init__(self, *args, **kwargs):
|
|
51
|
-
"""
|
|
52
|
-
handle=A Go-side object is always initialized with an explicit handle=arg
|
|
53
|
-
otherwise parameters can be unnamed in order of field names or named fields
|
|
54
|
-
in which case a new Go object is constructed first
|
|
55
|
-
"""
|
|
56
|
-
if len(kwargs) == 1 and 'handle' in kwargs:
|
|
57
|
-
self.handle = kwargs['handle']
|
|
58
|
-
_gotdf_python.IncRef(self.handle)
|
|
59
|
-
elif len(args) == 1 and isinstance(args[0], go.GoClass):
|
|
60
|
-
self.handle = args[0].handle
|
|
61
|
-
_gotdf_python.IncRef(self.handle)
|
|
62
|
-
else:
|
|
63
|
-
self.handle = _gotdf_python.gotdf_python_EncryptionConfig_CTor()
|
|
64
|
-
_gotdf_python.IncRef(self.handle)
|
|
65
|
-
if 0 < len(args):
|
|
66
|
-
self.ClientId = args[0]
|
|
67
|
-
if "ClientId" in kwargs:
|
|
68
|
-
self.ClientId = kwargs["ClientId"]
|
|
69
|
-
if 1 < len(args):
|
|
70
|
-
self.ClientSecret = args[1]
|
|
71
|
-
if "ClientSecret" in kwargs:
|
|
72
|
-
self.ClientSecret = kwargs["ClientSecret"]
|
|
73
|
-
if 2 < len(args):
|
|
74
|
-
self.PlatformEndpoint = args[2]
|
|
75
|
-
if "PlatformEndpoint" in kwargs:
|
|
76
|
-
self.PlatformEndpoint = kwargs["PlatformEndpoint"]
|
|
77
|
-
if 3 < len(args):
|
|
78
|
-
self.TokenEndpoint = args[3]
|
|
79
|
-
if "TokenEndpoint" in kwargs:
|
|
80
|
-
self.TokenEndpoint = kwargs["TokenEndpoint"]
|
|
81
|
-
if 4 < len(args):
|
|
82
|
-
self.KasUrl = args[4]
|
|
83
|
-
if "KasUrl" in kwargs:
|
|
84
|
-
self.KasUrl = kwargs["KasUrl"]
|
|
85
|
-
if 5 < len(args):
|
|
86
|
-
self.DataAttributes = args[5]
|
|
87
|
-
if "DataAttributes" in kwargs:
|
|
88
|
-
self.DataAttributes = kwargs["DataAttributes"]
|
|
89
|
-
def __del__(self):
|
|
90
|
-
_gotdf_python.DecRef(self.handle)
|
|
91
|
-
def __str__(self):
|
|
92
|
-
pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
|
|
93
|
-
sv = 'gotdf_python.EncryptionConfig{'
|
|
94
|
-
first = True
|
|
95
|
-
for v in pr:
|
|
96
|
-
if callable(v[1]):
|
|
97
|
-
continue
|
|
98
|
-
if first:
|
|
99
|
-
first = False
|
|
100
|
-
else:
|
|
101
|
-
sv += ', '
|
|
102
|
-
sv += v[0] + '=' + str(v[1])
|
|
103
|
-
return sv + '}'
|
|
104
|
-
def __repr__(self):
|
|
105
|
-
pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
|
|
106
|
-
sv = 'gotdf_python.EncryptionConfig ( '
|
|
107
|
-
for v in pr:
|
|
108
|
-
if not callable(v[1]):
|
|
109
|
-
sv += v[0] + '=' + str(v[1]) + ', '
|
|
110
|
-
return sv + ')'
|
|
111
|
-
@property
|
|
112
|
-
def ClientId(self):
|
|
113
|
-
return _gotdf_python.gotdf_python_EncryptionConfig_ClientId_Get(self.handle)
|
|
114
|
-
@ClientId.setter
|
|
115
|
-
def ClientId(self, value):
|
|
116
|
-
if isinstance(value, go.GoClass):
|
|
117
|
-
_gotdf_python.gotdf_python_EncryptionConfig_ClientId_Set(self.handle, value.handle)
|
|
118
|
-
else:
|
|
119
|
-
_gotdf_python.gotdf_python_EncryptionConfig_ClientId_Set(self.handle, value)
|
|
120
|
-
@property
|
|
121
|
-
def ClientSecret(self):
|
|
122
|
-
return _gotdf_python.gotdf_python_EncryptionConfig_ClientSecret_Get(self.handle)
|
|
123
|
-
@ClientSecret.setter
|
|
124
|
-
def ClientSecret(self, value):
|
|
125
|
-
if isinstance(value, go.GoClass):
|
|
126
|
-
_gotdf_python.gotdf_python_EncryptionConfig_ClientSecret_Set(self.handle, value.handle)
|
|
127
|
-
else:
|
|
128
|
-
_gotdf_python.gotdf_python_EncryptionConfig_ClientSecret_Set(self.handle, value)
|
|
129
|
-
@property
|
|
130
|
-
def PlatformEndpoint(self):
|
|
131
|
-
return _gotdf_python.gotdf_python_EncryptionConfig_PlatformEndpoint_Get(self.handle)
|
|
132
|
-
@PlatformEndpoint.setter
|
|
133
|
-
def PlatformEndpoint(self, value):
|
|
134
|
-
if isinstance(value, go.GoClass):
|
|
135
|
-
_gotdf_python.gotdf_python_EncryptionConfig_PlatformEndpoint_Set(self.handle, value.handle)
|
|
136
|
-
else:
|
|
137
|
-
_gotdf_python.gotdf_python_EncryptionConfig_PlatformEndpoint_Set(self.handle, value)
|
|
138
|
-
@property
|
|
139
|
-
def TokenEndpoint(self):
|
|
140
|
-
return _gotdf_python.gotdf_python_EncryptionConfig_TokenEndpoint_Get(self.handle)
|
|
141
|
-
@TokenEndpoint.setter
|
|
142
|
-
def TokenEndpoint(self, value):
|
|
143
|
-
if isinstance(value, go.GoClass):
|
|
144
|
-
_gotdf_python.gotdf_python_EncryptionConfig_TokenEndpoint_Set(self.handle, value.handle)
|
|
145
|
-
else:
|
|
146
|
-
_gotdf_python.gotdf_python_EncryptionConfig_TokenEndpoint_Set(self.handle, value)
|
|
147
|
-
@property
|
|
148
|
-
def KasUrl(self):
|
|
149
|
-
return _gotdf_python.gotdf_python_EncryptionConfig_KasUrl_Get(self.handle)
|
|
150
|
-
@KasUrl.setter
|
|
151
|
-
def KasUrl(self, value):
|
|
152
|
-
if isinstance(value, go.GoClass):
|
|
153
|
-
_gotdf_python.gotdf_python_EncryptionConfig_KasUrl_Set(self.handle, value.handle)
|
|
154
|
-
else:
|
|
155
|
-
_gotdf_python.gotdf_python_EncryptionConfig_KasUrl_Set(self.handle, value)
|
|
156
|
-
@property
|
|
157
|
-
def DataAttributes(self):
|
|
158
|
-
return go.Slice_string(handle=_gotdf_python.gotdf_python_EncryptionConfig_DataAttributes_Get(self.handle))
|
|
159
|
-
@DataAttributes.setter
|
|
160
|
-
def DataAttributes(self, value):
|
|
161
|
-
if isinstance(value, go.GoClass):
|
|
162
|
-
_gotdf_python.gotdf_python_EncryptionConfig_DataAttributes_Set(self.handle, value.handle)
|
|
163
|
-
else:
|
|
164
|
-
raise TypeError("supplied argument type {t} is not a go.GoClass".format(t=type(value)))
|
|
165
|
-
|
|
166
|
-
# Python type for struct gotdf_python.TokenAuth
|
|
167
|
-
class TokenAuth(go.GoClass):
|
|
168
|
-
""""""
|
|
169
|
-
def __init__(self, *args, **kwargs):
|
|
170
|
-
"""
|
|
171
|
-
handle=A Go-side object is always initialized with an explicit handle=arg
|
|
172
|
-
otherwise parameters can be unnamed in order of field names or named fields
|
|
173
|
-
in which case a new Go object is constructed first
|
|
174
|
-
"""
|
|
175
|
-
if len(kwargs) == 1 and 'handle' in kwargs:
|
|
176
|
-
self.handle = kwargs['handle']
|
|
177
|
-
_gotdf_python.IncRef(self.handle)
|
|
178
|
-
elif len(args) == 1 and isinstance(args[0], go.GoClass):
|
|
179
|
-
self.handle = args[0].handle
|
|
180
|
-
_gotdf_python.IncRef(self.handle)
|
|
181
|
-
else:
|
|
182
|
-
self.handle = _gotdf_python.gotdf_python_TokenAuth_CTor()
|
|
183
|
-
_gotdf_python.IncRef(self.handle)
|
|
184
|
-
if 0 < len(args):
|
|
185
|
-
self.AccessToken = args[0]
|
|
186
|
-
if "AccessToken" in kwargs:
|
|
187
|
-
self.AccessToken = kwargs["AccessToken"]
|
|
188
|
-
if 1 < len(args):
|
|
189
|
-
self.NpeClientId = args[1]
|
|
190
|
-
if "NpeClientId" in kwargs:
|
|
191
|
-
self.NpeClientId = kwargs["NpeClientId"]
|
|
192
|
-
def __del__(self):
|
|
193
|
-
_gotdf_python.DecRef(self.handle)
|
|
194
|
-
def __str__(self):
|
|
195
|
-
pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
|
|
196
|
-
sv = 'gotdf_python.TokenAuth{'
|
|
197
|
-
first = True
|
|
198
|
-
for v in pr:
|
|
199
|
-
if callable(v[1]):
|
|
200
|
-
continue
|
|
201
|
-
if first:
|
|
202
|
-
first = False
|
|
203
|
-
else:
|
|
204
|
-
sv += ', '
|
|
205
|
-
sv += v[0] + '=' + str(v[1])
|
|
206
|
-
return sv + '}'
|
|
207
|
-
def __repr__(self):
|
|
208
|
-
pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
|
|
209
|
-
sv = 'gotdf_python.TokenAuth ( '
|
|
210
|
-
for v in pr:
|
|
211
|
-
if not callable(v[1]):
|
|
212
|
-
sv += v[0] + '=' + str(v[1]) + ', '
|
|
213
|
-
return sv + ')'
|
|
214
|
-
@property
|
|
215
|
-
def AccessToken(self):
|
|
216
|
-
return _gotdf_python.gotdf_python_TokenAuth_AccessToken_Get(self.handle)
|
|
217
|
-
@AccessToken.setter
|
|
218
|
-
def AccessToken(self, value):
|
|
219
|
-
if isinstance(value, go.GoClass):
|
|
220
|
-
_gotdf_python.gotdf_python_TokenAuth_AccessToken_Set(self.handle, value.handle)
|
|
221
|
-
else:
|
|
222
|
-
_gotdf_python.gotdf_python_TokenAuth_AccessToken_Set(self.handle, value)
|
|
223
|
-
@property
|
|
224
|
-
def NpeClientId(self):
|
|
225
|
-
return _gotdf_python.gotdf_python_TokenAuth_NpeClientId_Get(self.handle)
|
|
226
|
-
@NpeClientId.setter
|
|
227
|
-
def NpeClientId(self, value):
|
|
228
|
-
if isinstance(value, go.GoClass):
|
|
229
|
-
_gotdf_python.gotdf_python_TokenAuth_NpeClientId_Set(self.handle, value.handle)
|
|
230
|
-
else:
|
|
231
|
-
_gotdf_python.gotdf_python_TokenAuth_NpeClientId_Set(self.handle, value)
|
|
232
|
-
|
|
233
|
-
# Python type for struct gotdf_python.DecryptionConfig
|
|
234
|
-
class DecryptionConfig(go.GoClass):
|
|
235
|
-
""""""
|
|
236
|
-
def __init__(self, *args, **kwargs):
|
|
237
|
-
"""
|
|
238
|
-
handle=A Go-side object is always initialized with an explicit handle=arg
|
|
239
|
-
otherwise parameters can be unnamed in order of field names or named fields
|
|
240
|
-
in which case a new Go object is constructed first
|
|
241
|
-
"""
|
|
242
|
-
if len(kwargs) == 1 and 'handle' in kwargs:
|
|
243
|
-
self.handle = kwargs['handle']
|
|
244
|
-
_gotdf_python.IncRef(self.handle)
|
|
245
|
-
elif len(args) == 1 and isinstance(args[0], go.GoClass):
|
|
246
|
-
self.handle = args[0].handle
|
|
247
|
-
_gotdf_python.IncRef(self.handle)
|
|
248
|
-
else:
|
|
249
|
-
self.handle = _gotdf_python.gotdf_python_DecryptionConfig_CTor()
|
|
250
|
-
_gotdf_python.IncRef(self.handle)
|
|
251
|
-
if 0 < len(args):
|
|
252
|
-
self.ClientId = args[0]
|
|
253
|
-
if "ClientId" in kwargs:
|
|
254
|
-
self.ClientId = kwargs["ClientId"]
|
|
255
|
-
if 1 < len(args):
|
|
256
|
-
self.ClientSecret = args[1]
|
|
257
|
-
if "ClientSecret" in kwargs:
|
|
258
|
-
self.ClientSecret = kwargs["ClientSecret"]
|
|
259
|
-
if 2 < len(args):
|
|
260
|
-
self.PlatformEndpoint = args[2]
|
|
261
|
-
if "PlatformEndpoint" in kwargs:
|
|
262
|
-
self.PlatformEndpoint = kwargs["PlatformEndpoint"]
|
|
263
|
-
if 3 < len(args):
|
|
264
|
-
self.TokenEndpoint = args[3]
|
|
265
|
-
if "TokenEndpoint" in kwargs:
|
|
266
|
-
self.TokenEndpoint = kwargs["TokenEndpoint"]
|
|
267
|
-
if 4 < len(args):
|
|
268
|
-
self.KasUrl = args[4]
|
|
269
|
-
if "KasUrl" in kwargs:
|
|
270
|
-
self.KasUrl = kwargs["KasUrl"]
|
|
271
|
-
def __del__(self):
|
|
272
|
-
_gotdf_python.DecRef(self.handle)
|
|
273
|
-
def __str__(self):
|
|
274
|
-
pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
|
|
275
|
-
sv = 'gotdf_python.DecryptionConfig{'
|
|
276
|
-
first = True
|
|
277
|
-
for v in pr:
|
|
278
|
-
if callable(v[1]):
|
|
279
|
-
continue
|
|
280
|
-
if first:
|
|
281
|
-
first = False
|
|
282
|
-
else:
|
|
283
|
-
sv += ', '
|
|
284
|
-
sv += v[0] + '=' + str(v[1])
|
|
285
|
-
return sv + '}'
|
|
286
|
-
def __repr__(self):
|
|
287
|
-
pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
|
|
288
|
-
sv = 'gotdf_python.DecryptionConfig ( '
|
|
289
|
-
for v in pr:
|
|
290
|
-
if not callable(v[1]):
|
|
291
|
-
sv += v[0] + '=' + str(v[1]) + ', '
|
|
292
|
-
return sv + ')'
|
|
293
|
-
@property
|
|
294
|
-
def ClientId(self):
|
|
295
|
-
return _gotdf_python.gotdf_python_DecryptionConfig_ClientId_Get(self.handle)
|
|
296
|
-
@ClientId.setter
|
|
297
|
-
def ClientId(self, value):
|
|
298
|
-
if isinstance(value, go.GoClass):
|
|
299
|
-
_gotdf_python.gotdf_python_DecryptionConfig_ClientId_Set(self.handle, value.handle)
|
|
300
|
-
else:
|
|
301
|
-
_gotdf_python.gotdf_python_DecryptionConfig_ClientId_Set(self.handle, value)
|
|
302
|
-
@property
|
|
303
|
-
def ClientSecret(self):
|
|
304
|
-
return _gotdf_python.gotdf_python_DecryptionConfig_ClientSecret_Get(self.handle)
|
|
305
|
-
@ClientSecret.setter
|
|
306
|
-
def ClientSecret(self, value):
|
|
307
|
-
if isinstance(value, go.GoClass):
|
|
308
|
-
_gotdf_python.gotdf_python_DecryptionConfig_ClientSecret_Set(self.handle, value.handle)
|
|
309
|
-
else:
|
|
310
|
-
_gotdf_python.gotdf_python_DecryptionConfig_ClientSecret_Set(self.handle, value)
|
|
311
|
-
@property
|
|
312
|
-
def PlatformEndpoint(self):
|
|
313
|
-
return _gotdf_python.gotdf_python_DecryptionConfig_PlatformEndpoint_Get(self.handle)
|
|
314
|
-
@PlatformEndpoint.setter
|
|
315
|
-
def PlatformEndpoint(self, value):
|
|
316
|
-
if isinstance(value, go.GoClass):
|
|
317
|
-
_gotdf_python.gotdf_python_DecryptionConfig_PlatformEndpoint_Set(self.handle, value.handle)
|
|
318
|
-
else:
|
|
319
|
-
_gotdf_python.gotdf_python_DecryptionConfig_PlatformEndpoint_Set(self.handle, value)
|
|
320
|
-
@property
|
|
321
|
-
def TokenEndpoint(self):
|
|
322
|
-
return _gotdf_python.gotdf_python_DecryptionConfig_TokenEndpoint_Get(self.handle)
|
|
323
|
-
@TokenEndpoint.setter
|
|
324
|
-
def TokenEndpoint(self, value):
|
|
325
|
-
if isinstance(value, go.GoClass):
|
|
326
|
-
_gotdf_python.gotdf_python_DecryptionConfig_TokenEndpoint_Set(self.handle, value.handle)
|
|
327
|
-
else:
|
|
328
|
-
_gotdf_python.gotdf_python_DecryptionConfig_TokenEndpoint_Set(self.handle, value)
|
|
329
|
-
@property
|
|
330
|
-
def KasUrl(self):
|
|
331
|
-
return _gotdf_python.gotdf_python_DecryptionConfig_KasUrl_Get(self.handle)
|
|
332
|
-
@KasUrl.setter
|
|
333
|
-
def KasUrl(self, value):
|
|
334
|
-
if isinstance(value, go.GoClass):
|
|
335
|
-
_gotdf_python.gotdf_python_DecryptionConfig_KasUrl_Set(self.handle, value.handle)
|
|
336
|
-
else:
|
|
337
|
-
_gotdf_python.gotdf_python_DecryptionConfig_KasUrl_Set(self.handle, value)
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
# ---- Slices ---
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
# ---- Maps ---
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
# ---- Constructors ---
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
# ---- Functions ---
|
|
350
|
-
def Hello():
|
|
351
|
-
"""Hello() str
|
|
352
|
-
|
|
353
|
-
A simple "Hello, world" function, used for learning golang (e.g. unit testing),
|
|
354
|
-
as well as validating the necessary mechanisms to compile this library
|
|
355
|
-
into a Python wheel.
|
|
356
|
-
|
|
357
|
-
In the future, this function might be removed or replaced with a more
|
|
358
|
-
conventional & useful function like GetVersion()
|
|
359
|
-
"""
|
|
360
|
-
return _gotdf_python.gotdf_python_Hello()
|
|
361
|
-
def DecryptFile(inputFilePath, outputFilePath, config):
|
|
362
|
-
"""DecryptFile(str inputFilePath, str outputFilePath, object config) str, str"""
|
|
363
|
-
return _gotdf_python.gotdf_python_DecryptFile(inputFilePath, outputFilePath, config.handle)
|
|
364
|
-
def DecryptFilePE(inputFilePath, outputFilePath, config, token):
|
|
365
|
-
"""DecryptFilePE(str inputFilePath, str outputFilePath, object config, object token) str, str"""
|
|
366
|
-
return _gotdf_python.gotdf_python_DecryptFilePE(inputFilePath, outputFilePath, config.handle, token.handle)
|
|
367
|
-
def DecryptStringPE(inputText, config, token):
|
|
368
|
-
"""DecryptStringPE(str inputText, object config, object token) str, str"""
|
|
369
|
-
return _gotdf_python.gotdf_python_DecryptStringPE(inputText, config.handle, token.handle)
|
|
370
|
-
def EncryptFile(inputFilePath, outputFilePath, config):
|
|
371
|
-
"""EncryptFile(str inputFilePath, str outputFilePath, object config) str, str"""
|
|
372
|
-
return _gotdf_python.gotdf_python_EncryptFile(inputFilePath, outputFilePath, config.handle)
|
|
373
|
-
def EncryptFilePE(inputFilePath, outputFilePath, config, token):
|
|
374
|
-
"""EncryptFilePE(str inputFilePath, str outputFilePath, object config, object token) str, str
|
|
375
|
-
|
|
376
|
-
Encrypts a file as a PE (Person Entity), returning a TDF manifest and the cipher text.
|
|
377
|
-
"""
|
|
378
|
-
return _gotdf_python.gotdf_python_EncryptFilePE(inputFilePath, outputFilePath, config.handle, token.handle)
|
|
379
|
-
def EncryptString(inputText, config):
|
|
380
|
-
"""EncryptString(str inputText, object config) str, str"""
|
|
381
|
-
return _gotdf_python.gotdf_python_EncryptString(inputText, config.handle)
|
|
382
|
-
|
|
383
|
-
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: otdf_python
|
|
3
|
-
Version: 0.1.10
|
|
4
|
-
Home-page: https://github.com/b-long/opentdf-python-sdk
|
|
5
|
-
Author-email: b-long@users.noreply.github.com
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
License-File: LICENSE
|
|
8
|
-
|
|
9
|
-
# opentdf-python-sdk
|
|
10
|
-
|
|
11
|
-
Unofficial OpenTDF SDK for Python
|
|
12
|
-
|
|
13
|
-
[](https://github.com/b-long/opentdf-python-sdk/actions?query=workflow%3APyPIBuild)
|
|
14
|
-
|
|
15
|
-
This project is powered by gopy, which generates (and compiles) a CPython extension module from a go package. The `gopy`
|
|
16
|
-
tool unlocks performance, flexibility, and excellent Developer Experience to Python end-users. Read more about
|
|
17
|
-
[`gopy` on Github](https://github.com/go-python/gopy).
|
|
18
|
-
|
|
19
|
-
## Adding features
|
|
20
|
-
|
|
21
|
-
If you wish to expand the functionality of `otdf-python`:
|
|
22
|
-
|
|
23
|
-
1. Create a fork/branch
|
|
24
|
-
1. Add new capabilities (e.g. in `main.go`)
|
|
25
|
-
1. Add a test (e.g. in `otdf_python_test.go`)
|
|
26
|
-
1. Commit your changes, push, and open a Pull Request via
|
|
27
|
-
the Github project: https://github.com/b-long/opentdf-python-sdk
|
|
28
|
-
|
|
29
|
-
## Installation
|
|
30
|
-
|
|
31
|
-
Install from the [Python Package Index (PyPI)](https://pypi.org):
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
# Install the latest from pypi.org
|
|
35
|
-
pip install otdf_python
|
|
36
|
-
|
|
37
|
-
# Install a pinned version
|
|
38
|
-
pip install otdf-python==0.0.9
|
|
39
|
-
|
|
40
|
-
# Install a pinned version, from test.pypi.org
|
|
41
|
-
pip install -i https://test.pypi.org/simple/ otdf-python==0.0.9
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Usage
|
|
45
|
-
|
|
46
|
-
Simple usage examples are given below. In addition, we recommend you also:
|
|
47
|
-
|
|
48
|
-
1. See the contents of [`main.go` on Github](https://github.com/b-long/opentdf-python-sdk/blob/main/main.go). ✨ Note that all Upper-case functions are available in Python.
|
|
49
|
-
1. See the contents of [`validate_otdf_python.py` on Github](https://github.com/b-long/opentdf-python-sdk/blob/main/validate_otdf_python.py).
|
|
50
|
-
|
|
51
|
-
### Example: Configuration
|
|
52
|
-
|
|
53
|
-
Creating a helper function may simplify the usage of `otdf-python`.
|
|
54
|
-
|
|
55
|
-
For example:
|
|
56
|
-
|
|
57
|
-
```python
|
|
58
|
-
def get_encrypt_config(data_attributes: list | None = None):
|
|
59
|
-
"""
|
|
60
|
-
The config object returned here can only be used for encryption.
|
|
61
|
-
|
|
62
|
-
While 'otdf_python.gotdf_python' internally can use golang interfaces,
|
|
63
|
-
to normalize config objects, that pattern causes a panic
|
|
64
|
-
when used from Python.
|
|
65
|
-
|
|
66
|
-
"""
|
|
67
|
-
print("Preparing 'EncryptionConfig' object")
|
|
68
|
-
from otdf_python.gotdf_python import EncryptionConfig
|
|
69
|
-
from otdf_python.go import Slice_string
|
|
70
|
-
|
|
71
|
-
if isinstance(data_attributes, list):
|
|
72
|
-
# Create config using the attributes from the caller
|
|
73
|
-
da = Slice_string(data_attributes)
|
|
74
|
-
config: EncryptionConfig = EncryptionConfig(
|
|
75
|
-
ClientId="opentdf-sdk",
|
|
76
|
-
ClientSecret="secret",
|
|
77
|
-
PlatformEndpoint=platformEndpoint,
|
|
78
|
-
TokenEndpoint="http://localhost:8888/auth/realms/opentdf/protocol/openid-connect/token",
|
|
79
|
-
KasUrl=f"http://{platformEndpoint}/kas",
|
|
80
|
-
# FIXME: Be careful with binding the 'DataAttributes' field on this struct.
|
|
81
|
-
#
|
|
82
|
-
# In golang, this is initialized as []string , but passing
|
|
83
|
-
# DataAttributes=None, or DataAttributes=[] from Python will fail.
|
|
84
|
-
DataAttributes=da,
|
|
85
|
-
)
|
|
86
|
-
else:
|
|
87
|
-
# Create config without attributes
|
|
88
|
-
config: EncryptionConfig = EncryptionConfig(
|
|
89
|
-
ClientId="opentdf-sdk",
|
|
90
|
-
ClientSecret="secret",
|
|
91
|
-
PlatformEndpoint=platformEndpoint,
|
|
92
|
-
TokenEndpoint="http://localhost:8888/auth/realms/opentdf/protocol/openid-connect/token",
|
|
93
|
-
KasUrl=f"http://{platformEndpoint}/kas",
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
# NOTE: Structs from golang can be printed, like below
|
|
97
|
-
# print(config)
|
|
98
|
-
print("Returning 'EncryptionConfig'")
|
|
99
|
-
|
|
100
|
-
return config
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
### Example: Encrypt a string
|
|
105
|
-
|
|
106
|
-
```python
|
|
107
|
-
from otdf_python.gotdf_python import EncryptString
|
|
108
|
-
|
|
109
|
-
# Depends on the 'get_encrypt_config()' given
|
|
110
|
-
# in the README above
|
|
111
|
-
config: EncryptionConfig = get_encrypt_config()
|
|
112
|
-
|
|
113
|
-
tdf_manifest_json = EncryptString(inputText="Hello from Python", config=config)
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Example: Encrypt a file
|
|
117
|
-
|
|
118
|
-
```python
|
|
119
|
-
from otdf_python.gotdf_python import EncryptFile
|
|
120
|
-
from otdf_python.go import Slice_string
|
|
121
|
-
|
|
122
|
-
# Depends on the 'get_encrypt_config()' given
|
|
123
|
-
# in the README above
|
|
124
|
-
config: EncryptionConfig = get_encrypt_config()
|
|
125
|
-
|
|
126
|
-
with tempfile.TemporaryDirectory() as tmpDir:
|
|
127
|
-
print("Created temporary directory", tmpDir)
|
|
128
|
-
|
|
129
|
-
da = Slice_string(["https://example.com/attr/attr1/value/value1", "https://example.com/attr/attr1/value/value2"])
|
|
130
|
-
|
|
131
|
-
encrypted_file = Path(tmpDir) / "some-file.tdf"
|
|
132
|
-
|
|
133
|
-
if encrypted_file.exists():
|
|
134
|
-
encrypted_file.unlink()
|
|
135
|
-
|
|
136
|
-
if encrypted_file.exists():
|
|
137
|
-
raise ValueError(
|
|
138
|
-
"The output path should not exist before calling 'EncryptFile()'."
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
outputFilePath = EncryptFile(
|
|
142
|
-
inputFilePath=str(SOME_PLAINTEXT_FILE),
|
|
143
|
-
outputFilePath=str(encrypted_file),
|
|
144
|
-
config=config,
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
print(f"The output file was written to destination path: {outputFilePath}")
|
|
148
|
-
|
|
149
|
-
```
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
otdf_python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
otdf_python/_gotdf_python.cpython-312-darwin.so,sha256=rgrPa2j6S7QJLSUkQsRIKHbDQIOFfvhnSCY-wi05Ek4,15789992
|
|
3
|
-
otdf_python/build.py,sha256=K-TQXKbRn8_DaH8iBI1bh6Fifr4TwA71ZKI6puWNN9Y,16756
|
|
4
|
-
otdf_python/go.py,sha256=7kz0kwEbEJZp9ZJIvdcUryZmhahLRb5RrkhGBN2BDBY,49317
|
|
5
|
-
otdf_python/gotdf_python.py,sha256=MjJ27o4T79XD363Jh9UkELWzygBpqNJerR8MG_GAVz8,13880
|
|
6
|
-
otdf_python-0.1.10.dist-info/LICENSE,sha256=51wzGxR-Rns8XaiGmDLq2OqPN3qWMpoQKV-fERpVzyM,1063
|
|
7
|
-
otdf_python-0.1.10.dist-info/METADATA,sha256=pns0pHvTu26kBm-sjvco0zan-WIh3nzrC__hPtiCAzU,4934
|
|
8
|
-
otdf_python-0.1.10.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
9
|
-
otdf_python-0.1.10.dist-info/top_level.txt,sha256=A2vK95iTIxdu4pm8kDZlvHorBKCvSN5dvlMdFbIVXrA,12
|
|
10
|
-
otdf_python-0.1.10.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
otdf_python
|