c2pa-rs icon indicating copy to clipboard operation
c2pa-rs copied to clipboard

Converge Signer and AsyncSinger in to a single trait

Open duggaraju opened this issue 1 year ago • 4 comments

AsyncSigner can be used everywhere and avoid two different sets of APIs?

duggaraju avatar Dec 20 '23 19:12 duggaraju

Right now I can call manifest.save_from_memory() to sign from web assembly. However it takes Signer trait. But since implementation in javascript (remote or webcrypto) return promises it would be hard to implement the same. If we had a similar function that takes AsyncSigner then it can be fully implemented in web assembly. In general to avoid confusion and duplication, might be better to converge on a single AsyncSigner trait everywhere.

duggaraju avatar Dec 20 '23 20:12 duggaraju

We have clients that cannot use async. Two APIs will likely remain for the foreseeable future.

mauricefisher64 avatar Jan 03 '24 17:01 mauricefisher64

Oh. I see. If so can we use the async_generic trait so there is both async and sync support for functions like Manifest.embed_from_memory() and Manifest::embed_to_stream and the corresponding store functions. Right now, the macro is used inconsistently.

duggaraju avatar Jan 12 '24 03:01 duggaraju

Yes, we are working on consolidating that code so there is as little code duplication as possible.

gpeacock avatar Feb 05 '24 22:02 gpeacock