Skip to content

Commit

Permalink
📝 Add basic READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
cermakjiri committed Oct 10, 2024
1 parent 5f682c9 commit a9915c7
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,51 @@
# With WebAuthn

A repository with full stack WebAuthn API examples.

<div style="text-align:left">

## Examples

1. **[Passkeys with SimpleWebAuthn & Firebase](examples/simplewebauthn)**
- Creating (user registration), retrieving (user login), linking, removing of passkeys.
- Issuing a JWT token via Firebase Auth once user is authenticated.
- Passkes are stored in Firebase Firestore.
- Formatting and parsing of WebAuthn API request / responses done via SimpleWebAuthn library.

---

## Development

### Common Stack notes:

- The whole project is managed using tuborepo and yarn workspaces.
- All examples are in NextJS (React) framework.
- API calls are handled with React Tanstack query on client.
- API endpoints are build via NextJS API routes.
- Forms are built with react-hook-form and validated with zod schemas.
- Material UI with styled components as UI SDK.

### How to start the project locally?

1. Initialize package manager:
Make sure you're running Node v20. Then initialize a package manager (corepack) by calling:

```sh
corepack enable
corepack install
```

It finds `packageManager` field and install Yarn 4.

2. Install dependencies:

```sh
yarn install --immutable
```

3. Then continue with final steps for specific example:
- [Passkeys with SimpleWebAuthn & Firebase](examples/simplewebauthn/README.md)

## Have you a found a bug?

Please, open an [Github issue](https://github.com/cermakjiri/with-webauthn/issues/new/choose). Thank you. ❤️
33 changes: 33 additions & 0 deletions examples/simplewebauthn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Passkeys with SimpleWebAuthn & Firebase

- Creating (user registration), retrieving (user login), linking, removing of passkeys.
- Issuing a JWT token via Firebase Auth once user is authenticated.
- Passkes are stored in Firebase Firestore.
- Formatting and parsing of WebAuthn API request / responses done via SimpleWebAuthn library.

## Development

### How to start it locally?

Assuming you've already finished [those steps in the main README](../../README.md), let's proceed:

1. Setup Firebase:

1. Create a new Firebase project

2. Copy `.env.template.local` to `.env.local`:

- Fill up all those `NEXT_PUBLIC_FIREBASE_` env. vars.

3. Copy `.env.template.server` to `.env.server`:

- Create a new private key in `Firebase > Project settings > Service accounts`.
- Fill up all those `Firebase_` env. vars.

4. Don't forget to add `localhost` as Authorized domain in Firebase:

- Firebase > Authentication > Settings > Authorised domains.

5. Create a Firebase firestore database

2. Run `yarn dev` and checkout `http://localhost:3000` URL.

0 comments on commit a9915c7

Please sign in to comment.