Skip to content

Conversation

@tmathern
Copy link
Collaborator

@tmathern tmathern commented Aug 4, 2025

Currently, in the C2paSignerInfo class, we expected the algorithm string as bytes.

As reported in #135, I believe it makes sense to allow to use the enum and that we parse it accordingly into the value needed by the native call (@gpeacock At some point we should harmonize that API - so that we take the same types everywhere, wdyt?).

This PR adds support for that, and also makes sure the timestamp URL gets properly converted into bytes since natively we expect bytes too (and not just a string).

@tmathern tmathern requested review from dyro and gpeacock August 4, 2025 17:48
@tmathern tmathern self-assigned this Aug 4, 2025
src/c2pa/c2pa.py Outdated
("ta_url", ctypes.c_char_p),
]

def __init__(self, alg=None, sign_cert=None, private_key=None, ta_url=None):
Copy link
Collaborator Author

@tmathern tmathern Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of syntactic sugar to make enums reusable and less dependent on underlying (native) types. Also lots of type checkings checks when converting.

@tmathern
Copy link
Collaborator Author

tmathern commented Aug 13, 2025

Failing tests will be fixed once fix from contentauth/c2pa-rs#1273 comes in (done).

@tmathern tmathern merged commit fa5aa60 into main Aug 21, 2025
19 checks passed
@tmathern tmathern deleted the mathern/issue-135-alg-issue branch August 21, 2025 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants