jedisct1 / rust-libhydrogen

Libhydrogen bindings for Rust.
16 stars 3 forks source link

kx? #7

Closed nic-hartley closed 4 years ago

nic-hartley commented 4 years ago

Hey! I'm looking to use libhydrogen for an embedded project of mine, but it looks like KX hasn't been pushed out yet -- what's left to do? I can see it in the actual source and at a glance it seems complete, but it's not in the docs.

jedisct1 commented 4 years ago

The current Rust API for key exchange could be improved.

Instead of calling a static function for each step, supplying parameters from the previous step, each intermediate state could return its own type. This would make the API less close to the original C API, but easier and safer to use.

This is why a new version hasn't been released with the current code. It's not finished.

nic-hartley commented 4 years ago

Fair enough. Any chance you're looking for help? I wouldn't feel confident poking at the actual crypto code but I can probably write a decent wrapper :)

jedisct1 commented 4 years ago

Sure, help would be more than welcome! Especially to make this look more like idiomatic Rust!

nic-hartley commented 4 years ago

Cool, I can poke at it today! Can't make any guarantees about it, though, lol.

nic-hartley commented 4 years ago

Started poking at this and I've got an idea for a fairly clean API, but it's probably gonna take a lil while longer to actually implement it. I'll probably submit a PR early, before it's really ready, so you can comment on it.

Currently thinking of actually splitting kx into submodules, one per type of kx (so there'd be kx::n, kx::kk, kx::xx, each referencing kx::PublicKey, kx::SecretKey, etc.) to keep the names of the various "packet"/state types I'm using cleaner. Idk, it could go either way, between that and just prepending N/KK/XX to type names.

The rest of the structure is pretty bog-standard, but I'll refrain from explaining it until I've got something at least partly complete, lol