(wasm) Treat arbitrary byte data as Uint8Array, instead of base64url marshalling.
This commit is contained in:
		@@ -198,6 +198,9 @@ wasm-bindgen = "0.2.87"
 | 
			
		||||
js-sys = "0.3.64"
 | 
			
		||||
wasm-bindgen-futures = "0.4.37"
 | 
			
		||||
send_wrapper = { version = "0.6.0", features = ["futures"] }
 | 
			
		||||
serde_bytes = { version = "0.11", default_features = false, features = [
 | 
			
		||||
    "alloc",
 | 
			
		||||
] }
 | 
			
		||||
tsify = { version = "0.4.5", features = ["js"] }
 | 
			
		||||
serde-wasm-bindgen = "0.6.0"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -215,7 +215,6 @@ impl VeilidAPIError {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[cfg_attr(target_arch = "wasm32", declare)]
 | 
			
		||||
pub type VeilidAPIResult<T> = Result<T, VeilidAPIError>;
 | 
			
		||||
 | 
			
		||||
impl From<std::io::Error> for VeilidAPIError {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,9 +9,13 @@ pub struct VeilidAppMessage {
 | 
			
		||||
    #[cfg_attr(target_arch = "wasm32", tsify(optional, type = "string"))]
 | 
			
		||||
    sender: Option<TypedKey>,
 | 
			
		||||
 | 
			
		||||
    #[serde(with = "as_human_base64")]
 | 
			
		||||
    #[cfg_attr(not(target_arch = "wasm32"), serde(with = "as_human_base64"))]
 | 
			
		||||
    #[schemars(with = "String")]
 | 
			
		||||
    #[cfg_attr(target_arch = "wasm32", tsify(type = "string"))]
 | 
			
		||||
    #[cfg_attr(
 | 
			
		||||
        target_arch = "wasm32",
 | 
			
		||||
        serde(with = "serde_bytes"),
 | 
			
		||||
        tsify(type = "Uint8Array")
 | 
			
		||||
    )]
 | 
			
		||||
    message: Vec<u8>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -40,8 +44,13 @@ pub struct VeilidAppCall {
 | 
			
		||||
    #[cfg_attr(target_arch = "wasm32", tsify(optional))]
 | 
			
		||||
    sender: Option<TypedKey>,
 | 
			
		||||
 | 
			
		||||
    #[serde(with = "as_human_base64")]
 | 
			
		||||
    #[cfg_attr(not(target_arch = "wasm32"), serde(with = "as_human_base64"))]
 | 
			
		||||
    #[schemars(with = "String")]
 | 
			
		||||
    #[cfg_attr(
 | 
			
		||||
        target_arch = "wasm32",
 | 
			
		||||
        serde(with = "serde_bytes"),
 | 
			
		||||
        tsify(type = "Uint8Array")
 | 
			
		||||
    )]
 | 
			
		||||
    message: Vec<u8>,
 | 
			
		||||
 | 
			
		||||
    #[serde(with = "as_human_string")]
 | 
			
		||||
 
 | 
			
		||||
@@ -8,9 +8,13 @@ pub struct ValueData {
 | 
			
		||||
    seq: ValueSeqNum,
 | 
			
		||||
 | 
			
		||||
    /// The contents of a DHT Record
 | 
			
		||||
    #[serde(with = "as_human_base64")]
 | 
			
		||||
    #[cfg_attr(not(target_arch = "wasm32"), serde(with = "as_human_base64"))]
 | 
			
		||||
    #[schemars(with = "String")]
 | 
			
		||||
    #[cfg_attr(target_arch = "wasm32", tsify(type = "string"))]
 | 
			
		||||
    #[cfg_attr(
 | 
			
		||||
        target_arch = "wasm32",
 | 
			
		||||
        serde(with = "serde_bytes"),
 | 
			
		||||
        tsify(type = "Uint8Array")
 | 
			
		||||
    )]
 | 
			
		||||
    data: Vec<u8>,
 | 
			
		||||
 | 
			
		||||
    /// The public identity key of the writer of the data
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,7 @@
 | 
			
		||||
use crate::*;
 | 
			
		||||
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
#[cfg_attr(target_arch = "wasm32", declare)]
 | 
			
		||||
pub type ConfigCallbackReturn = VeilidAPIResult<Box<dyn core::any::Any + Send>>;
 | 
			
		||||
#[cfg_attr(target_arch = "wasm32", declare)]
 | 
			
		||||
pub type ConfigCallback = Arc<dyn Fn(String) -> ConfigCallbackReturn + Send + Sync>;
 | 
			
		||||
 | 
			
		||||
/// Enable and configure HTTPS access to the Veilid node
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user