openwsn-berkeley / lakers

EDHOC implemented in Rust, optimized for microcontrollers, with bindings for C and Python.
https://crates.io/crates/lakers
BSD 3-Clause "New" or "Revised" License
12 stars 10 forks source link

Use owned credential type #189

Closed geonnave closed 5 months ago

geonnave commented 6 months ago

My initial goal was to get rid of IdCredOwned, and replace it with CredentialRPK, but then fields such as CredentialRPK.value would have to be Optional, spreading around runtime checks that would otherwise not be needed.

So I've decided to just keep IdCredOwned as is.

Thus, the main change in this PR is the addition of the CredentialRPK type which owns its contents and provide static access to fields such as public_key and id_cred, thus removing one potential source of panics from the protocol core.