c2pa-python 0.27.0__tar.gz → 0.27.1__tar.gz
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.
- {c2pa_python-0.27.0/src/c2pa_python.egg-info → c2pa_python-0.27.1}/PKG-INFO +1 -1
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/pyproject.toml +1 -1
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/src/c2pa/c2pa.py +46 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1/src/c2pa_python.egg-info}/PKG-INFO +1 -1
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/LICENSE-APACHE +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/LICENSE-MIT +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/MANIFEST.in +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/README.md +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/requirements.txt +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/scripts/download_artifacts.py +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/setup.cfg +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/setup.py +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/src/c2pa/__init__.py +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/src/c2pa/build.py +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/src/c2pa/lib.py +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/src/c2pa_python.egg-info/SOURCES.txt +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/src/c2pa_python.egg-info/dependency_links.txt +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/src/c2pa_python.egg-info/entry_points.txt +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/src/c2pa_python.egg-info/requires.txt +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/src/c2pa_python.egg-info/top_level.txt +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/tests/test_unit_tests.py +0 -0
- {c2pa_python-0.27.0 → c2pa_python-0.27.1}/tests/test_unit_tests_threaded.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: c2pa-python
|
|
3
|
-
Version: 0.27.
|
|
3
|
+
Version: 0.27.1
|
|
4
4
|
Summary: Python bindings for the C2PA Content Authenticity Initiative (CAI) library
|
|
5
5
|
Author-email: Gavin Peacock <gvnpeacock@adobe.com>, Tania Mathern <mathern@adobe.com>
|
|
6
6
|
Maintainer-email: Gavin Peacock <gpeacock@adobe.com>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "c2pa-python"
|
|
7
|
-
version = "0.27.
|
|
7
|
+
version = "0.27.1"
|
|
8
8
|
requires-python = ">=3.10"
|
|
9
9
|
description = "Python bindings for the C2PA Content Authenticity Initiative (CAI) library"
|
|
10
10
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
@@ -244,6 +244,19 @@ class C2paStream(ctypes.Structure):
|
|
|
244
244
|
]
|
|
245
245
|
|
|
246
246
|
|
|
247
|
+
def _clear_error_state():
|
|
248
|
+
"""Clear any existing error state from the C library.
|
|
249
|
+
|
|
250
|
+
This function should be called at the beginning of object initialization
|
|
251
|
+
and before any operations that could potentially raise an error,
|
|
252
|
+
to ensure that stale error states from previous operations don't interfere
|
|
253
|
+
with new objects being created, or independent function calls.
|
|
254
|
+
"""
|
|
255
|
+
error = _lib.c2pa_error()
|
|
256
|
+
if error:
|
|
257
|
+
# Free the error to clear the state
|
|
258
|
+
_lib.c2pa_string_free(error)
|
|
259
|
+
|
|
247
260
|
class C2paSignerInfo(ctypes.Structure):
|
|
248
261
|
"""Configuration for a Signer."""
|
|
249
262
|
_fields_ = [
|
|
@@ -264,6 +277,7 @@ class C2paSignerInfo(ctypes.Structure):
|
|
|
264
277
|
private_key: The private key as a string
|
|
265
278
|
ta_url: The timestamp authority URL as bytes
|
|
266
279
|
"""
|
|
280
|
+
_clear_error_state()
|
|
267
281
|
|
|
268
282
|
if sign_cert is None:
|
|
269
283
|
raise ValueError("sign_cert must be set")
|
|
@@ -692,6 +706,8 @@ def load_settings(settings: Union[str, dict], format: str = "json") -> None:
|
|
|
692
706
|
Raises:
|
|
693
707
|
C2paError: If there was an error loading the settings
|
|
694
708
|
"""
|
|
709
|
+
_clear_error_state()
|
|
710
|
+
|
|
695
711
|
# Convert to JSON string as necessary
|
|
696
712
|
try:
|
|
697
713
|
if isinstance(settings, dict):
|
|
@@ -776,6 +792,8 @@ def read_ingredient_file(
|
|
|
776
792
|
stacklevel=2,
|
|
777
793
|
)
|
|
778
794
|
|
|
795
|
+
_clear_error_state()
|
|
796
|
+
|
|
779
797
|
container = _StringContainer()
|
|
780
798
|
|
|
781
799
|
container._path_str = str(path).encode('utf-8')
|
|
@@ -821,6 +839,8 @@ def read_file(path: Union[str, Path],
|
|
|
821
839
|
stacklevel=2,
|
|
822
840
|
)
|
|
823
841
|
|
|
842
|
+
_clear_error_state()
|
|
843
|
+
|
|
824
844
|
container = _StringContainer()
|
|
825
845
|
|
|
826
846
|
container._path_str = str(path).encode('utf-8')
|
|
@@ -907,6 +927,8 @@ def sign_file(
|
|
|
907
927
|
stacklevel=2,
|
|
908
928
|
)
|
|
909
929
|
|
|
930
|
+
_clear_error_state()
|
|
931
|
+
|
|
910
932
|
try:
|
|
911
933
|
# Determine if we have a signer or signer info
|
|
912
934
|
if isinstance(signer_or_info, C2paSignerInfo):
|
|
@@ -1375,6 +1397,9 @@ class Reader:
|
|
|
1375
1397
|
C2paError.Encoding: If any of the string inputs
|
|
1376
1398
|
contain invalid UTF-8 characters
|
|
1377
1399
|
"""
|
|
1400
|
+
# Native libs plumbing:
|
|
1401
|
+
# Clear any stale error state from previous operations
|
|
1402
|
+
_clear_error_state()
|
|
1378
1403
|
|
|
1379
1404
|
self._closed = False
|
|
1380
1405
|
self._initialized = False
|
|
@@ -1930,6 +1955,10 @@ class Signer:
|
|
|
1930
1955
|
Raises:
|
|
1931
1956
|
C2paError: If there was an error creating the signer
|
|
1932
1957
|
"""
|
|
1958
|
+
# Native libs plumbing:
|
|
1959
|
+
# Clear any stale error state from previous operations
|
|
1960
|
+
_clear_error_state()
|
|
1961
|
+
|
|
1933
1962
|
signer_ptr = _lib.c2pa_signer_from_info(ctypes.byref(signer_info))
|
|
1934
1963
|
|
|
1935
1964
|
if not signer_ptr:
|
|
@@ -2055,6 +2084,10 @@ class Signer:
|
|
|
2055
2084
|
cls._ERROR_MESSAGES['encoding_error'].format(
|
|
2056
2085
|
str(e)))
|
|
2057
2086
|
|
|
2087
|
+
# Native libs plumbing:
|
|
2088
|
+
# Clear any stale error state from previous operations
|
|
2089
|
+
_clear_error_state()
|
|
2090
|
+
|
|
2058
2091
|
# Create the callback object using the callback function
|
|
2059
2092
|
callback_cb = SignerCallback(wrapped_callback)
|
|
2060
2093
|
|
|
@@ -2095,6 +2128,10 @@ class Signer:
|
|
|
2095
2128
|
Raises:
|
|
2096
2129
|
C2paError: If the signer pointer is invalid
|
|
2097
2130
|
"""
|
|
2131
|
+
# Native libs plumbing:
|
|
2132
|
+
# Clear any stale error state from previous operations
|
|
2133
|
+
_clear_error_state()
|
|
2134
|
+
|
|
2098
2135
|
# Validate pointer before assignment
|
|
2099
2136
|
if not signer_ptr:
|
|
2100
2137
|
raise C2paError("Invalid signer pointer: pointer is null")
|
|
@@ -2327,6 +2364,7 @@ class Builder:
|
|
|
2327
2364
|
"""
|
|
2328
2365
|
builder = cls({})
|
|
2329
2366
|
stream_obj = Stream(stream)
|
|
2367
|
+
|
|
2330
2368
|
builder._builder = _lib.c2pa_builder_from_archive(stream_obj._stream)
|
|
2331
2369
|
|
|
2332
2370
|
if not builder._builder:
|
|
@@ -2352,6 +2390,10 @@ class Builder:
|
|
|
2352
2390
|
C2paError.Encoding: If manifest JSON contains invalid UTF-8 chars
|
|
2353
2391
|
C2paError.Json: If the manifest JSON cannot be serialized
|
|
2354
2392
|
"""
|
|
2393
|
+
# Native libs plumbing:
|
|
2394
|
+
# Clear any stale error state from previous operations
|
|
2395
|
+
_clear_error_state()
|
|
2396
|
+
|
|
2355
2397
|
self._closed = False
|
|
2356
2398
|
self._initialized = False
|
|
2357
2399
|
self._builder = None
|
|
@@ -2884,6 +2926,8 @@ def format_embeddable(format: str, manifest_bytes: bytes) -> tuple[int, bytes]:
|
|
|
2884
2926
|
Raises:
|
|
2885
2927
|
C2paError: If there was an error converting the manifest
|
|
2886
2928
|
"""
|
|
2929
|
+
_clear_error_state()
|
|
2930
|
+
|
|
2887
2931
|
format_str = format.encode('utf-8')
|
|
2888
2932
|
manifest_array = (ctypes.c_ubyte * len(manifest_bytes))(*manifest_bytes)
|
|
2889
2933
|
result_bytes_ptr = ctypes.POINTER(ctypes.c_ubyte)()
|
|
@@ -2993,6 +3037,8 @@ def ed25519_sign(data: bytes, private_key: str) -> bytes:
|
|
|
2993
3037
|
C2paError: If there was an error signing the data
|
|
2994
3038
|
C2paError.Encoding: If the private key contains invalid UTF-8 chars
|
|
2995
3039
|
"""
|
|
3040
|
+
_clear_error_state()
|
|
3041
|
+
|
|
2996
3042
|
if not data:
|
|
2997
3043
|
raise C2paError("Data to sign cannot be empty")
|
|
2998
3044
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: c2pa-python
|
|
3
|
-
Version: 0.27.
|
|
3
|
+
Version: 0.27.1
|
|
4
4
|
Summary: Python bindings for the C2PA Content Authenticity Initiative (CAI) library
|
|
5
5
|
Author-email: Gavin Peacock <gvnpeacock@adobe.com>, Tania Mathern <mathern@adobe.com>
|
|
6
6
|
Maintainer-email: Gavin Peacock <gpeacock@adobe.com>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|