Skip to content

Commit

Permalink
Merge pull request #9 from peterferguson/update-readmes
Browse files Browse the repository at this point in the history
Update readmes
  • Loading branch information
jamesmccomish authored Mar 17, 2024
2 parents 7a90d81 + 53e2b04 commit 49cf63f
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 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](https://w3c.github.io/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](https://github.com/peterferguson/spc-hack/tree/main/packages/contracts), [a simple dapp frontend](https://github.com/peterferguson/spc-hack/tree/main/apps/dapp), [wallet application](https://github.com/peterferguson/spc-hack/tree/main/apps/wallet)
& [a library](https://github.com/peterferguson/spc-hack/tree/main/packages/spc-lib) 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](https://spc-wallet.vercel.app) or the [dapp frontend](https://spc-dapp.web.app) before.

![CleanShot 2024-03-17 at 06 08 07](https://github.com/peterferguson/spc-hack/assets/7002211/8c1084b7-94a1-486d-a014-5c3ba9390fbd)

### 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`](https://w3c.github.io/payment-request/#paymentrequest-interface) 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

- Dapp Frontend -> deployed at [https://spc-dapp.web.app](https://spc-dapp.web.app)

- Wallet Frontend -> deployed at [https://spc-wallet.vercel.app](https://spc-wallet.vercel.app)

- Contracts -> deployed at [contracts#deployments](https://github.com/peterferguson/spc-hack/tree/main/packages/contracts#deployments)
3 changes: 3 additions & 0 deletions packages/helpers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Helpers Packages

A set of utilities that are shared across the monorepo
17 changes: 17 additions & 0 deletions packages/spc-lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Secure Confirmation Payment Library

This library lets dapps create & operate a passkey wallet from any provider.
What is even better is the user never has to leave the dapps site!

All transactions are confirmed on the dapps webpage using the wallets passkey credentials.

<img width="706" alt="image" src="https://github.com/peterferguson/spc-hack/assets/7002211/c8dfa813-64d2-490d-8c0f-452486f54e00">

The wallet will need to support Secure Payment Confirmation (SPC) & some conventions defined in this repo.

## Getting started (For dApps)

The first step is to embed

## Getting started (For Wallet Providers)

0 comments on commit 49cf63f

Please sign in to comment.