Skip to content

ConnectionHandler

Thomas Schwotzer edited this page Aug 20, 2021 · 8 revisions

There is a lot talking about our ASAP encounter. It is quite prosaic on developer level. There is an interface ASAPConnectionHandler that defines variants that defines variants of a single method. Here is the full version. Variants just use defaults.

public interface ASAPConnectionHandler {
...
    ASAPConnection handleConnection(
        InputStream is, OutputStream os, // streams for our point-to-point connection
        boolean encrypt, boolean sign, // security setting point-to-point connection
        EncounterConnectionType connectionType, // what kind of point-to-point is it?
        Set<CharSequence> appsWhiteList, 
        Set<CharSequence> appsBlackList // define black/white list of peers
    ) throws IOException, ASAPException;

This interface does not explain how to create a point-to-point connection. It can be used if such a connection was created.

There other libs, like [ASAPAndroid] how deal with establishing a point-to-point connection. In the end, a pair of streams is created (input and output stream). Anybody who created such a connection is very aware of the kind of connection. Take one from our list, defined in EncounterConnectionType.

Point-to-point security can be switched on or off with two flags (encrypt, sign). encrypt == true would encrypt any message send over this connection. Note, encryption requires a public key of message receiver on senders’ side. Nothing is sent if there is no such key. That is a good thing. If security is important you should take it seriously.

Signing only requires access to a local ASAPKeyStore that provides local peers’ private key.

Clone this wiki locally