trufo 2.3.0__tar.gz → 2.3.2__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.
- {trufo-2.3.0 → trufo-2.3.2}/PKG-INFO +9 -9
- {trufo-2.3.0 → trufo-2.3.2}/README.md +5 -5
- {trufo-2.3.0 → trufo-2.3.2}/pyproject.toml +5 -5
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/__init__.py +13 -9
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/headers.py +1 -1
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/tps/sign_c2pa.py +44 -23
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/c2pa/assertions.py +1 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/util/warnings.py +3 -3
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo.egg-info/PKG-INFO +9 -9
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo.egg-info/requires.txt +3 -3
- {trufo-2.3.0 → trufo-2.3.2}/LICENSE +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/setup.cfg +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/__init__.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/auth.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/endpoints.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/loopback_auth.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/session.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/tca/__init__.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/tca/certs_c2pa.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/tca/certs_cawg_interim.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/tca/certs_test.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/tps/__init__.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/tps/bind.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/tps/io.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/tps/records.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/tps/recover.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/api/tps/tasks.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/c2pa/__init__.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/c2pa/actions.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/c2pa/ai_system.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/c2pa/manifest.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/c2pa/redactions.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/c2pa/source_types.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/c2pa/thumbnails.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/c2pa/watermark.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/crypt/__init__.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/crypt/algorithms.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/crypt/keygen.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/crypt/kms.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/crypt/tca_certs.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/intf/__init__.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/intf/api_credentials.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/intf/c2pa_certificates.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/intf/cli.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/py.typed +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/util/__init__.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/util/credentials.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/util/deprecation.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo/util/optional_imports.py +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo.egg-info/SOURCES.txt +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo.egg-info/dependency_links.txt +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo.egg-info/entry_points.txt +0 -0
- {trufo-2.3.0 → trufo-2.3.2}/src/trufo.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trufo
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: Trufo SDK for content provenance API services.
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Homepage, https://trufo.ai
|
|
@@ -15,11 +15,11 @@ Requires-Dist: PyJWT>=2.6
|
|
|
15
15
|
Requires-Dist: requests>=2.28
|
|
16
16
|
Requires-Dist: uuid-utils>=0.6
|
|
17
17
|
Provides-Extra: local-sign-only
|
|
18
|
-
Requires-Dist: trufo-provenance[c2pa]<2.4.0,>=2.3.
|
|
18
|
+
Requires-Dist: trufo-provenance[c2pa]<2.4.0,>=2.3.2; extra == "local-sign-only"
|
|
19
19
|
Provides-Extra: local-full
|
|
20
|
-
Requires-Dist: trufo-provenance[c2pa,pawprint]<2.4.0,>=2.3.
|
|
20
|
+
Requires-Dist: trufo-provenance[c2pa,pawprint]<2.4.0,>=2.3.2; extra == "local-full"
|
|
21
21
|
Provides-Extra: provenance
|
|
22
|
-
Requires-Dist: trufo-provenance[c2pa]<2.4.0,>=2.3.
|
|
22
|
+
Requires-Dist: trufo-provenance[c2pa]<2.4.0,>=2.3.2; extra == "provenance"
|
|
23
23
|
Provides-Extra: test
|
|
24
24
|
Requires-Dist: pytest>=7.0; extra == "test"
|
|
25
25
|
Dynamic: license-file
|
|
@@ -47,16 +47,16 @@ trufo set-api-key c2pa-sign-test <your-api-key>
|
|
|
47
47
|
```python
|
|
48
48
|
from pathlib import Path
|
|
49
49
|
|
|
50
|
-
from trufo import
|
|
50
|
+
from trufo import sign_c2pa_cloud_test
|
|
51
51
|
from trufo.util.credentials import TrufoAPIKey, load_api_key
|
|
52
52
|
|
|
53
53
|
api_key = load_api_key(TrufoAPIKey.C2PA_SIGN_TEST)
|
|
54
54
|
|
|
55
|
-
signed_bytes =
|
|
55
|
+
signed_bytes = sign_c2pa_cloud_test(api_key, Path("input.jpg").read_bytes())
|
|
56
56
|
Path("signed.jpg").write_bytes(signed_bytes)
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
That is a complete C2PA signature — Trufo assembles and signs the manifest, so you need no certificate of your own. Swap in `
|
|
59
|
+
That is a complete C2PA signature — Trufo assembles and signs the manifest, so you need no certificate of your own. Swap in `sign_c2pa_cloud()` with a `c2pa-sign-prod` key for production-trusted output. See the [Signing Quickstart](docs/quickstart/2_c2pa_signing.md).
|
|
60
60
|
|
|
61
61
|
## What You Can Do
|
|
62
62
|
|
|
@@ -72,8 +72,8 @@ That is a complete C2PA signature — Trufo assembles and signs the manifest, so
|
|
|
72
72
|
|
|
73
73
|
In Local mode, your media stays on your machine: Trufo's engine builds the manifest locally, and Trufo receives the signing instructions and signs the claim. Two ways to run it:
|
|
74
74
|
|
|
75
|
-
- **Python SDK:** `
|
|
76
|
-
- **Docker image:** `ghcr.io/trufo-ai/trufo-local`, an HTTP service on your machine that signs files by path, for callers in any language; the full image (`2.
|
|
75
|
+
- **Python SDK:** `sign_c2pa_local()` with the `trufo[local-sign-only]` or `trufo[local-full]` extra; `local-full` adds local watermark embedding. See [Local mode with the Python SDK](docs/local/python.md).
|
|
76
|
+
- **Docker image:** `ghcr.io/trufo-ai/trufo-local`, an HTTP service on your machine that signs files by path, for callers in any language; the full image (`2.3-full`) adds watermark embedding. See [Local mode with the Docker image](docs/local/docker.md).
|
|
77
77
|
|
|
78
78
|
## Workflow Examples (Quickstart)
|
|
79
79
|
|
|
@@ -21,16 +21,16 @@ trufo set-api-key c2pa-sign-test <your-api-key>
|
|
|
21
21
|
```python
|
|
22
22
|
from pathlib import Path
|
|
23
23
|
|
|
24
|
-
from trufo import
|
|
24
|
+
from trufo import sign_c2pa_cloud_test
|
|
25
25
|
from trufo.util.credentials import TrufoAPIKey, load_api_key
|
|
26
26
|
|
|
27
27
|
api_key = load_api_key(TrufoAPIKey.C2PA_SIGN_TEST)
|
|
28
28
|
|
|
29
|
-
signed_bytes =
|
|
29
|
+
signed_bytes = sign_c2pa_cloud_test(api_key, Path("input.jpg").read_bytes())
|
|
30
30
|
Path("signed.jpg").write_bytes(signed_bytes)
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
That is a complete C2PA signature — Trufo assembles and signs the manifest, so you need no certificate of your own. Swap in `
|
|
33
|
+
That is a complete C2PA signature — Trufo assembles and signs the manifest, so you need no certificate of your own. Swap in `sign_c2pa_cloud()` with a `c2pa-sign-prod` key for production-trusted output. See the [Signing Quickstart](docs/quickstart/2_c2pa_signing.md).
|
|
34
34
|
|
|
35
35
|
## What You Can Do
|
|
36
36
|
|
|
@@ -46,8 +46,8 @@ That is a complete C2PA signature — Trufo assembles and signs the manifest, so
|
|
|
46
46
|
|
|
47
47
|
In Local mode, your media stays on your machine: Trufo's engine builds the manifest locally, and Trufo receives the signing instructions and signs the claim. Two ways to run it:
|
|
48
48
|
|
|
49
|
-
- **Python SDK:** `
|
|
50
|
-
- **Docker image:** `ghcr.io/trufo-ai/trufo-local`, an HTTP service on your machine that signs files by path, for callers in any language; the full image (`2.
|
|
49
|
+
- **Python SDK:** `sign_c2pa_local()` with the `trufo[local-sign-only]` or `trufo[local-full]` extra; `local-full` adds local watermark embedding. See [Local mode with the Python SDK](docs/local/python.md).
|
|
50
|
+
- **Docker image:** `ghcr.io/trufo-ai/trufo-local`, an HTTP service on your machine that signs files by path, for callers in any language; the full image (`2.3-full`) adds watermark embedding. See [Local mode with the Docker image](docs/local/docker.md).
|
|
51
51
|
|
|
52
52
|
## Workflow Examples (Quickstart)
|
|
53
53
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "trufo"
|
|
7
|
-
version = "2.3.
|
|
7
|
+
version = "2.3.2"
|
|
8
8
|
requires-python = ">=3.10"
|
|
9
9
|
description = "Trufo SDK for content provenance API services."
|
|
10
10
|
readme = "README.md"
|
|
@@ -18,12 +18,12 @@ dependencies = [
|
|
|
18
18
|
]
|
|
19
19
|
|
|
20
20
|
[project.optional-dependencies]
|
|
21
|
-
# local-sign-only:
|
|
21
|
+
# local-sign-only: C2PA Signing in Local mode, without the watermark engine
|
|
22
22
|
# (no torch); local-full adds trufo-pawprint for local watermark embedding.
|
|
23
23
|
# provenance is the legacy alias of local-sign-only.
|
|
24
|
-
local-sign-only = ["trufo-provenance[c2pa]>=2.3.
|
|
25
|
-
local-full = ["trufo-provenance[c2pa,pawprint]>=2.3.
|
|
26
|
-
provenance = ["trufo-provenance[c2pa]>=2.3.
|
|
24
|
+
local-sign-only = ["trufo-provenance[c2pa]>=2.3.2,<2.4.0"]
|
|
25
|
+
local-full = ["trufo-provenance[c2pa,pawprint]>=2.3.2,<2.4.0"]
|
|
26
|
+
provenance = ["trufo-provenance[c2pa]>=2.3.2,<2.4.0"]
|
|
27
27
|
test = ["pytest>=7.0"]
|
|
28
28
|
|
|
29
29
|
[project.urls]
|
|
@@ -26,11 +26,11 @@ from trufo.api.tps.records import get_content, list_content, set_content_status
|
|
|
26
26
|
from trufo.api.tps.recover import RecoverContentResult, recover_content
|
|
27
27
|
from trufo.api.tps.sign_c2pa import (
|
|
28
28
|
SignC2PAS3Result,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
sign_c2pa_cloud,
|
|
30
|
+
sign_c2pa_cloud_test,
|
|
31
|
+
sign_c2pa_local,
|
|
32
|
+
sign_c2pa_local_test,
|
|
32
33
|
sign_c2pa_s3,
|
|
33
|
-
sign_c2pa_test,
|
|
34
34
|
sign_c2pa_via_s3,
|
|
35
35
|
sign_c2pa_via_s3_test,
|
|
36
36
|
submit_c2pa_sign,
|
|
@@ -53,7 +53,7 @@ from trufo.util.credentials import load_api_key, save_api_key
|
|
|
53
53
|
from trufo.util.deprecation import deprecated_aliases
|
|
54
54
|
from trufo.util.warnings import TrufoServerWarning
|
|
55
55
|
|
|
56
|
-
__version__ = "2.3.
|
|
56
|
+
__version__ = "2.3.2"
|
|
57
57
|
|
|
58
58
|
__all__ = [
|
|
59
59
|
"ExecutionMode",
|
|
@@ -97,10 +97,10 @@ __all__ = [
|
|
|
97
97
|
"request_cawg_interim_cert",
|
|
98
98
|
"save_api_key",
|
|
99
99
|
"set_content_status",
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
100
|
+
"sign_c2pa_cloud",
|
|
101
|
+
"sign_c2pa_cloud_test",
|
|
102
|
+
"sign_c2pa_local",
|
|
103
|
+
"sign_c2pa_local_test",
|
|
104
104
|
"sign_c2pa_via_s3",
|
|
105
105
|
"sign_c2pa_via_s3_test",
|
|
106
106
|
"TrufoServerWarning",
|
|
@@ -112,5 +112,9 @@ __getattr__ = deprecated_aliases(
|
|
|
112
112
|
{
|
|
113
113
|
"request_c2pa_test_cert": "request_c2pa_dummy_cert",
|
|
114
114
|
"request_cawg_test_cert": "request_cawg_dummy_cert",
|
|
115
|
+
"sign_c2pa": "sign_c2pa_cloud",
|
|
116
|
+
"sign_c2pa_test": "sign_c2pa_cloud_test",
|
|
117
|
+
"sign_c2pa_distributed": "sign_c2pa_local",
|
|
118
|
+
"sign_c2pa_distributed_test": "sign_c2pa_local_test",
|
|
115
119
|
},
|
|
116
120
|
)
|
|
@@ -10,7 +10,7 @@ directly without them works exactly the same. They let Trufo see which SDK
|
|
|
10
10
|
generations are in use — which endpoints, which auth flows — without changing
|
|
11
11
|
any API contract.
|
|
12
12
|
|
|
13
|
-
The one place versions are *enforced* is
|
|
13
|
+
The one place versions are *enforced* is Local mode, which
|
|
14
14
|
requires a minimum trufo-py / trufo-provenance release. That check lives
|
|
15
15
|
server-side and predates this module.
|
|
16
16
|
"""
|
|
@@ -485,9 +485,9 @@ def sign_c2pa_s3_test(
|
|
|
485
485
|
manifest_settings: ManifestSettings | None = None,
|
|
486
486
|
trufo_api_url: str = TRUFO_API_URL_TEST,
|
|
487
487
|
) -> SignC2PAS3Result:
|
|
488
|
-
"""Deprecated and unsupported: use
|
|
488
|
+
"""Deprecated and unsupported: use sign_c2pa_cloud_test() with REQUEST bytes."""
|
|
489
489
|
raise ValueError(
|
|
490
|
-
"The test endpoint supports REQUEST execution with bytes only; use
|
|
490
|
+
"The test endpoint supports REQUEST execution with bytes only; use sign_c2pa_cloud_test()."
|
|
491
491
|
)
|
|
492
492
|
|
|
493
493
|
|
|
@@ -508,7 +508,7 @@ def sign_c2pa_via_s3(
|
|
|
508
508
|
wait_seconds: float = 600,
|
|
509
509
|
trufo_api_url: str = TRUFO_API_URL,
|
|
510
510
|
) -> bytes:
|
|
511
|
-
"""Deprecated: use
|
|
511
|
+
"""Deprecated: use sign_c2pa_cloud() with execution_mode=ExecutionMode.TASK.
|
|
512
512
|
|
|
513
513
|
Requires completed Organization Validation for the caller's org; the API
|
|
514
514
|
returns 403 otherwise.
|
|
@@ -546,7 +546,8 @@ def sign_c2pa_via_s3(
|
|
|
546
546
|
Trufo upload reference without waiting.
|
|
547
547
|
"""
|
|
548
548
|
warnings.warn(
|
|
549
|
-
"sign_c2pa_via_s3() is deprecated; use
|
|
549
|
+
"sign_c2pa_via_s3() is deprecated; use sign_c2pa_cloud() with "
|
|
550
|
+
"execution_mode=ExecutionMode.TASK.",
|
|
550
551
|
DeprecationWarning,
|
|
551
552
|
stacklevel=2,
|
|
552
553
|
)
|
|
@@ -604,9 +605,9 @@ def sign_c2pa_via_s3_test(
|
|
|
604
605
|
signed_ingredient_policy: SignedIngredientPolicy | str | None = None,
|
|
605
606
|
trufo_api_url: str = TRUFO_API_URL_TEST,
|
|
606
607
|
) -> bytes:
|
|
607
|
-
"""Deprecated and unsupported: use
|
|
608
|
+
"""Deprecated and unsupported: use sign_c2pa_cloud_test() with REQUEST bytes."""
|
|
608
609
|
raise ValueError(
|
|
609
|
-
"The test endpoint supports REQUEST execution with bytes only; use
|
|
610
|
+
"The test endpoint supports REQUEST execution with bytes only; use sign_c2pa_cloud_test()."
|
|
610
611
|
)
|
|
611
612
|
|
|
612
613
|
|
|
@@ -628,7 +629,7 @@ def _download_c2pa_s3_media(download_url: str) -> bytes:
|
|
|
628
629
|
return resp.content
|
|
629
630
|
|
|
630
631
|
|
|
631
|
-
def
|
|
632
|
+
def sign_c2pa_cloud(
|
|
632
633
|
api_key: str,
|
|
633
634
|
media_bytes: bytes,
|
|
634
635
|
actions: list | None = None,
|
|
@@ -668,7 +669,10 @@ def sign_c2pa(
|
|
|
668
669
|
signed_ingredient_policy: What to do when an ingredient's media is already
|
|
669
670
|
C2PA-signed; omit for ``auto``.
|
|
670
671
|
skip_manifest_storage: Ask Trufo not to keep a copy of the signed manifest;
|
|
671
|
-
refused with a per-embed watermark.
|
|
672
|
+
refused with a per-embed watermark. Please note that if this option is
|
|
673
|
+
elected, Trufo's ability to assist with signing-related issues, issue
|
|
674
|
+
personalized deprecation reminders, and provide content management
|
|
675
|
+
features will be limited.
|
|
672
676
|
trufo_api_url: Freeform Trufo API base URL. Defaults to production.
|
|
673
677
|
|
|
674
678
|
Returns:
|
|
@@ -729,7 +733,7 @@ def sign_c2pa(
|
|
|
729
733
|
)
|
|
730
734
|
|
|
731
735
|
|
|
732
|
-
def
|
|
736
|
+
def sign_c2pa_cloud_test(
|
|
733
737
|
api_key: str,
|
|
734
738
|
media_bytes: bytes,
|
|
735
739
|
actions: list | None = None,
|
|
@@ -765,7 +769,10 @@ def sign_c2pa_test(
|
|
|
765
769
|
signed_ingredient_policy: What to do when an ingredient's media is already
|
|
766
770
|
C2PA-signed; omit for ``auto``.
|
|
767
771
|
skip_manifest_storage: Ask Trufo not to keep a copy of the signed manifest;
|
|
768
|
-
refused with a per-embed watermark.
|
|
772
|
+
refused with a per-embed watermark. Please note that if this option is
|
|
773
|
+
elected, Trufo's ability to assist with signing-related issues, issue
|
|
774
|
+
personalized deprecation reminders, and provide content management
|
|
775
|
+
features will be limited.
|
|
769
776
|
trufo_api_url: Trufo API base URL. Defaults to the Trufo test host (test.api.trufo.ai).
|
|
770
777
|
|
|
771
778
|
Returns:
|
|
@@ -793,17 +800,17 @@ def sign_c2pa_test(
|
|
|
793
800
|
|
|
794
801
|
|
|
795
802
|
def _warn_deprecated_tsa_args(tsa_api_key: str | None, trufo_tsa_url: str | None) -> None:
|
|
796
|
-
"""Warn for each deprecated TSA argument passed to a
|
|
803
|
+
"""Warn for each deprecated TSA argument passed to a Local-mode helper."""
|
|
797
804
|
for name, value in (("tsa_api_key", tsa_api_key), ("trufo_tsa_url", trufo_tsa_url)):
|
|
798
805
|
if value is not None:
|
|
799
806
|
warnings.warn(
|
|
800
|
-
f"{name} is deprecated and ignored; Trufo
|
|
807
|
+
f"{name} is deprecated and ignored; Trufo adds the timestamp when it signs.",
|
|
801
808
|
DeprecationWarning,
|
|
802
809
|
stacklevel=3,
|
|
803
810
|
)
|
|
804
811
|
|
|
805
812
|
|
|
806
|
-
def
|
|
813
|
+
def sign_c2pa_local_test(
|
|
807
814
|
api_key: str,
|
|
808
815
|
media_bytes: bytes,
|
|
809
816
|
*,
|
|
@@ -821,7 +828,7 @@ def sign_c2pa_distributed_test(
|
|
|
821
828
|
signed_ingredient_policy: SignedIngredientPolicy | str | None = None,
|
|
822
829
|
skip_manifest_storage: bool = False,
|
|
823
830
|
) -> bytes:
|
|
824
|
-
"""Sign media
|
|
831
|
+
"""Sign media in Local mode, through the Trufo test remote-signing endpoint.
|
|
825
832
|
|
|
826
833
|
The media claim is built on the client while the C2PA claim-signing key
|
|
827
834
|
stays server-side. This helper requires the optional ``trufo[local-sign-only]``
|
|
@@ -832,8 +839,8 @@ def sign_c2pa_distributed_test(
|
|
|
832
839
|
media_bytes: Raw bytes of the media file to sign.
|
|
833
840
|
actions: Ordered list of ``[action_name, params]`` pairs (default ``[]``).
|
|
834
841
|
assertions: List of ``[assertion_name, params]`` pairs (default ``[]``).
|
|
835
|
-
tsa_api_key: Deprecated and ignored; Trufo
|
|
836
|
-
trufo_tsa_url: Deprecated and ignored; Trufo
|
|
842
|
+
tsa_api_key: Deprecated and ignored; Trufo adds the timestamp when it signs.
|
|
843
|
+
trufo_tsa_url: Deprecated and ignored; Trufo adds the timestamp when it signs.
|
|
837
844
|
trufo_api_url: Base URL for the Trufo API. Controls the preprocess,
|
|
838
845
|
claim-sign, and CAWG identity-sign endpoints. Defaults to the Trufo
|
|
839
846
|
test host (``test.api.trufo.ai``).
|
|
@@ -852,7 +859,10 @@ def sign_c2pa_distributed_test(
|
|
|
852
859
|
signed_ingredient_policy: What to do when an ingredient's media is already
|
|
853
860
|
C2PA-signed; omit for ``auto``.
|
|
854
861
|
skip_manifest_storage: Ask Trufo not to keep a copy of the signed manifest;
|
|
855
|
-
refused with a per-embed watermark.
|
|
862
|
+
refused with a per-embed watermark. Please note that if this option is
|
|
863
|
+
elected, Trufo's ability to assist with signing-related issues, issue
|
|
864
|
+
personalized deprecation reminders, and provide content management
|
|
865
|
+
features will be limited.
|
|
856
866
|
|
|
857
867
|
Returns:
|
|
858
868
|
Signed media bytes.
|
|
@@ -908,7 +918,7 @@ def sign_c2pa_distributed_test(
|
|
|
908
918
|
return signed
|
|
909
919
|
|
|
910
920
|
|
|
911
|
-
def
|
|
921
|
+
def sign_c2pa_local(
|
|
912
922
|
api_key: str,
|
|
913
923
|
media_bytes: bytes,
|
|
914
924
|
*,
|
|
@@ -926,7 +936,7 @@ def sign_c2pa_distributed(
|
|
|
926
936
|
signed_ingredient_policy: SignedIngredientPolicy | str | None = None,
|
|
927
937
|
skip_manifest_storage: bool = False,
|
|
928
938
|
) -> bytes:
|
|
929
|
-
"""Sign media
|
|
939
|
+
"""Sign media in Local mode, through the Trufo production remote-signing endpoint.
|
|
930
940
|
|
|
931
941
|
The media claim is built on the client while the C2PA claim-signing key
|
|
932
942
|
stays server-side. This helper requires the optional ``trufo[local-sign-only]``
|
|
@@ -939,8 +949,8 @@ def sign_c2pa_distributed(
|
|
|
939
949
|
media_bytes: Raw bytes of the media file to sign.
|
|
940
950
|
actions: Ordered list of ``[action_name, params]`` pairs (default ``[]``).
|
|
941
951
|
assertions: List of ``[assertion_name, params]`` pairs (default ``[]``).
|
|
942
|
-
tsa_api_key: Deprecated and ignored; Trufo
|
|
943
|
-
trufo_tsa_url: Deprecated and ignored; Trufo
|
|
952
|
+
tsa_api_key: Deprecated and ignored; Trufo adds the timestamp when it signs.
|
|
953
|
+
trufo_tsa_url: Deprecated and ignored; Trufo adds the timestamp when it signs.
|
|
944
954
|
trufo_api_url: Base URL for the Trufo API. Controls the preprocess,
|
|
945
955
|
claim-sign, and CAWG identity-sign endpoints.
|
|
946
956
|
manifest_title: Optional active-manifest title (``dc:title``); see the
|
|
@@ -957,7 +967,10 @@ def sign_c2pa_distributed(
|
|
|
957
967
|
signed_ingredient_policy: What to do when an ingredient's media is already
|
|
958
968
|
C2PA-signed; omit for ``auto``.
|
|
959
969
|
skip_manifest_storage: Ask Trufo not to keep a copy of the signed manifest;
|
|
960
|
-
refused with a per-embed watermark.
|
|
970
|
+
refused with a per-embed watermark. Please note that if this option is
|
|
971
|
+
elected, Trufo's ability to assist with signing-related issues, issue
|
|
972
|
+
personalized deprecation reminders, and provide content management
|
|
973
|
+
features will be limited.
|
|
961
974
|
|
|
962
975
|
Returns:
|
|
963
976
|
Signed media bytes.
|
|
@@ -1014,5 +1027,13 @@ def sign_c2pa_distributed(
|
|
|
1014
1027
|
|
|
1015
1028
|
|
|
1016
1029
|
__getattr__ = deprecated_aliases(
|
|
1017
|
-
globals(),
|
|
1030
|
+
globals(),
|
|
1031
|
+
{
|
|
1032
|
+
"C2PAS3SignedOutput": "SignC2PAS3Result",
|
|
1033
|
+
"C2PAS3Upload": "GetS3UploadURLResult",
|
|
1034
|
+
"sign_c2pa": "sign_c2pa_cloud",
|
|
1035
|
+
"sign_c2pa_test": "sign_c2pa_cloud_test",
|
|
1036
|
+
"sign_c2pa_distributed": "sign_c2pa_local",
|
|
1037
|
+
"sign_c2pa_distributed_test": "sign_c2pa_local_test",
|
|
1038
|
+
},
|
|
1018
1039
|
)
|
|
@@ -12,6 +12,7 @@ class UserAssertion(str, Enum):
|
|
|
12
12
|
# TODO(sunset-2027-01-31): the 'ai_disclosure' entry goes; successor UserAssertion.AI_SYSTEM
|
|
13
13
|
AI_DISCLOSURE = "ai_disclosure"
|
|
14
14
|
AI_SYSTEM = "ai_system"
|
|
15
|
+
C2PA_METADATA = "c2pa_metadata"
|
|
15
16
|
CAWG_IDENTITY = "cawg_identity"
|
|
16
17
|
CAWG_METADATA = "cawg_metadata"
|
|
17
18
|
CAWG_TRAINING = "cawg_training"
|
|
@@ -15,11 +15,11 @@ class TrufoServerWarning(UserWarning):
|
|
|
15
15
|
on these precisely::
|
|
16
16
|
|
|
17
17
|
import warnings
|
|
18
|
-
from trufo import TrufoServerWarning,
|
|
18
|
+
from trufo import TrufoServerWarning, sign_c2pa_cloud
|
|
19
19
|
|
|
20
20
|
with warnings.catch_warnings(record=True) as caught:
|
|
21
21
|
warnings.simplefilter("always", TrufoServerWarning)
|
|
22
|
-
signed =
|
|
22
|
+
signed = sign_c2pa_cloud(api_key, media_bytes, actions=actions)
|
|
23
23
|
if caught:
|
|
24
24
|
... # e.g. re-queue, alert, or record the unwatermarked output
|
|
25
25
|
"""
|
|
@@ -28,7 +28,7 @@ class TrufoServerWarning(UserWarning):
|
|
|
28
28
|
def emit_server_warnings(payload: dict) -> None:
|
|
29
29
|
"""Re-emit an API response's ``warnings`` as :class:`TrufoServerWarning`.
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Local mode emits the same server notices through ``warnings``,
|
|
32
32
|
so both signing modes surface them identically.
|
|
33
33
|
"""
|
|
34
34
|
for message in payload.get("warnings") or []:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trufo
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: Trufo SDK for content provenance API services.
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Homepage, https://trufo.ai
|
|
@@ -15,11 +15,11 @@ Requires-Dist: PyJWT>=2.6
|
|
|
15
15
|
Requires-Dist: requests>=2.28
|
|
16
16
|
Requires-Dist: uuid-utils>=0.6
|
|
17
17
|
Provides-Extra: local-sign-only
|
|
18
|
-
Requires-Dist: trufo-provenance[c2pa]<2.4.0,>=2.3.
|
|
18
|
+
Requires-Dist: trufo-provenance[c2pa]<2.4.0,>=2.3.2; extra == "local-sign-only"
|
|
19
19
|
Provides-Extra: local-full
|
|
20
|
-
Requires-Dist: trufo-provenance[c2pa,pawprint]<2.4.0,>=2.3.
|
|
20
|
+
Requires-Dist: trufo-provenance[c2pa,pawprint]<2.4.0,>=2.3.2; extra == "local-full"
|
|
21
21
|
Provides-Extra: provenance
|
|
22
|
-
Requires-Dist: trufo-provenance[c2pa]<2.4.0,>=2.3.
|
|
22
|
+
Requires-Dist: trufo-provenance[c2pa]<2.4.0,>=2.3.2; extra == "provenance"
|
|
23
23
|
Provides-Extra: test
|
|
24
24
|
Requires-Dist: pytest>=7.0; extra == "test"
|
|
25
25
|
Dynamic: license-file
|
|
@@ -47,16 +47,16 @@ trufo set-api-key c2pa-sign-test <your-api-key>
|
|
|
47
47
|
```python
|
|
48
48
|
from pathlib import Path
|
|
49
49
|
|
|
50
|
-
from trufo import
|
|
50
|
+
from trufo import sign_c2pa_cloud_test
|
|
51
51
|
from trufo.util.credentials import TrufoAPIKey, load_api_key
|
|
52
52
|
|
|
53
53
|
api_key = load_api_key(TrufoAPIKey.C2PA_SIGN_TEST)
|
|
54
54
|
|
|
55
|
-
signed_bytes =
|
|
55
|
+
signed_bytes = sign_c2pa_cloud_test(api_key, Path("input.jpg").read_bytes())
|
|
56
56
|
Path("signed.jpg").write_bytes(signed_bytes)
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
That is a complete C2PA signature — Trufo assembles and signs the manifest, so you need no certificate of your own. Swap in `
|
|
59
|
+
That is a complete C2PA signature — Trufo assembles and signs the manifest, so you need no certificate of your own. Swap in `sign_c2pa_cloud()` with a `c2pa-sign-prod` key for production-trusted output. See the [Signing Quickstart](docs/quickstart/2_c2pa_signing.md).
|
|
60
60
|
|
|
61
61
|
## What You Can Do
|
|
62
62
|
|
|
@@ -72,8 +72,8 @@ That is a complete C2PA signature — Trufo assembles and signs the manifest, so
|
|
|
72
72
|
|
|
73
73
|
In Local mode, your media stays on your machine: Trufo's engine builds the manifest locally, and Trufo receives the signing instructions and signs the claim. Two ways to run it:
|
|
74
74
|
|
|
75
|
-
- **Python SDK:** `
|
|
76
|
-
- **Docker image:** `ghcr.io/trufo-ai/trufo-local`, an HTTP service on your machine that signs files by path, for callers in any language; the full image (`2.
|
|
75
|
+
- **Python SDK:** `sign_c2pa_local()` with the `trufo[local-sign-only]` or `trufo[local-full]` extra; `local-full` adds local watermark embedding. See [Local mode with the Python SDK](docs/local/python.md).
|
|
76
|
+
- **Docker image:** `ghcr.io/trufo-ai/trufo-local`, an HTTP service on your machine that signs files by path, for callers in any language; the full image (`2.3-full`) adds watermark embedding. See [Local mode with the Docker image](docs/local/docker.md).
|
|
77
77
|
|
|
78
78
|
## Workflow Examples (Quickstart)
|
|
79
79
|
|
|
@@ -4,13 +4,13 @@ requests>=2.28
|
|
|
4
4
|
uuid-utils>=0.6
|
|
5
5
|
|
|
6
6
|
[local-full]
|
|
7
|
-
trufo-provenance[c2pa,pawprint]<2.4.0,>=2.3.
|
|
7
|
+
trufo-provenance[c2pa,pawprint]<2.4.0,>=2.3.2
|
|
8
8
|
|
|
9
9
|
[local-sign-only]
|
|
10
|
-
trufo-provenance[c2pa]<2.4.0,>=2.3.
|
|
10
|
+
trufo-provenance[c2pa]<2.4.0,>=2.3.2
|
|
11
11
|
|
|
12
12
|
[provenance]
|
|
13
|
-
trufo-provenance[c2pa]<2.4.0,>=2.3.
|
|
13
|
+
trufo-provenance[c2pa]<2.4.0,>=2.3.2
|
|
14
14
|
|
|
15
15
|
[test]
|
|
16
16
|
pytest>=7.0
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|