Conversation
| /// A public key used for verifying signatures in Tashi Vertex. | ||
| #[derive(Clone, Copy)] | ||
| #[derive(Clone, Copy, PartialEq, Eq)] | ||
| #[repr(C)] |
There was a problem hiding this comment.
This should absolutely not happen here. It's not a well-defined equality. You need to export a tv_key_public_eq function from tashi-vertex (the closed source core) and tashi-vertex-c and then use that here in a custom impl of PartialEq and Eq
| } | ||
| } | ||
|
|
||
| impl Serialize for KeyPublic { |
There was a problem hiding this comment.
These should be scoped behind a #[cfg(feature = "serde")] block
| const KEY_SECRET_DER_BASE58_LENGTH: usize = base58::encode_length(KEY_SECRET_DER_LENGTH); | ||
|
|
||
| /// A secret key used for signing transactions in Tashi Vertex. | ||
| #[derive(Clone)] |
There was a problem hiding this comment.
Secret keys should not be clone-able for security reasons. You should never need to clone this. Nothing on it requires mutable access so just stick it inside an Arc<KeySecret>.
|
|
||
| impl KeySecret { | ||
| /// Returns the raw bytes of the secret key. | ||
| pub fn as_bytes(&self) -> &[u8; 32] { |
There was a problem hiding this comment.
Why do you need the bytes here? Additionally this is not well-defined as the key material is a raw blitted struct. You would need to expose a tv_key_secret_to_bytes type function.
| } | ||
| } | ||
|
|
||
| impl Serialize for KeySecret { |
There was a problem hiding this comment.
Likewise here on #[cfg(feature = "serde")]
| @@ -1 +1,2 @@ | |||
| /target | |||
| run.md | |||
| edition = "2024" | ||
|
|
||
| [dependencies] | ||
| der = { version = "0.7.9", features = ["derive", "std"] } |
|
|
||
| [dependencies] | ||
| der = { version = "0.7.9", features = ["derive", "std"] } | ||
| serde = { version = "1.0", features = ["derive"] } |
There was a problem hiding this comment.
serde should be behind a feature
| DESTINATION lib | ||
| ) | ||
| if(WIN32) | ||
| install(FILES ${TASHI_VERTEX_LIB_FILE} "${TASHI_VERTEX_LIB_DIR}/tashi-vertex.lib" |
There was a problem hiding this comment.
What are you doing here? There is no tashi-vertex.lib file that I can see? Is this tested?
Updated tashi-vertex-rs for easier async integration: