feat: added bincode serialization for the EncryptedMessage type#8
feat: added bincode serialization for the EncryptedMessage type#8muse254 wants to merge 11 commits into
EncryptedMessage type#8Conversation
- Implement WASM-compatible encryption and decryption functions - Update dependencies and feature flags for WASM compatibility - Ensure core cryptographic operations work in WASM environments
…er, and NTorCertificate to reduce confusion
dtpthao
left a comment
There was a problem hiding this comment.
nice refactor for my amateur rust code, thank you
| ) | ||
| } | ||
|
|
||
| fn wasm_encrypt(&self, data: &[u8]) -> Result<([u8; 12], Vec<u8>), &'static str> { |
There was a problem hiding this comment.
I remember struggling to make [u8; 32] work in WASM, which is why I originally used Vec. I tested your updates in the interceptor and they compiled successfully, I’m not sure why it didn’t work before.
Since [u8; 32] is now accepted, have you tried removing the wasm_encryption function, exporting EncryptedMessage to WASM, and calling the encrypt function instead?
There was a problem hiding this comment.
Yes, still prepping the layer8-backbone PR. Should be out sometime today
There was a problem hiding this comment.
ahh, have you try to remove wasm_encrypt/decrypt function?
dtpthao
left a comment
There was a problem hiding this comment.
I withdraw my approval, please keep this PR open, I'll review it again
| } | ||
| } | ||
|
|
||
| pub fn public_key(&self) -> &[u8; 32] { |
There was a problem hiding this comment.
I just remembered why I used Vec here. We’re using a single cryptography algorithm right now, but that may change later, and different algorithms may use public keys of different sizes. In that case, we need to update every usage of [u8;32]. How is [u8; 32] better in this context?
There was a problem hiding this comment.
Can we version bump when that happens, I'm assuming we will support multiple encryption schemes and not just replace the ntor?
|
Will setup a diff clean PR |
This PR is based on v0.1.1 tag
The changes include:
EncryptedMessagetypeCargo.tomltov0.1.2dry_run_test