-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
onlydust-waveContribute to awesome OSS repos during OnlyDust's open source weekContribute to awesome OSS repos during OnlyDust's open source week
Description
π Configure WebAuthn for Biometric Authentication π οΈ
π Description
Configure the WebAuthn library to enable biometric authentication (e.g., fingerprint or Face ID) for the Stellar wallet service. This setup will provide secure user authentication by leveraging WebAuthnβs public key cryptography, preparing the service for registering and verifying user credentials in subsequent issues. The configuration will establish the server as a Relying Party (RP) for WebAuthn.
π― Objective
Set up WebAuthn in services/stellar-wallet/src/auth/webauthn.js to initialize the server as a Relying Party and provide functions for generating registration and verification options.
π Structure
- Directory:
services/stellar-wallet - Files:
src/auth/webauthn.jspackage.json(updated)
- Expected structure:
services/stellar-wallet βββ src β βββ index.js β βββ stellar β β βββ client.js β β βββ keys.js β β βββ fund.js β βββ db β β βββ kyc.js β βββ routes β β βββ kyc.js β β βββ kyc-verify.js β β βββ kyc-status.js β βββ kyc β β βββ validate.js β βββ soroban β β βββ client.js β β βββ kyc-contract.rs β β βββ deploy.js β βββ auth β βββ webauthn.js βββ config β βββ db.sqlite βββ tests β βββ stellar β β βββ client.test.js β β βββ keys.test.js β β βββ fund.test.js β βββ db β β βββ kyc.test.js β βββ routes β β βββ kyc.test.js β β βββ kyc-verify.test.js β β βββ kyc-status.test.js β βββ kyc β β βββ validate.test.js β βββ soroban β βββ client.test.js β βββ deploy.test.js βββ package.json βββ .env.example βββ .eslintrc.json βββ .eslintignore βββ .prettierrc.json βββ .prettierignore βββ .gitignore
β Requirements
- Create a branch named
feat/webauthn-configfor this task. - Install the WebAuthn server library using
npm install @simplewebauthn/server. - Update
package.jsonto include@simplewebauthn/serveras a dependency. - Create
src/auth/webauthn.jswith functions:configureWebAuthn: Initializes the WebAuthn server as a Relying Party with configuration (e.g., RP name, ID, and origin from.env).generateRegistrationOptions: Generates WebAuthn registration options for a user.generateAuthenticationOptions: Generates WebAuthn authentication options for a user.
- Add environment variables to
.env.examplefor WebAuthn configuration (e.g.,RP_NAME,RP_ID,ORIGIN). - Set
RP_NAMEto a descriptive name (e.g.,Stellar Wallet),RP_IDto the server domain (e.g.,localhostfor development), andORIGINto the server URL (e.g.,http://localhost:3000). - Ensure the functions produce valid WebAuthn options compatible with browser-based authenticators (e.g., fingerprint or Face ID).
- Ensure the code adheres to ESLint and Prettier rules (from Issue 3).
- Commit changes to the
feat/webauthn-configbranch with a message likefeat: configure webauthn. - Verify that the CI pipeline (from Issue 1) passes, with linting succeeding (no tests required for this issue).
π Expected Outcomes
@simplewebauthn/serveris installed and listed inpackage.json.src/auth/webauthn.jscontainsconfigureWebAuthn,generateRegistrationOptions, andgenerateAuthenticationOptionsfunctions.- WebAuthn is configured as a Relying Party with values from environment variables.
.env.exampleincludesRP_NAME,RP_ID, andORIGINfor WebAuthn configuration.- Code passes ESLint and Prettier checks.
- Changes are committed to the
feat/webauthn-configbranch with a descriptive lowercase commit message. - CI pipeline runs successfully, with linting passing for
src/auth/webauthn.js.
π References
π Notes
- The
RP_IDshould be set tolocalhostfor development but updated to the production domain later. - The
ORIGINmust match the serverβs URL to ensure compatibility with WebAuthn clients. - No unit tests are required in this issue, as testing will be covered in subsequent issues for registration and authentication.
- Ensure environment variables are documented in
.env.examplewithout sensitive values. - Commit messages must be in lowercase and start with
feat,change,fix,chore, orrefactor. - The CI pipeline should validate the new code, ensuring ESLint passes for
src/auth/webauthn.js.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
onlydust-waveContribute to awesome OSS repos during OnlyDust's open source weekContribute to awesome OSS repos during OnlyDust's open source week