Repository navigation
feat(wallet-sdk): initial release of @abstract-foundation/wallet-sdk - #30
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Framework-agnostic SDK for embedding the Abstract Global Wallet on
third-party origins via iframe (with popup fallback). Ports the
security-relevant pieces of Porto to the Abstract stack.
What ships:
- createWallet({ host, chainId, dialog }) returning an EIP-1193 provider
- iframe() / popup() dialog factories with hardened sandbox + allow attrs:
sandbox="allow-forms allow-scripts allow-same-origin
allow-popups allow-popups-to-escape-sandbox"
allow="payment;
publickey-credentials-get <walletOrigin>;
publickey-credentials-create <walletOrigin>;
clipboard-write"
- Top-layer <dialog>.showModal() mounting so z-index attacks fail and ESC
always closes
- Origin-validated postMessage messenger with branded envelopes (abs: 1),
ready handshake, request-id correlation. Refuses to ever post to '*'.
- WebAuthn-aware iframe → popup fallback (Safari blocks WebAuthn credential
creation in iframes for wallet_connect / eth_requestAccounts)
- IntersectionObserver-v2 feature detection used by the parent-side
secure() eligibility check; the actual visibility wrapper lives in the
wallet host application (delivery-mechanic concern)
- MutationObserver defending against extensions injecting `inert` onto the
dialog (1Password and similar)
- Pending-request map redelivered against the new transport on mode switch
Public API:
import { createWallet } from '@abstract-foundation/wallet-sdk';
import { Dialog, Messenger, UserAgent, IntersectionObserver }
from '@abstract-foundation/wallet-sdk/core';
Verified: pnpm typecheck, pnpm build, pnpm test (8/8), pnpm test:build
(publint clean, attw all green).
Web Components (/elements) and React wrappers (/react) ship in follow-up
releases.
coffee-the-dev
force-pushed
the
coffee/wallet-sdk
branch
from
May 7, 2026 23:01
4d35d73 to
5c5a10a
Compare
AGW does not use WebAuthn for wallet signing or account creation, and Privy
passkey enrollment only happens in the main Abstract portal app under
account management — never inside the iframed wallet. So forcing every
Safari user into popup mode for `wallet_connect` / `eth_requestAccounts`
on the chance that they might be enrolling a passkey is over-eager: it
hurts UX for the Safari users who sign in with email + OTP / social /
external wallet (the majority).
Returning users with passkeys log in via `navigator.credentials.get()`,
which works in cross-origin iframes when the `publickey-credentials-get`
permission is granted (set automatically by `Dialog.iframe()`'s `allow`
attribute, which is unchanged by this commit).
Removed:
- SAFARI_WEBAUTHN_METHODS constant in Wallet.ts
- The Safari/WebAuthn check in pickInitialMode (now just iframe vs popup
based on the configured mode)
- The orphaned `UserAgent` import in Wallet.ts
Kept:
- iframe `allow="payment; publickey-credentials-{get,create} <origin>;
clipboard-write"` policy — `get` is needed for passkey login, `create`
is harmless and future-proofs us
- The messenger-driven `__internal { type: 'switch', mode: 'popup' }`
channel — the wallet host can still request a runtime switch for any
reason (including future flows that genuinely need WebAuthn create)
Docs / changeset updated to match. All gates re-verified: typecheck,
build, 8/8 tests, publint, attw all green.
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Initial release of
@abstract-foundation/wallet-sdk— a new dApp-side SDK that lets any web app embed the Abstract Global Wallet on third-party origins via an iframe (with automatic popup fallback). Mirrors the security model of Porto, adapted for the AGW + Privy stack.The wallet host (the page that actually runs inside the iframe) is a separate app currently in flight. This SDK ships the dApp-side primitives so it can be consumed as soon as the host is up.
What's in the box
Lower-level primitives are exposed at
@abstract-foundation/wallet-sdk/core:Security highlights (defense-in-depth from Porto)
sandbox="allow-forms allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox"andallow="payment; publickey-credentials-{get,create} <walletOrigin>; clipboard-write"(clipboard-write skipped on Firefox).<dialog>.showModal()mounting — z-index stacking attacks fail; ESC always closes; backdrop is rendered for free.postMessageon every inbound message; outboundtargetOriginis required (refuses to ever post to*). Branded envelopes (abs: 1) so foreign messages on the same origin can't spoof.navigator.credentials.createin iframes, sowallet_connectandeth_requestAccountsautomatically route through a popup on Safari.Dialog#secure— combined with the wallet host's trusted-host allowlist, the dApp side decides whether iframe mode is safe; the actualisVisible-based pointer-event lockdown lives inside the wallet host (delivery-mechanic concern, doesn't belong in the SDK).MutationObserverstripsinertattributes injected onto the dialog by browser extensions (well-known issue with 1Password and similar).Verification
pnpm typecheck— cleanpnpm build— ESM + CJS dual emit cleanpnpm test— 8/8 (origin filtering, brand-envelope rejection, send-without-origin refusal, UA detection)pnpm test:build—publintclean (same suggestionsagw-react/agw-clientalready ship with),attw --pack --ignore-rules false-cjsall green fornode10,node16(CJS+ESM), andbundlerresolutionsOut of scope (follow-ups)
/elements— Lit-based Custom Elements (<abs-wallet-button>,<abs-balance>, etc.) so any framework can embed widgets, not just React. Addresses the long-standing AGW criticism of being React-only./react— auto-generated@lit/reactwrappers + hooks over the same elements.wallet.abs.xyzthat this SDK talks to. Internal repository; in flight.Notes
0.1.0(changeset =minor) — pre-1.0 because the wallet host isn't deployed yet, but the surface area is intentionally tight and ready to be tagged.agw-client(test/src/**/*.test.tswithvitest -c ./test/vitest.config.ts).package.jsonexports / build scripts mirroragw-clientandagw-react.provenance: trueset so npm provenance tags publish correctly under the existing OIDC workflow.