peterferguson / spc-hack

Home Page:https://spc-wallet.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Secure Payment Confirmation (SPC) Wallets As A Service πŸ‘›

What if you could create a wallet instantly on any dapp, fund it & re-use it anywhere. πŸ‘€

SPC wallets are built ontop of Secure Payment Confirmation a web api designed to streamline web2 payments that leverages passkeys to authenticate the user.

We leverage the webauthn-side of the SPC protocol to create passkey wallets that are capable of securely signing transactions on any dapp.

What is this repo?

This repo is a simple end-to-end implementation of SPC wallets, complete with passkey wallet contracts, a simple dapp frontend, wallet application & a library that lets you embed these wallets in your dapp.

πŸ–ΌοΈ Demo

Below is a demo journey of a user that has never used the wallet provider or the dapp frontend before.

CleanShot 2024-03-17 at 06 08 07

User Steps

  1. User clicks to claim but has no account -> dapp shows wallet creation popup
  2. User inputs a (globally unique to the wallet provider) username
  3. Counterfactual account is created linked to the public key of the passkey
  4. User again clicks to claim & is presented with an SPC confirmation modal
  5. User signs passkey, confirming that they have agreed to the transaction

Corresponding Technical Steps

  1. dapp check for stored credentials, fails to find any & falls back to showing wallet creation popup
  2. dapp & wallet provider communicate to ensure the username is available & create a passkey if so
  3. wallet provider stores the users credentials so they can be relayed to other dapps upon request
  4. dapp has prepared a UserOp representing the Claim Coupon NFT, creates a Payment Request to be signed by the passkey on confirmation of the SPC modal
  5. dapp (or wallet) send the signed UserOp to a bundler for inclusion.

Project Structure πŸ“‚

.
|
β”œβ”€β”€ apps                    # Examples of implementations for wallets & dapps
β”‚   β”œβ”€β”€ ...
β”‚   β”œβ”€β”€ dapp                # The dapp frontend responsible for creation & operation of the passkey operations 
β”‚   β”œβ”€β”€ wallet              # The wallet provider responsible for registration of passkey credentials
β”‚   └── ...
β”œβ”€β”€ packages
β”‚   β”œβ”€β”€ ...
β”‚   β”œβ”€β”€ contracts           # Contracts for the Safe 4337-module (V07 bundler) with passkey signers
β”‚   β”œβ”€β”€ spc-lib             # A utility library with functions for communication between the wallet provider and dapp
β”‚   └── ...
└── ...

Deployments

About

https://spc-wallet.vercel.app


Languages

Language:TypeScript 43.0%Language:Solidity 36.9%Language:HTML 8.5%Language:Astro 4.5%Language:JavaScript 4.2%Language:CSS 2.8%