Summary of activity from 30/10/2021 to 22/12/2021
- SolidCntrl App
- SubProjects
- library port to Scala-JS
- Signing Http Messages library
- Crypto library
- Other
The aim of this Milestone was to build a minimal client for SolidCtrl. As this is very different from the server I opened a new repository SolidCtrl App, which should be moved soon to co-operating systems github repo.
This contains an N3 parser and an initial Wallet that can do Basic Authentication (AuthN.scala ). In order to support HTTPSig authentication I needed to extract the "Signing Http Messages" from Reactive Solid into a new repository and contribute to a Typelevel cryptographic library. This is described in more detail below.
The Client Auth library must function in the browser using JavaScript. To reduce cognitive load on developers we would like to use the same APIs for the client and the server.
Years ago I wrote a a pure Scala NTriples parser that can compile to ScalaJS for banana-rdf. But for a client to work on the web we need Turtle, NTrig, etc... I found Ruben Verborgh's N3.js library, which provides asynchronous parsers for Turtle, TriG, N-Triples, N-Quads, RDF* and Notation3 (N3). (On second thoughts I realised I should perhaps have written a facade f or graphy.js).
In order to build something that could work efficiently on the client but use abstractions that could also work nicely on a JS or Java server, I decided to use the typelevel effect stack consisting of
- Cats Effect - core effect library
- FS2 - streaming library, building on cats effect
- http4s - http library that builds on both the above
The result is now part of the SolidCtrlApp so that the code is close to the Application which uses it. Later when stable it can be moved to a banana-rdf io module.
The interface is simple and composable. A parser transforms a stream of N3 bytes to a stream of quads, fitting nicely into a async flow.
val quads: Stream[IO, Quad] = N3Parser.parse[IO](streamOfBytes)
In Milestone 3 I worked on implementing the IETF's Signing HTTP Messages (v7 was just released) which is part of the Reactive Solid Codebase. As I needed this for the client I extracted the code into its own repository httpSig so that other Scala, Java or JS projects can more easily make use of the code.
The project will contain 3 or 4 projects:
- A pure Scala implementation of rfc8941 on which "Signing HTTP Messages" depends
- The Akka implementation of "Signing Http Messages"
- An Http4s implementation to come, compiling to JS and Java byte-code
- Hopefully a library that collects the commonalities between the Akka and Http4s versions if possible
The reason we have an Akka and Http4s versions is that those two frameworks use similar but different header libraries.
If any of these are of interest to other projects please put them in contact with me.
In order to build the HttpSig signing and verification layer I needed a crypto library that would present a unified interface for Scala and Scala-JS. I found the author of the new Typlevel Bobcats library who suggested I make a PR to add Signing and Verification part. I have submitted PR 39 that has implemented the core Java features and will next write the Scala-JS implementation based on the Web Crypto API. The tests work against the IETF Signing Http messages spec.
The rest of the month I want to finish the above projects so that I can get to building ouy the very basic Wallet to enable authentication using HTTPSig.
The last milestone called "Closing" is there to tie up loose ends.