rust-hpke icon indicating copy to clipboard operation
rust-hpke copied to clipboard

Can PublicKey/PrivateKey be exposed?

Open elichai opened this issue 7 months ago • 2 comments

It's pretty cumbersome to use <X25519HkdfSha256 as Kem>::PublicKey, and the rust-analyzer Isn't able to autocomplete methods on a type declared type X25519PublicKey = <X25519HkdfSha256 as Kem>::PublicKey;

It will be much easier to work with the library if the underlying types themselves were exported and not so opaque

elichai avatar May 21 '25 16:05 elichai

You're not the first person to mention this issue. This seems possibly doable, but frankly I don't have a ton of time to work on usability fixes for this crate. I'd be happy to review a PR though if you already have an idea of how this would be implemented!

rozbb avatar Jun 03 '25 04:06 rozbb

@rozbb I understand :) There's a few ways to do that, the simple ones:

  1. Keep the abstraction that hides the backend, but expose the abstracting types (ideally also extend their API)
  2. Use the backend types directly, no abstraction in the middle, users can use the same type then in other libraries.

elichai avatar Jun 03 '25 08:06 elichai