Add VeilidRoutingContext class for WASM
This commit is contained in:
		
							
								
								
									
										2
									
								
								veilid-core/src/network_manager/wasm/.cargo/config.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								veilid-core/src/network_manager/wasm/.cargo/config.toml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| [build] | ||||
| target = "wasm32-unknown-unknown" | ||||
| @@ -2,16 +2,20 @@ use super::*; | ||||
|  | ||||
| /// DHT Record Descriptor | ||||
| #[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] | ||||
| #[cfg_attr(target_arch = "wasm32", derive(Tsify))] | ||||
| pub struct DHTRecordDescriptor { | ||||
|     /// DHT Key = Hash(ownerKeyKind) of: [ ownerKeyValue, schema ] | ||||
|     #[schemars(with = "String")] | ||||
|     #[cfg_attr(target_arch = "wasm32", tsify(type = "string"))] | ||||
|     key: TypedKey, | ||||
|     /// The public key of the owner | ||||
|     #[schemars(with = "String")] | ||||
|     #[cfg_attr(target_arch = "wasm32", tsify(type = "string"))] | ||||
|     owner: PublicKey, | ||||
|     /// If this key is being created: Some(the secret key of the owner) | ||||
|     /// If this key is just being opened: None | ||||
|     #[schemars(with = "Option<String>")] | ||||
|     #[cfg_attr(target_arch = "wasm32", tsify(type = "string | undefined"))] | ||||
|     owner_secret: Option<SecretKey>, | ||||
|     /// The schema in use associated with the key | ||||
|     schema: DHTSchema, | ||||
|   | ||||
| @@ -9,6 +9,7 @@ pub use smpl::*; | ||||
| /// Enum over all the supported DHT Schemas | ||||
| #[derive(Debug, Clone, PartialEq, Eq, Ord, PartialOrd, Serialize, Deserialize, JsonSchema)] | ||||
| #[serde(tag = "kind")] | ||||
| #[cfg_attr(target_arch = "wasm32", derive(Tsify), tsify(from_wasm_abi))] | ||||
| pub enum DHTSchema { | ||||
|     DFLT(DHTSchemaDFLT), | ||||
|     SMPL(DHTSchemaSMPL), | ||||
|   | ||||
| @@ -10,10 +10,12 @@ pub struct ValueData { | ||||
|     /// The contents of a DHT Record | ||||
|     #[serde(with = "as_human_base64")] | ||||
|     #[schemars(with = "String")] | ||||
|     #[cfg_attr(target_arch = "wasm32", tsify(type = "string"))] | ||||
|     data: Vec<u8>, | ||||
|  | ||||
|     /// The public identity key of the writer of the data | ||||
|     #[schemars(with = "String")] | ||||
|     #[cfg_attr(target_arch = "wasm32", tsify(type = "string"))] | ||||
|     writer: PublicKey, | ||||
| } | ||||
| impl ValueData { | ||||
|   | ||||
| @@ -4,6 +4,7 @@ use super::*; | ||||
| #[derive( | ||||
|     Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, JsonSchema, | ||||
| )] | ||||
| #[cfg_attr(target_arch = "wasm32", derive(Tsify), tsify(from_wasm_abi, namespace))] | ||||
| pub enum Sequencing { | ||||
|     NoPreference = 0, | ||||
|     PreferOrdered = 1, | ||||
| @@ -20,6 +21,7 @@ impl Default for Sequencing { | ||||
| #[derive( | ||||
|     Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, JsonSchema, | ||||
| )] | ||||
| #[cfg_attr(target_arch = "wasm32", derive(Tsify), tsify(from_wasm_abi, namespace))] | ||||
| pub enum Stability { | ||||
|     LowLatency = 0, | ||||
|     Reliable = 1, | ||||
| @@ -35,6 +37,7 @@ impl Default for Stability { | ||||
| #[derive( | ||||
|     Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, JsonSchema, | ||||
| )] | ||||
| #[cfg_attr(target_arch = "wasm32", derive(Tsify), tsify(from_wasm_abi, namespace))] | ||||
| pub enum SafetySelection { | ||||
|     /// Don't use a safety route, only specify the sequencing preference | ||||
|     Unsafe(Sequencing), | ||||
| @@ -61,9 +64,11 @@ impl Default for SafetySelection { | ||||
| #[derive( | ||||
|     Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, JsonSchema, | ||||
| )] | ||||
| #[cfg_attr(target_arch = "wasm32", derive(Tsify))] | ||||
| pub struct SafetySpec { | ||||
|     /// preferred safety route set id if it still exists | ||||
|     #[schemars(with = "Option<String>")] | ||||
|     #[cfg_attr(target_arch = "wasm32", tsify(type = "string | undefined"))] | ||||
|     pub preferred_route: Option<RouteId>, | ||||
|     /// must be greater than 0 | ||||
|     pub hop_count: usize, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user