WebAssembly / wasi-crypto

WASI Cryptography API Proposal
162 stars 25 forks source link

Specific options_set behavior if already exist value. #50

Closed sonder-joker closed 2 years ago

sonder-joker commented 2 years ago

I not found defined options_set behavior if already exist value. May we should specific the behavior?

jedisct1 commented 2 years ago

Worth documenting indeed!

Overwriting the previous value seems like the most intuitive behavior. What do you think?

sonder-joker commented 2 years ago

Yes! options support reuse, so overwrite is a good choice to save resources. But also an alternative way is add a new function support try_set, it will set options if not exist or return exist_key error code if already set. Whether new functions need to be added depend on whether the situation is common. Before that, we can specify the behavior of option_set will overwrite.

jedisct1 commented 2 years ago

Alright, let's document the overwriting behavior and wait for actual try_set use cases before adding it :)

jedisct1 commented 2 years ago

Thank you!