Coder Social home page Coder Social logo

jehrhardt / supapasskeys-rust-poc Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 108 KB

A multi-tenant Passkeys server for Postgres and Supabase

License: GNU Affero General Public License v3.0

Rust 98.43% Dockerfile 1.57%
authentication fido2 passkeys postgres rust supabase web webauthn

supapasskeys-rust-poc's People

Contributors

jehrhardt avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

supapasskeys-rust-poc's Issues

Project split

The goal of Supapasskeys has been to provide the best Passkey solution for Supabase. This will still be the goal in the future.

But this focus comes at the risk of binding the project completely to Supabase. That would be very sad as there are other Postgres hosting providers and also people self-hosting Postgres. It would make so much more sense for an open source project to be useable everywhere.

Solution

The new strategy is to go for 2 projects:

  • Supapasskeys API: A multi-tenant Passkey server on top of Postgres
  • Supabase Extension: Provides the best Passkey support for Supabase

Both will be independent projects on Github to ensure each one of them is clearly focused on its purpose.

Supapasskeys API

The Supapasskeys API will be rewritten in Rust. Supapasskeys uses already webauthn-rs and using Rust for the whole app has the following benefits:

  • Small and efficient binaries (great for self-hosting and local development)
  • Great language for services that aim for being stable instead of changing frequently
  • Cargo features can be used to add specific code for integration with Supabase Extension (e.g. multi DB support)

Supabase Extension

The current code base will the foundation of Supabase extension. Therefore it will continue to be written in Elixir and use Phoenix LiveView. But we can completely focus on Supabase as the target platform.

Todos

  • Rename current project
  • Setup new supapasskeys Rust project

Implement Passkeys API

After the code split the Passkeys API must be implemented in pure Rust.

Non-goals

This about basic the basic Passkey registration and authentication APIs. Multi-tenancy and Passkey management are not in the scope.

API authentication will also be implemented separately.

Solution

We will use axum to implement the registration and authentication endpoints:

  • POST /passkeys/registrations: Create a new registration→ 201 + create credentials options
  • POST /passkeys/authentications: Create a new authentication → 201 + credentials request options
  • PATCH /passkeys/registrations/:registration_id: Update the registration with attestation response → 204
  • PATCH /passkeys/authentications/:authentication_id: Update the authentication with assertion response → 204

Server side relying party will be implemented using webauthn-rs.

Relying Party Config

For now the relying party will be configured by the following environment variables:

  • RELYING_PARTY_NAME
  • RELYING_PARTY_ORIGIN

The variables will eventually be removed, when multi-tenancy is implemented later.

Postgres

Supapasskeys will depend on basic Postgres 15. We will use SeaORM for database mapping and migration. Database migrations will be written in SQL, not in the SeaORM DSL.

Docker

The main branch needs to build a Docker image for amd64 and arm64 and publish it to Github packages. During CI a Docker build must be executed for amd64 only to verify the build.

Documentation

All required documentation goes into README.md.

Todos

  • Implement API
  • Add Dockerfile
  • Update Github Actions
  • Update documentation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.