build fixes and cleanup

This commit is contained in:
Christien Rioux
2023-08-31 22:01:00 -04:00
committed by Brandon Vandegrift
parent 779532b624
commit 9aeec3cfa8
21 changed files with 160 additions and 186 deletions

View File

@@ -293,17 +293,17 @@ macro_rules! byte_array_type {
byte_array_type!(CryptoKey, CRYPTO_KEY_LENGTH, CRYPTO_KEY_LENGTH_ENCODED);
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type PublicKey = CryptoKey;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type SecretKey = CryptoKey;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type HashDigest = CryptoKey;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type SharedSecret = CryptoKey;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type RouteId = CryptoKey;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type CryptoKeyDistance = CryptoKey;
byte_array_type!(Signature, SIGNATURE_LENGTH, SIGNATURE_LENGTH_ENCODED);

View File

@@ -1,6 +1,7 @@
use super::*;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Tsify)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(target_arch = "wasm32", derive(Tsify))]
pub struct CryptoTyped<K>
where
K: Clone

View File

@@ -1,8 +1,7 @@
use super::*;
#[derive(
Clone, Debug, Serialize, Deserialize, PartialOrd, Ord, PartialEq, Eq, Hash, Default, Tsify,
)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialOrd, Ord, PartialEq, Eq, Hash, Default)]
#[cfg_attr(target_arch = "wasm32", derive(Tsify))]
#[serde(from = "Vec<CryptoTyped<K>>", into = "Vec<CryptoTyped<K>>")]
// TODO: figure out hot to TS type this as `string`, since it's converted to string via the JSON API.
pub struct CryptoTypedGroup<K = PublicKey>

View File

@@ -6,7 +6,7 @@ use core::fmt;
use core::hash::Hash;
/// Cryptography version fourcc code
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type CryptoKind = FourCC;
/// Sort best crypto kinds first
@@ -52,24 +52,24 @@ pub use crypto_typed::*;
pub use crypto_typed_group::*;
pub use keypair::*;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type TypedKey = CryptoTyped<PublicKey>;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type TypedSecret = CryptoTyped<SecretKey>;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type TypedKeyPair = CryptoTyped<KeyPair>;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type TypedSignature = CryptoTyped<Signature>;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type TypedSharedSecret = CryptoTyped<SharedSecret>;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type TypedKeyGroup = CryptoTypedGroup<PublicKey>;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type TypedSecretGroup = CryptoTypedGroup<SecretKey>;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type TypedKeyPairGroup = CryptoTypedGroup<KeyPair>;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type TypedSignatureGroup = CryptoTypedGroup<Signature>;
#[declare]
#[cfg_attr(target_arch = "wasm32", declare)]
pub type TypedSharedSecretGroup = CryptoTypedGroup<SharedSecret>;