Now that I've implemented authenticated connections, I need my server-side methods to be able to find out the identity (public key) of the connected peer
. So for example, my method LibraryImpl::checkoutBook(isbn) needs to check the identity of the client (as given in the SecretHandshake when connecting) to determine if they have permission to get that book.
(A different example that doesn't involve SecretHandshake is one where a server-side method wants to look at the IP address of the client. Or, if using TLS, the client's TLS cert.)
What's the best way to do this? I'm using my modified version of EzRpcServer, and I'm getting familiar with its innards but I can't claim to really understand this stuff yet. It appears that the "mainInterface" capability vended by the server is a singleton, shared by all clients, so I can't stuff per-client info into it. The point of vending is the restore() method, but that method can't tell what client it's being called on behalf of...