fixes for privacy issues, closes #357

This commit is contained in:
Christien Rioux 2024-03-08 00:17:38 -05:00
parent ab419f03ef
commit 946d33ced6
15 changed files with 261 additions and 96 deletions

View File

@ -106,6 +106,7 @@ impl RPCOperation {
.validate(validate_context.crypto.clone()) .validate(validate_context.crypto.clone())
.map_err(RPCError::protocol)?; .map_err(RPCError::protocol)?;
} }
// Validate operation kind // Validate operation kind
self.kind.validate(validate_context) self.kind.validate(validate_context)
} }

View File

@ -615,6 +615,20 @@ impl RPCProcessor {
// Reply received // Reply received
let recv_ts = get_aligned_timestamp(); let recv_ts = get_aligned_timestamp();
// Ensure the reply comes over the private route that was requested
if let Some(reply_private_route) = waitable_reply.reply_private_route {
match &rpcreader.header.detail {
RPCMessageHeaderDetail::Direct(_) | RPCMessageHeaderDetail::SafetyRouted(_) => {
return Err(RPCError::protocol("should have received reply over private route"));
}
RPCMessageHeaderDetail::PrivateRouted(pr) => {
if pr.private_route != reply_private_route {
return Err(RPCError::protocol("received reply over the wrong private route"));
}
}
};
}
// Record answer received // Record answer received
self.record_answer_received( self.record_answer_received(
waitable_reply.send_ts, waitable_reply.send_ts,

View File

@ -73,6 +73,24 @@ impl RPCProcessor {
)); ));
} }
// Get the private route this came over
let opt_pr_pubkey = match &msg.header.detail {
RPCMessageHeaderDetail::Direct(_) | RPCMessageHeaderDetail::SafetyRouted(_) => None,
RPCMessageHeaderDetail::PrivateRouted(pr) => Some(pr.private_route),
};
let route_id = if let Some(pr_pubkey) = opt_pr_pubkey {
let rss = routing_table.route_spec_store();
let Some(route_id) = rss.get_route_id_for_key(&pr_pubkey) else {
return Ok(NetworkResult::invalid_message(format!(
"private route does not exist for key: {}",
pr_pubkey
)));
};
Some(route_id)
} else {
None
};
// Get the question // Get the question
let (op_id, _, _, kind) = msg.operation.clone().destructure(); let (op_id, _, _, kind) = msg.operation.clone().destructure();
let app_call_q = match kind { let app_call_q = match kind {
@ -101,7 +119,7 @@ impl RPCProcessor {
// Pass the call up through the update callback // Pass the call up through the update callback
let message_q = app_call_q.destructure(); let message_q = app_call_q.destructure();
(self.unlocked_inner.update_callback)(VeilidUpdate::AppCall(Box::new(VeilidAppCall::new( (self.unlocked_inner.update_callback)(VeilidUpdate::AppCall(Box::new(VeilidAppCall::new(
sender, message_q, op_id, sender, route_id, message_q, op_id,
)))); ))));
// Wait for an app call answer to come back from the app // Wait for an app call answer to come back from the app

View File

@ -36,6 +36,24 @@ impl RPCProcessor {
)); ));
} }
// Get the private route this came over
let opt_pr_pubkey = match &msg.header.detail {
RPCMessageHeaderDetail::Direct(_) | RPCMessageHeaderDetail::SafetyRouted(_) => None,
RPCMessageHeaderDetail::PrivateRouted(pr) => Some(pr.private_route),
};
let route_id = if let Some(pr_pubkey) = opt_pr_pubkey {
let rss = routing_table.route_spec_store();
let Some(route_id) = rss.get_route_id_for_key(&pr_pubkey) else {
return Ok(NetworkResult::invalid_message(format!(
"private route does not exist for key: {}",
pr_pubkey
)));
};
Some(route_id)
} else {
None
};
// Get the statement // Get the statement
let (_, _, _, kind) = msg.operation.destructure(); let (_, _, _, kind) = msg.operation.destructure();
let app_message = match kind { let app_message = match kind {
@ -58,7 +76,7 @@ impl RPCProcessor {
// Pass the message up through the update callback // Pass the message up through the update callback
let message = app_message.destructure(); let message = app_message.destructure();
(self.unlocked_inner.update_callback)(VeilidUpdate::AppMessage(Box::new( (self.unlocked_inner.update_callback)(VeilidUpdate::AppMessage(Box::new(
VeilidAppMessage::new(sender, message), VeilidAppMessage::new(sender, route_id, message),
))); )));
Ok(NetworkResult::value(())) Ok(NetworkResult::value(()))

View File

@ -13,7 +13,11 @@ pub async fn test_alignedu64() {
// app_messsage_call // app_messsage_call
pub async fn test_veilidappmessage() { pub async fn test_veilidappmessage() {
let orig = VeilidAppMessage::new(Some(fix_typedkey()), b"Hi there!".to_vec()); let orig = VeilidAppMessage::new(
Some(fix_typedkey()),
Some(fix_cryptokey()),
b"Hi there!".to_vec(),
);
let copy = deserialize_json(&serialize_json(&orig)).unwrap(); let copy = deserialize_json(&serialize_json(&orig)).unwrap();
assert_eq!(orig, copy); assert_eq!(orig, copy);
@ -22,6 +26,7 @@ pub async fn test_veilidappmessage() {
pub async fn test_veilidappcall() { pub async fn test_veilidappcall() {
let orig = VeilidAppCall::new( let orig = VeilidAppCall::new(
Some(fix_typedkey()), Some(fix_typedkey()),
Some(fix_cryptokey()),
b"Well, hello!".to_vec(), b"Well, hello!".to_vec(),
AlignedU64::from(123), AlignedU64::from(123),
); );

View File

@ -9,6 +9,11 @@ pub struct VeilidAppMessage {
#[cfg_attr(target_arch = "wasm32", tsify(optional, type = "string"))] #[cfg_attr(target_arch = "wasm32", tsify(optional, type = "string"))]
sender: Option<TypedKey>, sender: Option<TypedKey>,
#[serde(with = "as_human_opt_string")]
#[schemars(with = "Option<String>")]
#[cfg_attr(target_arch = "wasm32", tsify(optional, type = "string"))]
route_id: Option<RouteId>,
#[cfg_attr(not(target_arch = "wasm32"), serde(with = "as_human_base64"))] #[cfg_attr(not(target_arch = "wasm32"), serde(with = "as_human_base64"))]
#[schemars(with = "String")] #[schemars(with = "String")]
#[cfg_attr( #[cfg_attr(
@ -20,8 +25,12 @@ pub struct VeilidAppMessage {
} }
impl VeilidAppMessage { impl VeilidAppMessage {
pub fn new(sender: Option<TypedKey>, message: Vec<u8>) -> Self { pub fn new(sender: Option<TypedKey>, route_id: Option<RouteId>, message: Vec<u8>) -> Self {
Self { sender, message } Self {
sender,
route_id,
message,
}
} }
/// Some(sender) if the message was sent directly, None if received via a private/safety route /// Some(sender) if the message was sent directly, None if received via a private/safety route
@ -29,6 +38,11 @@ impl VeilidAppMessage {
self.sender.as_ref() self.sender.as_ref()
} }
/// Some(route_id) if the message was received over a private route, None if received only a safety route or directly
pub fn route_id(&self) -> Option<&RouteId> {
self.route_id.as_ref()
}
/// The content of the message to deliver to the application /// The content of the message to deliver to the application
pub fn message(&self) -> &[u8] { pub fn message(&self) -> &[u8] {
&self.message &self.message
@ -44,6 +58,11 @@ pub struct VeilidAppCall {
#[cfg_attr(target_arch = "wasm32", tsify(optional))] #[cfg_attr(target_arch = "wasm32", tsify(optional))]
sender: Option<TypedKey>, sender: Option<TypedKey>,
#[serde(with = "as_human_opt_string")]
#[schemars(with = "Option<String>")]
#[cfg_attr(target_arch = "wasm32", tsify(optional, type = "string"))]
route_id: Option<RouteId>,
#[cfg_attr(not(target_arch = "wasm32"), serde(with = "as_human_base64"))] #[cfg_attr(not(target_arch = "wasm32"), serde(with = "as_human_base64"))]
#[schemars(with = "String")] #[schemars(with = "String")]
#[cfg_attr( #[cfg_attr(
@ -59,9 +78,15 @@ pub struct VeilidAppCall {
} }
impl VeilidAppCall { impl VeilidAppCall {
pub fn new(sender: Option<TypedKey>, message: Vec<u8>, call_id: OperationId) -> Self { pub fn new(
sender: Option<TypedKey>,
route_id: Option<RouteId>,
message: Vec<u8>,
call_id: OperationId,
) -> Self {
Self { Self {
sender, sender,
route_id,
message, message,
call_id, call_id,
} }
@ -71,6 +96,12 @@ impl VeilidAppCall {
pub fn sender(&self) -> Option<&TypedKey> { pub fn sender(&self) -> Option<&TypedKey> {
self.sender.as_ref() self.sender.as_ref()
} }
/// Some(route_id) if the request was received over a private route, None if received only a safety route or directly
pub fn route_id(&self) -> Option<&RouteId> {
self.route_id.as_ref()
}
/// The content of the request to deliver to the application /// The content of the request to deliver to the application
pub fn message(&self) -> &[u8] { pub fn message(&self) -> &[u8] {
&self.message &self.message

View File

@ -150,7 +150,7 @@ abstract class Veilid {
Future<RouteBlob> newCustomPrivateRoute( Future<RouteBlob> newCustomPrivateRoute(
Stability stability, Sequencing sequencing); Stability stability, Sequencing sequencing);
Future<String> importRemotePrivateRoute(Uint8List blob); Future<String> importRemotePrivateRoute(Uint8List blob);
Future<void> releasePrivateRoute(String key); Future<void> releasePrivateRoute(String routeId);
// App calls // App calls
Future<void> appCallReply(String callId, Uint8List message); Future<void> appCallReply(String callId, Uint8List message);

View File

@ -1613,12 +1613,12 @@ class VeilidFFI extends Veilid {
} }
@override @override
Future<void> releasePrivateRoute(String key) async { Future<void> releasePrivateRoute(String routeId) async {
final nativeEncodedKey = key.toNativeUtf8(); final nativeEncodedRouteId = routeId.toNativeUtf8();
final recvPort = ReceivePort('release_private_route'); final recvPort = ReceivePort('release_private_route');
final sendPort = recvPort.sendPort; final sendPort = recvPort.sendPort;
_releasePrivateRoute(sendPort.nativePort, nativeEncodedKey); _releasePrivateRoute(sendPort.nativePort, nativeEncodedRouteId);
return processFutureVoid(recvPort.first); return processFutureVoid(recvPort.first);
} }

View File

@ -672,8 +672,8 @@ class VeilidJS extends Veilid {
} }
@override @override
Future<void> releasePrivateRoute(String key) => Future<void> releasePrivateRoute(String routeId) => _wrapApiPromise(
_wrapApiPromise(js_util.callMethod(wasm, 'release_private_route', [key])); js_util.callMethod(wasm, 'release_private_route', [routeId]));
@override @override
Future<void> appCallReply(String callId, Uint8List message) { Future<void> appCallReply(String callId, Uint8List message) {

View File

@ -146,11 +146,13 @@ sealed class VeilidUpdate with _$VeilidUpdate {
const factory VeilidUpdate.appMessage({ const factory VeilidUpdate.appMessage({
@Uint8ListJsonConverter() required Uint8List message, @Uint8ListJsonConverter() required Uint8List message,
TypedKey? sender, TypedKey? sender,
String? routeId,
}) = VeilidAppMessage; }) = VeilidAppMessage;
const factory VeilidUpdate.appCall({ const factory VeilidUpdate.appCall({
@Uint8ListJsonConverter() required Uint8List message, @Uint8ListJsonConverter() required Uint8List message,
required String callId, required String callId,
TypedKey? sender, TypedKey? sender,
String? routeId,
}) = VeilidAppCall; }) = VeilidAppCall;
const factory VeilidUpdate.attachment( const factory VeilidUpdate.attachment(
{required AttachmentState state, {required AttachmentState state,

View File

@ -1339,10 +1339,10 @@ mixin _$VeilidUpdate {
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender) Typed<FixedEncodedString43>? sender, String? routeId)
appMessage, appMessage,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
String callId, Typed<FixedEncodedString43>? sender) String callId, Typed<FixedEncodedString43>? sender, String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -1365,10 +1365,13 @@ mixin _$VeilidUpdate {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(
String callId, Typed<FixedEncodedString43>? sender)? @Uint8ListJsonConverter() Uint8List message,
String callId,
Typed<FixedEncodedString43>? sender,
String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -1390,10 +1393,10 @@ mixin _$VeilidUpdate {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(@Uint8ListJsonConverter() Uint8List message, TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -1566,10 +1569,10 @@ class _$VeilidLogImpl implements VeilidLog {
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender) Typed<FixedEncodedString43>? sender, String? routeId)
appMessage, appMessage,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
String callId, Typed<FixedEncodedString43>? sender) String callId, Typed<FixedEncodedString43>? sender, String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -1595,10 +1598,13 @@ class _$VeilidLogImpl implements VeilidLog {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(
String callId, Typed<FixedEncodedString43>? sender)? @Uint8ListJsonConverter() Uint8List message,
String callId,
Typed<FixedEncodedString43>? sender,
String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -1623,10 +1629,10 @@ class _$VeilidLogImpl implements VeilidLog {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(@Uint8ListJsonConverter() Uint8List message, TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -1730,7 +1736,8 @@ abstract class _$$VeilidAppMessageImplCopyWith<$Res> {
@useResult @useResult
$Res call( $Res call(
{@Uint8ListJsonConverter() Uint8List message, {@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender}); Typed<FixedEncodedString43>? sender,
String? routeId});
} }
/// @nodoc /// @nodoc
@ -1746,6 +1753,7 @@ class __$$VeilidAppMessageImplCopyWithImpl<$Res>
$Res call({ $Res call({
Object? message = null, Object? message = null,
Object? sender = freezed, Object? sender = freezed,
Object? routeId = freezed,
}) { }) {
return _then(_$VeilidAppMessageImpl( return _then(_$VeilidAppMessageImpl(
message: null == message message: null == message
@ -1756,6 +1764,10 @@ class __$$VeilidAppMessageImplCopyWithImpl<$Res>
? _value.sender ? _value.sender
: sender // ignore: cast_nullable_to_non_nullable : sender // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>?, as Typed<FixedEncodedString43>?,
routeId: freezed == routeId
? _value.routeId
: routeId // ignore: cast_nullable_to_non_nullable
as String?,
)); ));
} }
} }
@ -1766,6 +1778,7 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
const _$VeilidAppMessageImpl( const _$VeilidAppMessageImpl(
{@Uint8ListJsonConverter() required this.message, {@Uint8ListJsonConverter() required this.message,
this.sender, this.sender,
this.routeId,
final String? $type}) final String? $type})
: $type = $type ?? 'AppMessage'; : $type = $type ?? 'AppMessage';
@ -1777,13 +1790,15 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
final Uint8List message; final Uint8List message;
@override @override
final Typed<FixedEncodedString43>? sender; final Typed<FixedEncodedString43>? sender;
@override
final String? routeId;
@JsonKey(name: 'kind') @JsonKey(name: 'kind')
final String $type; final String $type;
@override @override
String toString() { String toString() {
return 'VeilidUpdate.appMessage(message: $message, sender: $sender)'; return 'VeilidUpdate.appMessage(message: $message, sender: $sender, routeId: $routeId)';
} }
@override @override
@ -1792,13 +1807,14 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$VeilidAppMessageImpl && other is _$VeilidAppMessageImpl &&
const DeepCollectionEquality().equals(other.message, message) && const DeepCollectionEquality().equals(other.message, message) &&
(identical(other.sender, sender) || other.sender == sender)); (identical(other.sender, sender) || other.sender == sender) &&
(identical(other.routeId, routeId) || other.routeId == routeId));
} }
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
int get hashCode => Object.hash( int get hashCode => Object.hash(runtimeType,
runtimeType, const DeepCollectionEquality().hash(message), sender); const DeepCollectionEquality().hash(message), sender, routeId);
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@ -1814,10 +1830,10 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender) Typed<FixedEncodedString43>? sender, String? routeId)
appMessage, appMessage,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
String callId, Typed<FixedEncodedString43>? sender) String callId, Typed<FixedEncodedString43>? sender, String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -1833,7 +1849,7 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
List<ValueSubkeyRange> subkeys, int count, ValueData value) List<ValueSubkeyRange> subkeys, int count, ValueData value)
valueChange, valueChange,
}) { }) {
return appMessage(message, sender); return appMessage(message, sender, routeId);
} }
@override @override
@ -1843,10 +1859,13 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(
String callId, Typed<FixedEncodedString43>? sender)? @Uint8ListJsonConverter() Uint8List message,
String callId,
Typed<FixedEncodedString43>? sender,
String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -1861,7 +1880,7 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
List<ValueSubkeyRange> subkeys, int count, ValueData value)? List<ValueSubkeyRange> subkeys, int count, ValueData value)?
valueChange, valueChange,
}) { }) {
return appMessage?.call(message, sender); return appMessage?.call(message, sender, routeId);
} }
@override @override
@ -1871,10 +1890,10 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(@Uint8ListJsonConverter() Uint8List message, TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -1891,7 +1910,7 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
required TResult orElse(), required TResult orElse(),
}) { }) {
if (appMessage != null) { if (appMessage != null) {
return appMessage(message, sender); return appMessage(message, sender, routeId);
} }
return orElse(); return orElse();
} }
@ -1956,7 +1975,8 @@ class _$VeilidAppMessageImpl implements VeilidAppMessage {
abstract class VeilidAppMessage implements VeilidUpdate { abstract class VeilidAppMessage implements VeilidUpdate {
const factory VeilidAppMessage( const factory VeilidAppMessage(
{@Uint8ListJsonConverter() required final Uint8List message, {@Uint8ListJsonConverter() required final Uint8List message,
final Typed<FixedEncodedString43>? sender}) = _$VeilidAppMessageImpl; final Typed<FixedEncodedString43>? sender,
final String? routeId}) = _$VeilidAppMessageImpl;
factory VeilidAppMessage.fromJson(Map<String, dynamic> json) = factory VeilidAppMessage.fromJson(Map<String, dynamic> json) =
_$VeilidAppMessageImpl.fromJson; _$VeilidAppMessageImpl.fromJson;
@ -1964,6 +1984,7 @@ abstract class VeilidAppMessage implements VeilidUpdate {
@Uint8ListJsonConverter() @Uint8ListJsonConverter()
Uint8List get message; Uint8List get message;
Typed<FixedEncodedString43>? get sender; Typed<FixedEncodedString43>? get sender;
String? get routeId;
@JsonKey(ignore: true) @JsonKey(ignore: true)
_$$VeilidAppMessageImplCopyWith<_$VeilidAppMessageImpl> get copyWith => _$$VeilidAppMessageImplCopyWith<_$VeilidAppMessageImpl> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@ -1978,7 +1999,8 @@ abstract class _$$VeilidAppCallImplCopyWith<$Res> {
$Res call( $Res call(
{@Uint8ListJsonConverter() Uint8List message, {@Uint8ListJsonConverter() Uint8List message,
String callId, String callId,
Typed<FixedEncodedString43>? sender}); Typed<FixedEncodedString43>? sender,
String? routeId});
} }
/// @nodoc /// @nodoc
@ -1995,6 +2017,7 @@ class __$$VeilidAppCallImplCopyWithImpl<$Res>
Object? message = null, Object? message = null,
Object? callId = null, Object? callId = null,
Object? sender = freezed, Object? sender = freezed,
Object? routeId = freezed,
}) { }) {
return _then(_$VeilidAppCallImpl( return _then(_$VeilidAppCallImpl(
message: null == message message: null == message
@ -2009,6 +2032,10 @@ class __$$VeilidAppCallImplCopyWithImpl<$Res>
? _value.sender ? _value.sender
: sender // ignore: cast_nullable_to_non_nullable : sender // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>?, as Typed<FixedEncodedString43>?,
routeId: freezed == routeId
? _value.routeId
: routeId // ignore: cast_nullable_to_non_nullable
as String?,
)); ));
} }
} }
@ -2020,6 +2047,7 @@ class _$VeilidAppCallImpl implements VeilidAppCall {
{@Uint8ListJsonConverter() required this.message, {@Uint8ListJsonConverter() required this.message,
required this.callId, required this.callId,
this.sender, this.sender,
this.routeId,
final String? $type}) final String? $type})
: $type = $type ?? 'AppCall'; : $type = $type ?? 'AppCall';
@ -2033,13 +2061,15 @@ class _$VeilidAppCallImpl implements VeilidAppCall {
final String callId; final String callId;
@override @override
final Typed<FixedEncodedString43>? sender; final Typed<FixedEncodedString43>? sender;
@override
final String? routeId;
@JsonKey(name: 'kind') @JsonKey(name: 'kind')
final String $type; final String $type;
@override @override
String toString() { String toString() {
return 'VeilidUpdate.appCall(message: $message, callId: $callId, sender: $sender)'; return 'VeilidUpdate.appCall(message: $message, callId: $callId, sender: $sender, routeId: $routeId)';
} }
@override @override
@ -2049,13 +2079,14 @@ class _$VeilidAppCallImpl implements VeilidAppCall {
other is _$VeilidAppCallImpl && other is _$VeilidAppCallImpl &&
const DeepCollectionEquality().equals(other.message, message) && const DeepCollectionEquality().equals(other.message, message) &&
(identical(other.callId, callId) || other.callId == callId) && (identical(other.callId, callId) || other.callId == callId) &&
(identical(other.sender, sender) || other.sender == sender)); (identical(other.sender, sender) || other.sender == sender) &&
(identical(other.routeId, routeId) || other.routeId == routeId));
} }
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
int get hashCode => Object.hash(runtimeType, int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(message), callId, sender); const DeepCollectionEquality().hash(message), callId, sender, routeId);
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@ -2070,10 +2101,10 @@ class _$VeilidAppCallImpl implements VeilidAppCall {
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender) Typed<FixedEncodedString43>? sender, String? routeId)
appMessage, appMessage,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
String callId, Typed<FixedEncodedString43>? sender) String callId, Typed<FixedEncodedString43>? sender, String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -2089,7 +2120,7 @@ class _$VeilidAppCallImpl implements VeilidAppCall {
List<ValueSubkeyRange> subkeys, int count, ValueData value) List<ValueSubkeyRange> subkeys, int count, ValueData value)
valueChange, valueChange,
}) { }) {
return appCall(message, callId, sender); return appCall(message, callId, sender, routeId);
} }
@override @override
@ -2099,10 +2130,13 @@ class _$VeilidAppCallImpl implements VeilidAppCall {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(
String callId, Typed<FixedEncodedString43>? sender)? @Uint8ListJsonConverter() Uint8List message,
String callId,
Typed<FixedEncodedString43>? sender,
String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2117,7 +2151,7 @@ class _$VeilidAppCallImpl implements VeilidAppCall {
List<ValueSubkeyRange> subkeys, int count, ValueData value)? List<ValueSubkeyRange> subkeys, int count, ValueData value)?
valueChange, valueChange,
}) { }) {
return appCall?.call(message, callId, sender); return appCall?.call(message, callId, sender, routeId);
} }
@override @override
@ -2127,10 +2161,10 @@ class _$VeilidAppCallImpl implements VeilidAppCall {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(@Uint8ListJsonConverter() Uint8List message, TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2147,7 +2181,7 @@ class _$VeilidAppCallImpl implements VeilidAppCall {
required TResult orElse(), required TResult orElse(),
}) { }) {
if (appCall != null) { if (appCall != null) {
return appCall(message, callId, sender); return appCall(message, callId, sender, routeId);
} }
return orElse(); return orElse();
} }
@ -2213,7 +2247,8 @@ abstract class VeilidAppCall implements VeilidUpdate {
const factory VeilidAppCall( const factory VeilidAppCall(
{@Uint8ListJsonConverter() required final Uint8List message, {@Uint8ListJsonConverter() required final Uint8List message,
required final String callId, required final String callId,
final Typed<FixedEncodedString43>? sender}) = _$VeilidAppCallImpl; final Typed<FixedEncodedString43>? sender,
final String? routeId}) = _$VeilidAppCallImpl;
factory VeilidAppCall.fromJson(Map<String, dynamic> json) = factory VeilidAppCall.fromJson(Map<String, dynamic> json) =
_$VeilidAppCallImpl.fromJson; _$VeilidAppCallImpl.fromJson;
@ -2222,6 +2257,7 @@ abstract class VeilidAppCall implements VeilidUpdate {
Uint8List get message; Uint8List get message;
String get callId; String get callId;
Typed<FixedEncodedString43>? get sender; Typed<FixedEncodedString43>? get sender;
String? get routeId;
@JsonKey(ignore: true) @JsonKey(ignore: true)
_$$VeilidAppCallImplCopyWith<_$VeilidAppCallImpl> get copyWith => _$$VeilidAppCallImplCopyWith<_$VeilidAppCallImpl> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@ -2332,10 +2368,10 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment {
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender) Typed<FixedEncodedString43>? sender, String? routeId)
appMessage, appMessage,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
String callId, Typed<FixedEncodedString43>? sender) String callId, Typed<FixedEncodedString43>? sender, String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -2361,10 +2397,13 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(
String callId, Typed<FixedEncodedString43>? sender)? @Uint8ListJsonConverter() Uint8List message,
String callId,
Typed<FixedEncodedString43>? sender,
String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2389,10 +2428,10 @@ class _$VeilidUpdateAttachmentImpl implements VeilidUpdateAttachment {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(@Uint8ListJsonConverter() Uint8List message, TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2602,10 +2641,10 @@ class _$VeilidUpdateNetworkImpl implements VeilidUpdateNetwork {
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender) Typed<FixedEncodedString43>? sender, String? routeId)
appMessage, appMessage,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
String callId, Typed<FixedEncodedString43>? sender) String callId, Typed<FixedEncodedString43>? sender, String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -2631,10 +2670,13 @@ class _$VeilidUpdateNetworkImpl implements VeilidUpdateNetwork {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(
String callId, Typed<FixedEncodedString43>? sender)? @Uint8ListJsonConverter() Uint8List message,
String callId,
Typed<FixedEncodedString43>? sender,
String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2659,10 +2701,10 @@ class _$VeilidUpdateNetworkImpl implements VeilidUpdateNetwork {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(@Uint8ListJsonConverter() Uint8List message, TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2847,10 +2889,10 @@ class _$VeilidUpdateConfigImpl implements VeilidUpdateConfig {
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender) Typed<FixedEncodedString43>? sender, String? routeId)
appMessage, appMessage,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
String callId, Typed<FixedEncodedString43>? sender) String callId, Typed<FixedEncodedString43>? sender, String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -2876,10 +2918,13 @@ class _$VeilidUpdateConfigImpl implements VeilidUpdateConfig {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(
String callId, Typed<FixedEncodedString43>? sender)? @Uint8ListJsonConverter() Uint8List message,
String callId,
Typed<FixedEncodedString43>? sender,
String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2904,10 +2949,10 @@ class _$VeilidUpdateConfigImpl implements VeilidUpdateConfig {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(@Uint8ListJsonConverter() Uint8List message, TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -3108,10 +3153,10 @@ class _$VeilidUpdateRouteChangeImpl implements VeilidUpdateRouteChange {
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender) Typed<FixedEncodedString43>? sender, String? routeId)
appMessage, appMessage,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
String callId, Typed<FixedEncodedString43>? sender) String callId, Typed<FixedEncodedString43>? sender, String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -3137,10 +3182,13 @@ class _$VeilidUpdateRouteChangeImpl implements VeilidUpdateRouteChange {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(
String callId, Typed<FixedEncodedString43>? sender)? @Uint8ListJsonConverter() Uint8List message,
String callId,
Typed<FixedEncodedString43>? sender,
String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -3165,10 +3213,10 @@ class _$VeilidUpdateRouteChangeImpl implements VeilidUpdateRouteChange {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(@Uint8ListJsonConverter() Uint8List message, TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -3393,10 +3441,10 @@ class _$VeilidUpdateValueChangeImpl implements VeilidUpdateValueChange {
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender) Typed<FixedEncodedString43>? sender, String? routeId)
appMessage, appMessage,
required TResult Function(@Uint8ListJsonConverter() Uint8List message, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
String callId, Typed<FixedEncodedString43>? sender) String callId, Typed<FixedEncodedString43>? sender, String? routeId)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -3422,10 +3470,13 @@ class _$VeilidUpdateValueChangeImpl implements VeilidUpdateValueChange {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult? Function(@Uint8ListJsonConverter() Uint8List message, TResult? Function(
String callId, Typed<FixedEncodedString43>? sender)? @Uint8ListJsonConverter() Uint8List message,
String callId,
Typed<FixedEncodedString43>? sender,
String? routeId)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -3450,10 +3501,10 @@ class _$VeilidUpdateValueChangeImpl implements VeilidUpdateValueChange {
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(@Uint8ListJsonConverter() Uint8List message, TResult Function(@Uint8ListJsonConverter() Uint8List message,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appMessage, appMessage,
TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
Typed<FixedEncodedString43>? sender)? Typed<FixedEncodedString43>? sender, String? routeId)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?

View File

@ -137,6 +137,7 @@ _$VeilidAppMessageImpl _$$VeilidAppMessageImplFromJson(
sender: json['sender'] == null sender: json['sender'] == null
? null ? null
: Typed<FixedEncodedString43>.fromJson(json['sender']), : Typed<FixedEncodedString43>.fromJson(json['sender']),
routeId: json['route_id'] as String?,
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
@ -145,6 +146,7 @@ Map<String, dynamic> _$$VeilidAppMessageImplToJson(
<String, dynamic>{ <String, dynamic>{
'message': const Uint8ListJsonConverter().toJson(instance.message), 'message': const Uint8ListJsonConverter().toJson(instance.message),
'sender': instance.sender?.toJson(), 'sender': instance.sender?.toJson(),
'route_id': instance.routeId,
'kind': instance.$type, 'kind': instance.$type,
}; };
@ -155,6 +157,7 @@ _$VeilidAppCallImpl _$$VeilidAppCallImplFromJson(Map<String, dynamic> json) =>
sender: json['sender'] == null sender: json['sender'] == null
? null ? null
: Typed<FixedEncodedString43>.fromJson(json['sender']), : Typed<FixedEncodedString43>.fromJson(json['sender']),
routeId: json['route_id'] as String?,
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
@ -163,6 +166,7 @@ Map<String, dynamic> _$$VeilidAppCallImplToJson(_$VeilidAppCallImpl instance) =>
'message': const Uint8ListJsonConverter().toJson(instance.message), 'message': const Uint8ListJsonConverter().toJson(instance.message),
'call_id': instance.callId, 'call_id': instance.callId,
'sender': instance.sender?.toJson(), 'sender': instance.sender?.toJson(),
'route_id': instance.routeId,
'kind': instance.$type, 'kind': instance.$type,
}; };

View File

@ -84,6 +84,8 @@ async def test_routing_context_app_message_loopback():
assert isinstance(update.detail, veilid.VeilidAppMessage) assert isinstance(update.detail, veilid.VeilidAppMessage)
assert update.detail.message == message assert update.detail.message == message
assert update.detail.route_id is not None
finally: finally:
# release imported private route # release imported private route
await api.release_private_route(prr) await api.release_private_route(prr)
@ -130,6 +132,7 @@ async def test_routing_context_app_call_loopback():
assert isinstance(appcall, veilid.VeilidAppCall) assert isinstance(appcall, veilid.VeilidAppCall)
assert appcall.message == request assert appcall.message == request
assert appcall.route_id is not None
# now we reply to the request # now we reply to the request
reply = b"qwer5678" reply = b"qwer5678"

View File

@ -2437,6 +2437,12 @@
"message": { "message": {
"type": "string" "type": "string"
}, },
"route_id": {
"type": [
"string",
"null"
]
},
"sender": { "sender": {
"type": [ "type": [
"string", "string",
@ -2466,6 +2472,12 @@
"message": { "message": {
"type": "string" "type": "string"
}, },
"route_id": {
"type": [
"string",
"null"
]
},
"sender": { "sender": {
"type": [ "type": [
"string", "string",
@ -3982,7 +3994,7 @@
} }
}, },
"VeilidConfigWS": { "VeilidConfigWS": {
"description": "Enable and configure Web Sockets\n\n```yaml ws: connect: true listen: true max_connections: 16 listen_address: ':5150' path: 'ws' url: 'ws://localhost:5150/ws'", "description": "Enable and configure Web Sockets\n\n```yaml ws: connect: true listen: true max_connections: 32 listen_address: ':5150' path: 'ws' url: 'ws://localhost:5150/ws'",
"type": "object", "type": "object",
"required": [ "required": [
"connect", "connect",
@ -4018,7 +4030,7 @@
} }
}, },
"VeilidConfigWSS": { "VeilidConfigWSS": {
"description": "Enable and configure Secure Web Sockets\n\n```yaml wss: connect: true listen: false max_connections: 16 listen_address: ':5150' path: 'ws' url: ''", "description": "Enable and configure Secure Web Sockets\n\n```yaml wss: connect: true listen: false max_connections: 32 listen_address: ':5150' path: 'ws' url: ''",
"type": "object", "type": "object",
"required": [ "required": [
"connect", "connect",

View File

@ -296,10 +296,12 @@ class VeilidLog:
class VeilidAppMessage: class VeilidAppMessage:
sender: Optional[TypedKey] sender: Optional[TypedKey]
route_id: Optional[RouteId]
message: bytes message: bytes
def __init__(self, sender: Optional[TypedKey], message: bytes): def __init__(self, sender: Optional[TypedKey], route_id: Optional[RouteId], message: bytes):
self.sender = sender self.sender = sender
self.route_id = route_id
self.message = message self.message = message
@classmethod @classmethod
@ -307,17 +309,20 @@ class VeilidAppMessage:
"""JSON object hook""" """JSON object hook"""
return cls( return cls(
None if j["sender"] is None else TypedKey(j["sender"]), None if j["sender"] is None else TypedKey(j["sender"]),
None if j["route_id"] is None else RouteId(j["route_id"]),
urlsafe_b64decode_no_pad(j["message"]), urlsafe_b64decode_no_pad(j["message"]),
) )
class VeilidAppCall: class VeilidAppCall:
sender: Optional[TypedKey] sender: Optional[TypedKey]
route_id: Optional[RouteId]
message: bytes message: bytes
call_id: OperationId call_id: OperationId
def __init__(self, sender: Optional[TypedKey], message: bytes, call_id: OperationId): def __init__(self, sender: Optional[TypedKey], route_id: Optional[TypedKey], message: bytes, call_id: OperationId):
self.sender = sender self.sender = sender
self.route_id = route_id
self.message = message self.message = message
self.call_id = call_id self.call_id = call_id
@ -326,6 +331,7 @@ class VeilidAppCall:
"""JSON object hook""" """JSON object hook"""
return cls( return cls(
None if j["sender"] is None else TypedKey(j["sender"]), None if j["sender"] is None else TypedKey(j["sender"]),
None if j["route_id"] is None else RouteId(j["route_id"]),
urlsafe_b64decode_no_pad(j["message"]), urlsafe_b64decode_no_pad(j["message"]),
OperationId(j["call_id"]), OperationId(j["call_id"]),
) )