Refer to the CHANGELOG for detailed changes derived from Git commit history.
The current release has a new API that replaces the previous methods of reading and writing C2PA data, which are still supported but will be deprecated. The new API is now the default. Previously, you had to use the unstable_api
feature to use it; but this feature is no longer used.
The new API focuses on streaming I/O and supports the following structs:
Reader
has some new methods:
validation_state()
returnsValidationState
, which can beInvalid
,Valid
orTrusted
. Use this method instead of checking forvalidation_status() = None
.validation_results()
returnsValidationResults
, which is a more complete form ofValidationStatus
and returnssuccess
,informational
, andfailure
codes for the active manifest and ingredients.ValidationStatus
is deprecated in favor ofValidationResults
.
Ingredient
now supports a validation_results()
method and a validation_results
field.
An AssetType
assertion is now supported.
NOTE: The library now supports C2PA v2 claims, however development is still in progress and all features are not fully implemented yet. While you can experiment with this functionality, it is not recommended for production use at this time.
To generate v2 claims, set the Builder
manifest definition claim_version
field to 2
.
The title()
and format()
methods of both Manifest
and Ingredient
objects now return an Option<String>
because in v2 claims, title
is optional and format
does not exist.
In v2 claims, the first action
must be c2pa.created
or c2pa.opened
.
V2 claims have many new checks and status codes.
To use the old deprecated API, enable the v1_api
feature; for example:
c2pa = {version="0.45.2", features=["v1_api"]}
Module | Method | C++ | Python | WASM | Node |
---|---|---|---|---|---|
Builder | |||||
new | |||||
from_json | X | X | X | ||
set_claim_generator_info | |||||
set_format | |||||
set_remote_url | X | ||||
set_no_embed | X | ||||
set_thumbnail | |||||
add_assertion | |||||
add_assertion_json | |||||
add_ingredient_from_stream | X | X | |||
add_ingredient_from_stream_async | |||||
add_ingredient | |||||
add_resource | X | X | |||
to_archive | X | X | |||
from_archive | X | X | |||
data_hashed_placeholder | |||||
sign_data_hashed_embeddable | |||||
sign_data_hashed_embeddable_async | |||||
sign_box_hashed_embeddable | |||||
sign_box_hashed_embeddable_async | |||||
sign | X | X | |||
sign_async | |||||
sign_fragmented_files | |||||
sign_file | X | X | |||
Reader | |||||
from_stream | X | ||||
from_stream_async | |||||
from_file | X | ||||
from_file_async | |||||
from_json | |||||
from_manifest_data_and_stream | X | ||||
from_manifest_data_and_stream_async | |||||
from_fragment | |||||
from_fragment_async | |||||
from_fragmented_files | |||||
json | |||||
validation_status | |||||
active_manifest | X | ||||
active_label | |||||
iter_manifests | |||||
get_manifest | X | ||||
resource_to_stream | X | X | |||
to_folder | |||||
CallbackSigner | |||||
new | |||||
set_tsa_url | |||||
set_context | |||||
ed25519_sign |