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

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

View file

@ -2437,6 +2437,12 @@
"message": {
"type": "string"
},
"route_id": {
"type": [
"string",
"null"
]
},
"sender": {
"type": [
"string",
@ -2466,6 +2472,12 @@
"message": {
"type": "string"
},
"route_id": {
"type": [
"string",
"null"
]
},
"sender": {
"type": [
"string",
@ -3982,7 +3994,7 @@
}
},
"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",
"required": [
"connect",
@ -4018,7 +4030,7 @@
}
},
"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",
"required": [
"connect",

View file

@ -296,10 +296,12 @@ class VeilidLog:
class VeilidAppMessage:
sender: Optional[TypedKey]
route_id: Optional[RouteId]
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.route_id = route_id
self.message = message
@classmethod
@ -307,17 +309,20 @@ class VeilidAppMessage:
"""JSON object hook"""
return cls(
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"]),
)
class VeilidAppCall:
sender: Optional[TypedKey]
route_id: Optional[RouteId]
message: bytes
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.route_id = route_id
self.message = message
self.call_id = call_id
@ -326,6 +331,7 @@ class VeilidAppCall:
"""JSON object hook"""
return cls(
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"]),
OperationId(j["call_id"]),
)