Veritius / bevy_stardust

A flexible networking crate for Bevy.
Apache License 2.0
36 stars 0 forks source link

Peer authorisation #22

Open Veritius opened 4 months ago

Veritius commented 4 months ago

Some kind of transport-agnostic API or trait that lets you add steps to 'authorise' a peer before it's considered fully connected, but only after a handshake so reliability is ensured. This could be a whole stage in #16.

It should be added during construction of the App, and it's iterated by transport layers before they say "yep, this peer's all good!"

Should the I/O API be distinct from the typed message API exposed to systems? They should probably just directly take in/put out bytes for transmission, which the transport layer will deal with however it chooses.

Other considerations:

Veritius commented 4 months ago

On second thought, it's probably better to have a solution where systems can signal to NetworkPeer entities that they're running authentication checks. When that's passed, then other systems are made aware of that and can run as per usual. This allows authentication checks, being systems, to access the World (which a trait solution can't easily do) so extra data can be appended, like state.