# Protocol ### `/ws-star/2.0.0` ## Connecting & Crypto challenge ```protobuf message IdentifyRequest { required string nonce = 1; } message IdentifyResponse { required bytes id = 1; required bytes pubkey = 2; required bytes signature = 3; } ``` ### Error Handling If verifing the IdentifyResponse fails the connection gets closed by the server (protocol error) ### Example Connection C: connects S: Uses `.getPeerInfo()` to get id. Generates random nonce (64 byte alphanumeric string) and sends IndentifyRequest. C: Signs nonce and send id, pubkey and signature back to server as IndentifyResponse S: Verifies IndentifyResponse S: Server adds peer to peerDB, starts to announce peer ## Multiplexing #### `TODO` ## Dials ```protobuf message DialRequest { required bytes id = 1; required string connectionId = 2; } message DialResponse { required bool success = 1; } message ConnectionRequest { required bytes fromID = 1; required string connectionId = 2; } message ConnectionResponse { required bool success = 1; } ``` ### Error Handling If the other peer does not ACK within 10s or isn't online the server sends a DialResponse with `success = false` ### Example Connection `assumes a and b are already connected & identified` Ca: sends DialRequest to S, opens conn N.dialer S: Opens a proxy between CaN.{dialer,listener} and CbN.{dialer,listener}. Sends ConnectionRequest to B Cb: Accepts dial request, opens conn N.listener. Send ConnectionResponse S: Sends ConnectionResponse to A Ca: Finishes up the connection