Overview
Web3Kit is a standalone page served by the auth-central app that is meant to be embedded as an <iframe> inside a third-party host. The host owns the wallet connection (MetaMask / WalletConnect / etc.). Web3Kit, running inside the iframe, owns the OAuth session (it reads authToken from its own URL) and performs all calls to the auth-central API on behalf of the host. The two sides talk over window.postMessage.
Architecture
┌──────────────────────────┐ postMessage ┌─────────────────────────┐
│ │ ◀──────────────── │ │
│ Host service │ │ Web3Kit (iframe) │
│ (parent window) │ ────────────────▶ │ /oauth/<token>/web3-kit│
│ owns wallet connector │ │ calls auth-central API │
└──────────────────────────┘ └─────────────────────────┘
Responsibilities
| Side | Responsible for |
|---|---|
| Host (parent) | Wallet connect, signing the message, routing inbound messages by connectionId. |
| Iframe (Web3Kit) | Calling /web3/signature, /web3/authenticate, /web3/createAndAuthenticate; mapping API responses to the message contract. |
Source files in this repo
| What | Path |
|---|---|
| Iframe page | src/pages/Web3KitPage/Web3KitPage.tsx |
| Reference consumer (demo) | src/pages/DemoWeb3KitTestPage/DemoWeb3KitTestPage.tsx |
| Exported enums (the contract) | src/pages/Web3KitPage/Web3KitPage.tsx (named exports) |
| Underlying Web3 API | src/modules/Web3 (see also docs/web3-api.md) |
A live demo is available in this repo at /demo → fill the form → click Test web3 kit.