brycx / pasetors

PASETOrs: PASETO tokens in pure Rust
MIT License
83 stars 8 forks source link

the trait `Clone` is not implemented for `AsymmetricSecretKey<_>` #79

Closed Eh2406 closed 1 year ago

Eh2406 commented 1 year ago

Why do keys not implement clone? There are other ways to write clone for this type in the public interface like AsymmetricSecretKey::from(key.as_bytes()).expect("roundtrip"). So this mostly seems like syntactic salt. Thoughts?

brycx commented 1 year ago

AFAIK, none of the keys currently implement Clone (edit: seems AsymmetricPublicKey does). The reason is simply that there has been no need for it so far and since the types hold secret data I've just held off on adding it. We should be able to easily add it, and as you point out yourself - there's already a way to do it non-idiomatically.

Is this something you'd like to see added, @Eh2406?

brycx commented 1 year ago

I have added this as part of #81, @Eh2406. It will be part of a 0.6.5 release today (published on crates.io now).

Eh2406 commented 1 year ago

Thank you!