Skip to content

Commit 9e7b9cf

Browse files
committed
fix: DOcs
1 parent 8527887 commit 9e7b9cf

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/c2pa/c2pa.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def __init__(self, alg=None, sign_cert=None, private_key=None, ta_url=None):
226226
private_key: The private key as a string
227227
ta_url: The timestamp authority URL as bytes
228228
"""
229-
# Handle alg parameter - can be C2paSigningAlg enum or string
229+
# Handle alg parameter: can be C2paSigningAlg enum or string (or bytes), convert as needed
230230
if alg is not None:
231231
if isinstance(alg, C2paSigningAlg):
232232
# Convert enum to string representation
@@ -235,23 +235,23 @@ def __init__(self, alg=None, sign_cert=None, private_key=None, ta_url=None):
235235
raise ValueError(f"Unsupported signing algorithm: {alg}")
236236
alg = alg_str
237237
elif isinstance(alg, str):
238-
# Convert string to bytes
238+
# String to bytes, as requested by native lib
239239
alg = alg.encode('utf-8')
240240
elif isinstance(alg, bytes):
241-
# Already in bytes format
241+
# In bytes already
242242
pass
243243
else:
244244
raise TypeError(f"alg must be C2paSigningAlg enum, string, or bytes, got {type(alg)}")
245245
else:
246246
alg = None
247247

248-
# Handle ta_url parameter - convert string to bytes if needed
248+
# Handle ta_url parameter: convert string to bytes as needed
249249
if ta_url is not None:
250250
if isinstance(ta_url, str):
251-
# Convert string to bytes
251+
# String to bytes, as requested by native lib
252252
ta_url = ta_url.encode('utf-8')
253253
elif isinstance(ta_url, bytes):
254-
# Already in bytes format
254+
# In bytes already
255255
pass
256256
else:
257257
raise TypeError(f"ta_url must be string or bytes, got {type(ta_url)}")

tests/test_unit_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ def test_sign_file_alg_as_enum(self):
14091409
alg=SigningAlg.ES256,
14101410
sign_cert=certs,
14111411
private_key=key,
1412-
ta_url="http://timestamp.digicert.com"
1412+
ta_url=b"http://timestamp.digicert.com"
14131413
)
14141414

14151415
# Create a simple manifest

0 commit comments

Comments
 (0)