Yeah, Google complains about our password again, and then again, a bunch of stuff is sent around, these elliptic curves, points, but at no point, and it does a Diffie-Hellman exchange, it's all fancy stuff, but what you get out again is this export key, C24q and yada, yada, yada.
And as mentioned, this basically allowed us to do the whole key management, solve the whole key management for our application in a couple hundred lines of code, and it's all, you don't have to know any math or anything, you can just build it, or go into the application and copy what you need.
But there's one last thing that we are missing, because so far, this works really well for building an application where you can collaborate with your own devices. You can sign in from different devices, different browsers, and you always get the same open key, and with that, you can fetch the locker, unlock it, and get access to your documents. But we said we want to build something collaboratively, and this is what Lini also supports.
You can share the invitation. So we basically want to go to a point where someone else with their own locker and maybe different access can also access the same document. How do we do this? Well, if you have an invitation system, you just extend it. For example, if you have link invitations. Link invitation can be just the URL with slash invitation, and then you have a token that the server understands to give you access to that data.
One interesting fact about URLs is that we could actually hide a key in the hash part. Because fun fact, did you know the hash part is never sent to the server? If you take this URL, you put it in the browser, and you hit enter, the hash part only stays on the client. And this is really, really nice to basically build this link sharing UX with end-to-end encrypted application.
And then basically on the other client, in this case, the one accepting the invitation, we can just get out the hash param, in this case the key. We can accept the document invitation, in this case using TRPC with the original token. Not the key, but the token to accept the invitation. And then once we know it was accepted, we just add it to our own locker. Voila! And this is how you can manage invitations on an end-to-end encrypted system.
There's one thing though. You probably don't want to put the actual key in a URL that you share, maybe in Slack or an email or so on. You can come up with schemes that are a bit smarter. And I actually did this in Linne, so if you check out the source, it's described and it's documented. But unfortunately, I'm out of time, so this has to be a story for another time. Watch the follow-up talk. I actually intend to blog a lot about this in the next coming months, because I was deep in the rabbit hole in the last two years and now I actually want to share all these lessons learned. But what I wanted to show you with this talk is that there's actually tools already, or systems, that we can use, libraries that we can use, like Opaque and Zexion and so on, that make it really, really easy to build end-to-end encrypted applications. They might be simple. They just have authentication and invitation links. But it's already quite powerful. And if you have a subset of data that you care about that should be end-to-end encrypted in your application, you might be fine just doing that.
Comments