ACHTUNG: it is a bad, bad, BAD code. It even does not cover all the available functionality of google macaroons. Please forgive me for forcing you to feel sick as you look thru it.
Anyway, what is nice is:
- this code shows the fastest nodejs websocket/HTTP server implementation to date
- the server runs over a secure connection; look how it's simple
- the client-server communication is binary, thou it just ping-pongs stringified JSON which is not that a compact format - should need arise I would substitute it with google flatbuffers for sure
- the client encodes the name of the function it needs to call on the server and passes arguments for it - look how this dynamic invocation is implemented, how authorization is done and how easy it will be to implement dynamic authorization checks
- a google macaroon gets transmitted via a special x-bla-bla header which the server reads and later decodes
- you need to have a fresh install of pnpm
- run
./bin/install-all
from the root directory to install all dependencies - you need the mkcert tool useful for creation of self-signed certificates suitable for development
- run
mkcert -install
to install local CA to the system trust store - run
./bin/gen-cert
to generate server key and cert via themkcert
from the project directory run pnpm --recursive run test
- navigate to
packages/libwss
- run
pnpm run test
and lots of sorries for my English, of course. Verzeihung.