otdf-python 0.0.4__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.
@@ -0,0 +1,383 @@
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.TokenAuth
48
+ class TokenAuth(go.GoClass):
49
+ """"""
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_TokenAuth_CTor()
64
+ _gotdf_python.IncRef(self.handle)
65
+ if 0 < len(args):
66
+ self.AccessToken = args[0]
67
+ if "AccessToken" in kwargs:
68
+ self.AccessToken = kwargs["AccessToken"]
69
+ if 1 < len(args):
70
+ self.NpeClientId = args[1]
71
+ if "NpeClientId" in kwargs:
72
+ self.NpeClientId = kwargs["NpeClientId"]
73
+ def __del__(self):
74
+ _gotdf_python.DecRef(self.handle)
75
+ def __str__(self):
76
+ pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
77
+ sv = 'gotdf_python.TokenAuth{'
78
+ first = True
79
+ for v in pr:
80
+ if callable(v[1]):
81
+ continue
82
+ if first:
83
+ first = False
84
+ else:
85
+ sv += ', '
86
+ sv += v[0] + '=' + str(v[1])
87
+ return sv + '}'
88
+ def __repr__(self):
89
+ pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
90
+ sv = 'gotdf_python.TokenAuth ( '
91
+ for v in pr:
92
+ if not callable(v[1]):
93
+ sv += v[0] + '=' + str(v[1]) + ', '
94
+ return sv + ')'
95
+ @property
96
+ def AccessToken(self):
97
+ return _gotdf_python.gotdf_python_TokenAuth_AccessToken_Get(self.handle)
98
+ @AccessToken.setter
99
+ def AccessToken(self, value):
100
+ if isinstance(value, go.GoClass):
101
+ _gotdf_python.gotdf_python_TokenAuth_AccessToken_Set(self.handle, value.handle)
102
+ else:
103
+ _gotdf_python.gotdf_python_TokenAuth_AccessToken_Set(self.handle, value)
104
+ @property
105
+ def NpeClientId(self):
106
+ return _gotdf_python.gotdf_python_TokenAuth_NpeClientId_Get(self.handle)
107
+ @NpeClientId.setter
108
+ def NpeClientId(self, value):
109
+ if isinstance(value, go.GoClass):
110
+ _gotdf_python.gotdf_python_TokenAuth_NpeClientId_Set(self.handle, value.handle)
111
+ else:
112
+ _gotdf_python.gotdf_python_TokenAuth_NpeClientId_Set(self.handle, value)
113
+
114
+ # Python type for struct gotdf_python.DecryptionConfig
115
+ class DecryptionConfig(go.GoClass):
116
+ """"""
117
+ def __init__(self, *args, **kwargs):
118
+ """
119
+ handle=A Go-side object is always initialized with an explicit handle=arg
120
+ otherwise parameters can be unnamed in order of field names or named fields
121
+ in which case a new Go object is constructed first
122
+ """
123
+ if len(kwargs) == 1 and 'handle' in kwargs:
124
+ self.handle = kwargs['handle']
125
+ _gotdf_python.IncRef(self.handle)
126
+ elif len(args) == 1 and isinstance(args[0], go.GoClass):
127
+ self.handle = args[0].handle
128
+ _gotdf_python.IncRef(self.handle)
129
+ else:
130
+ self.handle = _gotdf_python.gotdf_python_DecryptionConfig_CTor()
131
+ _gotdf_python.IncRef(self.handle)
132
+ if 0 < len(args):
133
+ self.ClientId = args[0]
134
+ if "ClientId" in kwargs:
135
+ self.ClientId = kwargs["ClientId"]
136
+ if 1 < len(args):
137
+ self.ClientSecret = args[1]
138
+ if "ClientSecret" in kwargs:
139
+ self.ClientSecret = kwargs["ClientSecret"]
140
+ if 2 < len(args):
141
+ self.PlatformEndpoint = args[2]
142
+ if "PlatformEndpoint" in kwargs:
143
+ self.PlatformEndpoint = kwargs["PlatformEndpoint"]
144
+ if 3 < len(args):
145
+ self.TokenEndpoint = args[3]
146
+ if "TokenEndpoint" in kwargs:
147
+ self.TokenEndpoint = kwargs["TokenEndpoint"]
148
+ if 4 < len(args):
149
+ self.KasUrl = args[4]
150
+ if "KasUrl" in kwargs:
151
+ self.KasUrl = kwargs["KasUrl"]
152
+ def __del__(self):
153
+ _gotdf_python.DecRef(self.handle)
154
+ def __str__(self):
155
+ pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
156
+ sv = 'gotdf_python.DecryptionConfig{'
157
+ first = True
158
+ for v in pr:
159
+ if callable(v[1]):
160
+ continue
161
+ if first:
162
+ first = False
163
+ else:
164
+ sv += ', '
165
+ sv += v[0] + '=' + str(v[1])
166
+ return sv + '}'
167
+ def __repr__(self):
168
+ pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
169
+ sv = 'gotdf_python.DecryptionConfig ( '
170
+ for v in pr:
171
+ if not callable(v[1]):
172
+ sv += v[0] + '=' + str(v[1]) + ', '
173
+ return sv + ')'
174
+ @property
175
+ def ClientId(self):
176
+ return _gotdf_python.gotdf_python_DecryptionConfig_ClientId_Get(self.handle)
177
+ @ClientId.setter
178
+ def ClientId(self, value):
179
+ if isinstance(value, go.GoClass):
180
+ _gotdf_python.gotdf_python_DecryptionConfig_ClientId_Set(self.handle, value.handle)
181
+ else:
182
+ _gotdf_python.gotdf_python_DecryptionConfig_ClientId_Set(self.handle, value)
183
+ @property
184
+ def ClientSecret(self):
185
+ return _gotdf_python.gotdf_python_DecryptionConfig_ClientSecret_Get(self.handle)
186
+ @ClientSecret.setter
187
+ def ClientSecret(self, value):
188
+ if isinstance(value, go.GoClass):
189
+ _gotdf_python.gotdf_python_DecryptionConfig_ClientSecret_Set(self.handle, value.handle)
190
+ else:
191
+ _gotdf_python.gotdf_python_DecryptionConfig_ClientSecret_Set(self.handle, value)
192
+ @property
193
+ def PlatformEndpoint(self):
194
+ return _gotdf_python.gotdf_python_DecryptionConfig_PlatformEndpoint_Get(self.handle)
195
+ @PlatformEndpoint.setter
196
+ def PlatformEndpoint(self, value):
197
+ if isinstance(value, go.GoClass):
198
+ _gotdf_python.gotdf_python_DecryptionConfig_PlatformEndpoint_Set(self.handle, value.handle)
199
+ else:
200
+ _gotdf_python.gotdf_python_DecryptionConfig_PlatformEndpoint_Set(self.handle, value)
201
+ @property
202
+ def TokenEndpoint(self):
203
+ return _gotdf_python.gotdf_python_DecryptionConfig_TokenEndpoint_Get(self.handle)
204
+ @TokenEndpoint.setter
205
+ def TokenEndpoint(self, value):
206
+ if isinstance(value, go.GoClass):
207
+ _gotdf_python.gotdf_python_DecryptionConfig_TokenEndpoint_Set(self.handle, value.handle)
208
+ else:
209
+ _gotdf_python.gotdf_python_DecryptionConfig_TokenEndpoint_Set(self.handle, value)
210
+ @property
211
+ def KasUrl(self):
212
+ return _gotdf_python.gotdf_python_DecryptionConfig_KasUrl_Get(self.handle)
213
+ @KasUrl.setter
214
+ def KasUrl(self, value):
215
+ if isinstance(value, go.GoClass):
216
+ _gotdf_python.gotdf_python_DecryptionConfig_KasUrl_Set(self.handle, value.handle)
217
+ else:
218
+ _gotdf_python.gotdf_python_DecryptionConfig_KasUrl_Set(self.handle, value)
219
+
220
+ # Python type for struct gotdf_python.EncryptionConfig
221
+ class EncryptionConfig(go.GoClass):
222
+ """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"""
223
+ def __init__(self, *args, **kwargs):
224
+ """
225
+ handle=A Go-side object is always initialized with an explicit handle=arg
226
+ otherwise parameters can be unnamed in order of field names or named fields
227
+ in which case a new Go object is constructed first
228
+ """
229
+ if len(kwargs) == 1 and 'handle' in kwargs:
230
+ self.handle = kwargs['handle']
231
+ _gotdf_python.IncRef(self.handle)
232
+ elif len(args) == 1 and isinstance(args[0], go.GoClass):
233
+ self.handle = args[0].handle
234
+ _gotdf_python.IncRef(self.handle)
235
+ else:
236
+ self.handle = _gotdf_python.gotdf_python_EncryptionConfig_CTor()
237
+ _gotdf_python.IncRef(self.handle)
238
+ if 0 < len(args):
239
+ self.ClientId = args[0]
240
+ if "ClientId" in kwargs:
241
+ self.ClientId = kwargs["ClientId"]
242
+ if 1 < len(args):
243
+ self.ClientSecret = args[1]
244
+ if "ClientSecret" in kwargs:
245
+ self.ClientSecret = kwargs["ClientSecret"]
246
+ if 2 < len(args):
247
+ self.PlatformEndpoint = args[2]
248
+ if "PlatformEndpoint" in kwargs:
249
+ self.PlatformEndpoint = kwargs["PlatformEndpoint"]
250
+ if 3 < len(args):
251
+ self.TokenEndpoint = args[3]
252
+ if "TokenEndpoint" in kwargs:
253
+ self.TokenEndpoint = kwargs["TokenEndpoint"]
254
+ if 4 < len(args):
255
+ self.KasUrl = args[4]
256
+ if "KasUrl" in kwargs:
257
+ self.KasUrl = kwargs["KasUrl"]
258
+ if 5 < len(args):
259
+ self.DataAttributes = args[5]
260
+ if "DataAttributes" in kwargs:
261
+ self.DataAttributes = kwargs["DataAttributes"]
262
+ def __del__(self):
263
+ _gotdf_python.DecRef(self.handle)
264
+ def __str__(self):
265
+ pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
266
+ sv = 'gotdf_python.EncryptionConfig{'
267
+ first = True
268
+ for v in pr:
269
+ if callable(v[1]):
270
+ continue
271
+ if first:
272
+ first = False
273
+ else:
274
+ sv += ', '
275
+ sv += v[0] + '=' + str(v[1])
276
+ return sv + '}'
277
+ def __repr__(self):
278
+ pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
279
+ sv = 'gotdf_python.EncryptionConfig ( '
280
+ for v in pr:
281
+ if not callable(v[1]):
282
+ sv += v[0] + '=' + str(v[1]) + ', '
283
+ return sv + ')'
284
+ @property
285
+ def ClientId(self):
286
+ return _gotdf_python.gotdf_python_EncryptionConfig_ClientId_Get(self.handle)
287
+ @ClientId.setter
288
+ def ClientId(self, value):
289
+ if isinstance(value, go.GoClass):
290
+ _gotdf_python.gotdf_python_EncryptionConfig_ClientId_Set(self.handle, value.handle)
291
+ else:
292
+ _gotdf_python.gotdf_python_EncryptionConfig_ClientId_Set(self.handle, value)
293
+ @property
294
+ def ClientSecret(self):
295
+ return _gotdf_python.gotdf_python_EncryptionConfig_ClientSecret_Get(self.handle)
296
+ @ClientSecret.setter
297
+ def ClientSecret(self, value):
298
+ if isinstance(value, go.GoClass):
299
+ _gotdf_python.gotdf_python_EncryptionConfig_ClientSecret_Set(self.handle, value.handle)
300
+ else:
301
+ _gotdf_python.gotdf_python_EncryptionConfig_ClientSecret_Set(self.handle, value)
302
+ @property
303
+ def PlatformEndpoint(self):
304
+ return _gotdf_python.gotdf_python_EncryptionConfig_PlatformEndpoint_Get(self.handle)
305
+ @PlatformEndpoint.setter
306
+ def PlatformEndpoint(self, value):
307
+ if isinstance(value, go.GoClass):
308
+ _gotdf_python.gotdf_python_EncryptionConfig_PlatformEndpoint_Set(self.handle, value.handle)
309
+ else:
310
+ _gotdf_python.gotdf_python_EncryptionConfig_PlatformEndpoint_Set(self.handle, value)
311
+ @property
312
+ def TokenEndpoint(self):
313
+ return _gotdf_python.gotdf_python_EncryptionConfig_TokenEndpoint_Get(self.handle)
314
+ @TokenEndpoint.setter
315
+ def TokenEndpoint(self, value):
316
+ if isinstance(value, go.GoClass):
317
+ _gotdf_python.gotdf_python_EncryptionConfig_TokenEndpoint_Set(self.handle, value.handle)
318
+ else:
319
+ _gotdf_python.gotdf_python_EncryptionConfig_TokenEndpoint_Set(self.handle, value)
320
+ @property
321
+ def KasUrl(self):
322
+ return _gotdf_python.gotdf_python_EncryptionConfig_KasUrl_Get(self.handle)
323
+ @KasUrl.setter
324
+ def KasUrl(self, value):
325
+ if isinstance(value, go.GoClass):
326
+ _gotdf_python.gotdf_python_EncryptionConfig_KasUrl_Set(self.handle, value.handle)
327
+ else:
328
+ _gotdf_python.gotdf_python_EncryptionConfig_KasUrl_Set(self.handle, value)
329
+ @property
330
+ def DataAttributes(self):
331
+ return go.Slice_string(handle=_gotdf_python.gotdf_python_EncryptionConfig_DataAttributes_Get(self.handle))
332
+ @DataAttributes.setter
333
+ def DataAttributes(self, value):
334
+ if isinstance(value, go.GoClass):
335
+ _gotdf_python.gotdf_python_EncryptionConfig_DataAttributes_Set(self.handle, value.handle)
336
+ else:
337
+ raise TypeError("supplied argument type {t} is not a go.GoClass".format(t=type(value)))
338
+
339
+
340
+ # ---- Slices ---
341
+
342
+
343
+ # ---- Maps ---
344
+
345
+
346
+ # ---- Constructors ---
347
+
348
+
349
+ # ---- Functions ---
350
+ def DecryptFile(inputFilePath, outputFilePath, config):
351
+ """DecryptFile(str inputFilePath, str outputFilePath, object config) str, str"""
352
+ return _gotdf_python.gotdf_python_DecryptFile(inputFilePath, outputFilePath, config.handle)
353
+ def DecryptFilePE(inputFilePath, outputFilePath, config, token):
354
+ """DecryptFilePE(str inputFilePath, str outputFilePath, object config, object token) str, str"""
355
+ return _gotdf_python.gotdf_python_DecryptFilePE(inputFilePath, outputFilePath, config.handle, token.handle)
356
+ def DecryptStringPE(inputText, config, token):
357
+ """DecryptStringPE(str inputText, object config, object token) str, str"""
358
+ return _gotdf_python.gotdf_python_DecryptStringPE(inputText, config.handle, token.handle)
359
+ def EncryptFile(inputFilePath, outputFilePath, config):
360
+ """EncryptFile(str inputFilePath, str outputFilePath, object config) str, str"""
361
+ return _gotdf_python.gotdf_python_EncryptFile(inputFilePath, outputFilePath, config.handle)
362
+ def EncryptFilePE(inputFilePath, outputFilePath, config, token):
363
+ """EncryptFilePE(str inputFilePath, str outputFilePath, object config, object token) str, str
364
+
365
+ Encrypts a file as a PE (Person Entity), returning a TDF manifest and the cipher text.
366
+ """
367
+ return _gotdf_python.gotdf_python_EncryptFilePE(inputFilePath, outputFilePath, config.handle, token.handle)
368
+ def EncryptString(inputText, config):
369
+ """EncryptString(str inputText, object config) str, str"""
370
+ return _gotdf_python.gotdf_python_EncryptString(inputText, config.handle)
371
+ def Hello():
372
+ """Hello() str
373
+
374
+ A simple "Hello, world" function, used for learning golang (e.g. unit testing),
375
+ as well as validating the necessary mechanisms to compile this library
376
+ into a Python wheel.
377
+
378
+ In the future, this function might be removed or replaced with a more
379
+ conventional & useful function like GetVersion()
380
+ """
381
+ return _gotdf_python.gotdf_python_Hello()
382
+
383
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 b-long
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,22 @@
1
+ Metadata-Version: 2.1
2
+ Name: otdf_python
3
+ Version: 0.0.4
4
+ Home-page: https://github.com/b-long/opentdf-python-sdk
5
+ Description-Content-Type: text/markdown
6
+ License-File: LICENSE
7
+
8
+ # opentdf-python-sdk
9
+
10
+ Unofficial OpenTDF SDK for Python
11
+
12
+ ## Installation
13
+
14
+ Install from PyPI.org:
15
+
16
+ ```bash
17
+ pip install otdf_python
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ See `validate_otdf_python.py` for usage examples.
@@ -0,0 +1,10 @@
1
+ otdf_python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ otdf_python/_gotdf_python.cpython-311-darwin.so,sha256=skpt12w1l5WxI8FgcBSK950r-whK73Ne0k5bV6Sv4CY,14621432
3
+ otdf_python/build.py,sha256=n992UQdwhJukysD1zgty1LrOnNTPEGAAG9MOWGlaJqs,16756
4
+ otdf_python/go.py,sha256=7kz0kwEbEJZp9ZJIvdcUryZmhahLRb5RrkhGBN2BDBY,49317
5
+ otdf_python/gotdf_python.py,sha256=1-Agpw4XFW01MudVbpiuf59ZRKSzvARXv-ojOlbeKsE,13880
6
+ otdf_python-0.0.4.dist-info/LICENSE,sha256=51wzGxR-Rns8XaiGmDLq2OqPN3qWMpoQKV-fERpVzyM,1063
7
+ otdf_python-0.0.4.dist-info/METADATA,sha256=51VS1FDVGOGRTSkA6OB3OusYjOdnJj57VmMKiURAQvQ,369
8
+ otdf_python-0.0.4.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
9
+ otdf_python-0.0.4.dist-info/top_level.txt,sha256=A2vK95iTIxdu4pm8kDZlvHorBKCvSN5dvlMdFbIVXrA,12
10
+ otdf_python-0.0.4.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (71.1.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ otdf_python