@bwalletx/connect 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +76 -8
- package/dist/bwalletx-connect.global.js +92 -25
- package/dist/bwalletx-connect.global.js.map +1 -1
- package/dist/{wallets-CbzMtxrf.d.ts → choice-DCh-tgpT.d.cts} +112 -4
- package/dist/{wallets-CbzMtxrf.d.cts → choice-DCh-tgpT.d.ts} +112 -4
- package/dist/chunk-34DKBQNN.js +222 -0
- package/dist/chunk-34DKBQNN.js.map +1 -0
- package/dist/{chunk-QRXFL66W.js → chunk-A2WLGS25.js} +6 -4
- package/dist/chunk-A2WLGS25.js.map +1 -0
- package/dist/chunk-IFGOAROM.js +255 -0
- package/dist/chunk-IFGOAROM.js.map +1 -0
- package/dist/chunk-LS6AYEBO.js +1886 -0
- package/dist/chunk-LS6AYEBO.js.map +1 -0
- package/dist/element-D9Zl-x12.d.cts +46 -0
- package/dist/element-D9Zl-x12.d.ts +46 -0
- package/dist/element.cjs +1147 -61
- package/dist/element.cjs.map +1 -1
- package/dist/element.d.cts +23 -28
- package/dist/element.d.ts +23 -28
- package/dist/element.js +29 -2
- package/dist/element.js.map +1 -1
- package/dist/index.cjs +1469 -453
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +163 -14
- package/dist/index.d.ts +163 -14
- package/dist/index.js +100 -12
- package/dist/index.js.map +1 -1
- package/dist/next.cjs +5 -3
- package/dist/next.cjs.map +1 -1
- package/dist/next.js +1 -1
- package/dist/react.cjs +994 -183
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +75 -8
- package/dist/react.d.ts +75 -8
- package/dist/react.js +121 -40
- package/dist/react.js.map +1 -1
- package/dist/server.cjs +5 -3
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +8 -3
- package/dist/server.d.ts +8 -3
- package/dist/server.js +1 -1
- package/package.json +10 -9
- package/dist/chunk-EXRQJTXF.js +0 -910
- package/dist/chunk-EXRQJTXF.js.map +0 -1
- package/dist/chunk-QRXFL66W.js.map +0 -1
- package/dist/chunk-RIOHG5JH.js +0 -459
- package/dist/chunk-RIOHG5JH.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.6 (unreleased)
|
|
4
|
+
|
|
5
|
+
Wallet choice (RB, 5 Nov 2026: bWalletX is the default on our sites; no other wallet may take the sign-in flow). A fix: sites showed their own chooser even when only bWalletX was present, so users never saw the wallet sheet, and a wallet that held `window.CWI` was treated as bWalletX.
|
|
6
|
+
|
|
7
|
+
- **bWalletX is recognised by its own announcement only.** `discoverBwalletX()` / `findBwalletX()` / `connectBwalletX()` no longer take `window.CWI` as bWalletX "in-app": Metanet / BSV Desktop or Yours can set or overwrite it. bWalletX is the BRC-100 announcement with rdns `com.bwalletx.extension` (extension) or `space.bwallet.mobile` (in-app browser; every build since 3 Oct 2026 announces), or the bWalletX app frame over XDM. A bare `window.CWI` is listed by `discoverWallets()` as "Browser wallet" (`substrate: 'window.CWI'`) and is never bWalletX.
|
|
8
|
+
- **Fast path, on by default.** `decideWallet()` (new, pure) is the rule in `runConnect`, `BwalletXProvider.connect()` and `<bwalletx-signin>`: bWalletX here → straight to its sheet, no chooser, even with other wallets installed. Without it → the chooser, **Get bWalletX** first, then the detected wallets; another wallet is never connected unless picked (0.5.5 connected a lone Yours/Metanet with no picker). `picker: false` now means bWalletX, else the phone, else `NOT_FOUND`. `fastPath: false` restores the 0.5.5 rule.
|
|
9
|
+
- **"Other wallets"**: a small link under `<bwalletx-signin>` (lg/md by default; `other-wallets="on|off"`) and in its not-found row; `connect({ chooser: true })` in the provider; the element's `bwalletx-signin` event carries `mode: 'chooser'`.
|
|
10
|
+
- **`chooseWallet(list)`**: the new chooser (Get bWalletX first when absent; bWalletX the gold row when present; phone QR; other wallets tagged "Fewer features"; Desktop wallet; HandCash last; Esc / Cancel / backdrop close it). `pickWallet` is unchanged.
|
|
11
|
+
- **No localhost probe before a tap.** `desktopOption()` ("Desktop wallet") probes localhost:3321 / 3301 only when its `connect()` runs, after the user picked it. `probeLocal` stays off by default.
|
|
12
|
+
- **Telemetry hook**: `onAttempt` (provider prop / `runConnect` option) and the `bwalletx-attempt` event: `{ walletType, substrate, outcome, ms }` per attempt, nothing else.
|
|
13
|
+
- `WalletOption.substrate`, `walletTypeOf`, `substrateOf`, `isPresentBwalletX`, `hasBwalletX`, `otherDetected`; `discoverWallets` also finds bWalletX in its app frame (XDM). `useBwalletX().walletType`.
|
|
14
|
+
- Element: picking another wallet shows "Approve in your wallet…"; closing the phone QR returns to the button without an error.
|
|
15
|
+
- **`<bwalletx-button>`: no wallet calls on load.** It used to call `getPublicKey` on load when `bwx:connected` was set, and stored the identity key there. Now it does discovery only; `bwx:connected` is deleted on load (`dropLegacyConnectedKey`) and never written; a reload shows Connect, and one tap reconnects. New `session-url` shows the chip from your server's session with no wallet call.
|
|
16
|
+
|
|
17
|
+
## 0.5.5 (unreleased)
|
|
18
|
+
|
|
19
|
+
- **One wallet sheet to sign in** (owner escalation, 2 Nov 2026: "FIVE PROMPTS??? FOR ONE CONNECTION?" on vexvoid.com). Measured with bWalletX 5.2.48: 0.5.4 asked for a picker plus 3 sheets on localhost, and a picker plus 5 sheets on the live site. Now:
|
|
20
|
+
- `signInWithBwalletX` gets the challenge first, with no key, then sends `getPublicKey({ identityKey: true })` and `createSignature` together (`Promise.all`), so the wallet can show one sheet. `identityKey` reuses a key you already have (the signature alone).
|
|
21
|
+
- `BwalletXProvider.connect()` (and `useBwalletX().connect()`) no longer asks for the key before signing in: the old path asked for it twice (once to connect, once to sign in). Logic in `runConnect()`.
|
|
22
|
+
- **Repeat sign-in is the signature alone**: the key that signed in last is remembered on the site (`rememberedIdentity()`, public data, a hint only). If another account is active, verification fails once and the sign-in is retried with the key asked for (`signInAndVerify`).
|
|
23
|
+
- `waitForAuthentication` is only called when the wallet says it is locked (`waitIfLocked`): bWalletX answers every call by fetching the site's manifest.json and, when that asks for permissions, showing a separate sheet each time.
|
|
24
|
+
- **Picker**: bWalletX is listed once (`window.CWI` is the same extension it announced; `cwiIsAnnounced`). With one wallet in the browser there is no picker at all (`autoChoice`); phone pairing is then a fallback, not a choice.
|
|
25
|
+
- **Server**: `createChallenge({ identityKey })` makes the key optional; a keyless challenge binds the key the browser claims at `verifySignIn`, and the signature only verifies for that key. A challenge made with a key still only verifies for that key. **Upgrade the server too** for one sheet: against a 0.5.4 server the browser falls back to the old order by itself (two sheets), or set `challengeNeedsIdentityKey`.
|
|
26
|
+
- **The official element is stateful.** `<bwalletx-signin>` / `<BwalletxSignin>`: signed out → pending ("Approve in bWalletX…" with one line, "Sign in: shares only your public identity key, moves no money"; a body-level tip on `sm`/`icon`) → signed in (a badge: bAvatar, $handle from the paymail lookup or a short key, gold dot) with a menu (Copy paymail/key, Disconnect) → or an error line plus Retry ("Sign-in cancelled" for a no). The menu is a fixed, body-level portal (never clipped by `overflow:hidden`), keyboard operable, and fits a phone. Inside `<BwalletXProvider>` the element follows the provider (click → `connect()`, Disconnect → `disconnect()` → `logoutUrl`, reload restores from `sessionUrl` with no wallet prompt). Standalone: `session-url`, `logout-url`, `lookup-url`; `stateless` keeps the old plain button.
|
|
27
|
+
- **`useBwalletXAccount()`**: `{ status, identityKey, paymail, handle, label, avatarUrl, error, login, logout }` for sites with their own UI.
|
|
28
|
+
- **`<bwalletx-button>`: the one nav wallet control.** It renders Get bWalletX (deep-linked by platform), Connect bWalletX, or the $handle chip, by state, with the official button look. It guards against duplicates: a second instance and legacy controls in the same header/nav are hidden, with a console warning. Use only this element; don't add your own Get or Connect links.
|
|
29
|
+
- **`<bwalletx-signin label="get">` and `label="play"`**: "Get bWalletX" and "Play with bWalletX", the same official button for download and play-now calls to action (with `href` link mode). First users: terrornode.com and tokenblaster.lol.
|
|
30
|
+
|
|
3
31
|
## 0.5.4 (unreleased)
|
|
4
32
|
|
|
5
33
|
- **Connect is fast.** A wallet that is present now resolves at once: the extension answers `brc100:requestWallet` synchronously, and `window.CWI` (in-app browser) is taken straight away instead of after the wait. The wait for "nothing here" before the pairing QR drops from 1200 ms to 300 ms (`DEFAULT_DISCOVER_MS`); in a bWalletX frame the XDM probe now starts in parallel. `discoverWallets` stops waiting 50 ms after a wallet has announced. Measured in Chrome: pairing modal 1.24–1.34 s → 0.33–0.34 s after the click.
|
package/README.md
CHANGED
|
@@ -62,6 +62,10 @@ The cookie (`bwx_session`) is `HttpOnly; SameSite=Lax; Secure` (Secure when the
|
|
|
62
62
|
|
|
63
63
|
Create the nonce table once (a migration): `pgNonceTableSql()` returns the SQL.
|
|
64
64
|
|
|
65
|
+
**Hydration warning.** bWalletX for Chrome adds a `data-bwalletx-ext` attribute to `<html>` and `<body>` before React hydrates, so Next.js logs a harmless hydration mismatch. Put `suppressHydrationWarning` on both in `app/layout.tsx`: `<html lang="en" suppressHydrationWarning>` and `<body suppressHydrationWarning>`. It only silences attribute differences on those two elements, not in your components.
|
|
66
|
+
|
|
67
|
+
**One sheet needs the server too.** The client and the challenge route must both be 0.5.5 or newer: an older `createChallenge` refuses a challenge without an identity key, and the client then falls back to asking for the key first (two wallet sheets).
|
|
68
|
+
|
|
65
69
|
## React quick start
|
|
66
70
|
|
|
67
71
|
```tsx
|
|
@@ -95,7 +99,22 @@ function Account() {
|
|
|
95
99
|
|
|
96
100
|
`useBwalletX()` gives `status` (`idle | restoring | connecting | connected | error`), `identityKey`, `handle`, `paymail`, `wallet` (the BRC-100 `WalletInterface`), `walletId`, `signedIn`, `error`, `wallets`, `connect({ walletId? })`, `disconnect()`, `listWallets()`, `pay`, `tip` and `buyToken`.
|
|
97
101
|
|
|
98
|
-
`connect()` finds wallets
|
|
102
|
+
`connect()` finds wallets and signs in through your routes when `challengeUrl` and `verifyUrl` are set, with **one wallet sheet**: the challenge comes first (no key), then the identity key and the signature are asked for together, and a repeat sign-in on the same site is the signature alone. With bWalletX in the browser there is no chooser at all (0.5.6); without it the chooser opens with "Get bWalletX" first, and another wallet is used only when picked (see "Which wallet signs in"). Nothing touches `window` during render, so the provider is safe in server-rendered pages. After a reload the session comes back from `sessionUrl`, but `wallet` stays `null` until the user calls `connect()` again.
|
|
103
|
+
|
|
104
|
+
### Drop-in: provider + one element + 3 routes
|
|
105
|
+
|
|
106
|
+
The official element follows the provider, so one element gives the whole experience: **Sign in with bWalletX** → **Approve in bWalletX…** (with one line: "Sign in: shares only your public identity key, moves no money") → a signed-in badge (bAvatar, $handle or a short key, gold dot) whose menu has **Copy paymail/key** and **Disconnect**. A reload restores the badge from `sessionUrl` with no wallet prompt. A no in the wallet reads "Sign-in cancelled" with **Retry**.
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
<BwalletXProvider challengeUrl="/api/bwalletx/challenge" verifyUrl="/api/bwalletx/verify"
|
|
110
|
+
logoutUrl="/api/bwalletx/logout" sessionUrl="/api/bwalletx/session">
|
|
111
|
+
<BwalletxSignin size="sm" /> {/* in your header; that's all */}
|
|
112
|
+
</BwalletXProvider>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Your own UI instead: `const { status, identityKey, paymail, handle, label, avatarUrl, error, login, logout } = useBwalletXAccount();` (`status`: `restoring | signed-out | pending | signed-in | error`).
|
|
116
|
+
|
|
117
|
+
**Upgrade the server too.** The one-sheet order needs a challenge route that accepts no key: `createChallenge` / `createBwalletXAuth` from 0.5.5. Against an older server the browser sees the refusal and falls back to the old order (two sheets) by itself; `challengeNeedsIdentityKey` skips the attempt.
|
|
99
118
|
|
|
100
119
|
## Payments
|
|
101
120
|
|
|
@@ -133,12 +152,36 @@ Every expected output has to be matched by a different output that carries at le
|
|
|
133
152
|
`discoverWallets()` lists everything it can find, with bWalletX first:
|
|
134
153
|
|
|
135
154
|
- every wallet that announces itself through BRC-100 discovery (bWalletX, Yours, Metanet and others)
|
|
136
|
-
-
|
|
137
|
-
-
|
|
155
|
+
- bWalletX in its own app frame (XDM, only from bWalletX's origins)
|
|
156
|
+
- a `window.CWI` that nobody announced, under a neutral name ("Browser wallet"); it is never taken for bWalletX
|
|
157
|
+
- desktop wallets on localhost ports 3321 and 3301 (only with `probeLocal: true`; prefer `desktopOption()`, below)
|
|
138
158
|
- phone pairing (`pairing: pairingModal()`)
|
|
139
159
|
- any adapters you add in `extra`
|
|
140
160
|
|
|
141
|
-
`
|
|
161
|
+
`pairingModal()` returns `PairingOptions` that draw the QR code and match code, so you no longer need your own QR library. On phones and tablets it shows an **Open bWalletX** button (the pairing universal link opens the app) and a web.bwalletx.com fallback instead of a QR; pass `mode: 'qr'` or `'app'` to force one.
|
|
162
|
+
|
|
163
|
+
### Which wallet signs in (0.5.6)
|
|
164
|
+
|
|
165
|
+
bWalletX is the default on our sites, and no other wallet may take the sign-in flow:
|
|
166
|
+
|
|
167
|
+
1. **bWalletX is recognised by its own announcement** (`com.bwalletx.extension`, `space.bwallet.mobile`) or by the bWalletX app frame, never by who holds `window.CWI`. Metanet / BSV Desktop or Yours can set or overwrite `window.CWI`; `discoverBwalletX()` no longer takes it.
|
|
168
|
+
2. **bWalletX here → straight to its sheet.** No site chooser. A small **Other wallets** link under the button opens the chooser (phone QR, other browser wallets, desktop wallets).
|
|
169
|
+
3. **No bWalletX → the chooser, "Get bWalletX" first**, then what was detected. Another wallet is connected only when the user picks it, even when it is the only one.
|
|
170
|
+
4. **No localhost probe on load.** "Desktop wallet" in the chooser (`desktopOption()`) looks on localhost:3321 / 3301 only when tapped, so Chrome's Local Network Access prompt follows a tap.
|
|
171
|
+
|
|
172
|
+
`decideWallet(list, { chooser, picker, walletId, fastPath })` is the rule as a pure function; `runConnect`, `BwalletXProvider` and `<bwalletx-signin>` all use it. `chooseWallet(list)` is the chooser UI (`pickWallet` is the 0.5.5 one, still exported). If your site has its own chooser, call `decideWallet` first and show yours only when it answers `{ reason: 'chooser' }`:
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
import { discoverWallets, decideWallet, chooseWallet, pairingModal } from '@bwalletx/connect';
|
|
176
|
+
|
|
177
|
+
const list = await discoverWallets({ pairing: () => pairingModal() });
|
|
178
|
+
const { option, reason } = decideWallet(list); // bWalletX here → option, no chooser
|
|
179
|
+
const chosen = option ?? (reason === 'chooser' ? await chooseWallet(list) : null);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
`BwalletXProvider fastPath={false}` (or `runConnect({ fastPath: false })`) restores the 0.5.5 picker rule. `connect({ chooser: true })` is the "Other wallets" link. `<bwalletx-signin other-wallets="auto|on|off">` controls the link (auto: shown at lg/md when the element signs in).
|
|
183
|
+
|
|
184
|
+
**Telemetry.** `onAttempt` (provider prop, `runConnect` option) and the element's `bwalletx-attempt` event report one record per attempt: `{ walletType, substrate, outcome, ms }`. `walletType` is `'bwalletx'` or the other wallet's rdns / option id; `substrate` is how it reached the page (`extension`, `in-app`, `xdm`, `injected`, `window.CWI`, `json-api`, `cicada`, `pairing`, `adapter`); `outcome` is `signed-in`, `connected`, `cancelled`, `rejected`, `not-found` or `error`. No keys, addresses or identity data.
|
|
142
185
|
|
|
143
186
|
## Migrating from HandCash Connect
|
|
144
187
|
|
|
@@ -156,6 +199,25 @@ Every expected output has to be matched by a different output that carries at le
|
|
|
156
199
|
3. Replace HandCash payment calls with `pay` / `tip` / `buyToken`, and check them on the server with `verifyPayment` instead of HandCash payment webhooks.
|
|
157
200
|
4. Remove the adapter when your users have moved over.
|
|
158
201
|
|
|
202
|
+
## The nav wallet control: use only `<bwalletx-button>`
|
|
203
|
+
|
|
204
|
+
**Use only this element for your site's wallet control. Don't add your own "Get bWalletX" or "Connect" links or buttons next to it.** It renders exactly one thing by state:
|
|
205
|
+
|
|
206
|
+
| State | Shows |
|
|
207
|
+
|---|---|
|
|
208
|
+
| No wallet in this browser | **Get bWalletX** (a link: bwalletx.com/extension on desktop Chrome, /iphone, /android, else /get) |
|
|
209
|
+
| A wallet here, not connected | **Connect bWalletX** (extension, in-app browser, or a QR to the phone app) |
|
|
210
|
+
| Connected | The **$handle chip** (click to disconnect) |
|
|
211
|
+
|
|
212
|
+
```html
|
|
213
|
+
<script src="https://cdn.jsdelivr.net/npm/@bwalletx/connect/dist/bwalletx-connect.global.js"></script>
|
|
214
|
+
<header>… <bwalletx-button></bwalletx-button></header>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Or `import '@bwalletx/connect/element'`. Attributes: `size` (sm, md, lg), `get-url`, `discover-ms`, `lookup-url`. Events: `bwalletx-connected` `{ identityKey }` and `bwalletx-disconnected`.
|
|
218
|
+
|
|
219
|
+
**Guard:** there is one per page. A second `<bwalletx-button>` hides itself. Legacy controls inside the same `<header>`/`<nav>` (`[data-bwx-connect]`, `.nav-connect`, `.nav-acct`, links to bwalletx.com/get) are hidden too. Each one hidden logs a console warning. Links in your page content are left alone.
|
|
220
|
+
|
|
159
221
|
## The button
|
|
160
222
|
|
|
161
223
|
`<bwalletx-signin>` is the standard "Sign in with bWalletX" button: a web component with no dependencies (Shadow DOM), plus a React wrapper. It is the gold button from bit-sign's sign-in card.
|
|
@@ -184,12 +246,18 @@ import { BwalletxSignin } from '@bwalletx/connect/react';
|
|
|
184
246
|
| `brand` | `bWalletX` (default), `bWallet` (store edition) |
|
|
185
247
|
| `subtitle` | `on`, `off`, or your own text. Default "also works with bWallet" on lg/md |
|
|
186
248
|
| `full-width`, `loading`, `disabled` | flags |
|
|
187
|
-
| `challenge-url`, `verify-url` | run the sign-in flow on click: POST `{ identityKey }
|
|
249
|
+
| `challenge-url`, `verify-url` | run the sign-in flow on click: POST `{}` (one sheet; `{ identityKey }` on a repeat sign-in), then POST `{ identityKey, nonce, signature }` |
|
|
250
|
+
| `session-url`, `logout-url` | restore the signed-in badge on load (no wallet prompt); POST on Disconnect |
|
|
251
|
+
| `lookup-url` | paymail lookup for the badge (default pay.bwallet.space; `off`) |
|
|
252
|
+
| `stateless` | the pre-0.5.5 plain button: no badge, no pending/error states |
|
|
253
|
+
| `state` (+ `identity-key`, `paymail`, `handle`, `avatar-url`, `error`) | drive the states yourself; `<BwalletxSignin>` inside `<BwalletXProvider>` does this for you |
|
|
188
254
|
| `get-url`, `web-url` | where "Get bWalletX" and the web wallet link go (bwalletx.com/get, web.bwalletx.com) |
|
|
189
255
|
| `href` | navigate on click instead |
|
|
190
256
|
| `authorize-url`, `client-id`, `redirect-uri`, `scope` | OAuth 2.1 redirect with S256 PKCE (verifier, state and nonce in `sessionStorage["bwalletx:oauth"]`). For auth.bwalletx.com, which is planned and not live yet |
|
|
191
257
|
|
|
192
|
-
Events (bubbling, composed): `bwalletx-signin` on every click (call `preventDefault()` to run your own flow instead), `bwalletx-signed-in` with `{ identityKey, method, nonce, signature, response }`, `bwalletx-not-found` (the button then shows "Get bWalletX" and a web wallet link), `bwalletx-error` with `{ error }`.
|
|
258
|
+
Events (bubbling, composed): `bwalletx-signin` on every click (call `preventDefault()` to run your own flow instead), `bwalletx-signed-in` with `{ identityKey, method, nonce, signature, response }`, `bwalletx-not-found` (the button then shows "Get bWalletX" and a web wallet link), `bwalletx-error` with `{ error }`, `bwalletx-disconnect` (cancelable; Disconnect in the badge menu) and `bwalletx-signed-out`.
|
|
259
|
+
|
|
260
|
+
States: signed out → pending ("Approve in bWalletX…" plus one plain line) → signed in (the badge; its menu is a body-level portal, so an `overflow:hidden` header never clips it, and it is keyboard operable: Enter/↓ opens, arrows move, Esc closes) or error (one line plus Retry).
|
|
193
261
|
|
|
194
262
|
Without `challenge-url`, `href` or `authorize-url` the button only fires `bwalletx-signin`. The built-in flow uses the extension or in-app browser only. For phone pairing, listen for `bwalletx-signin`, call `preventDefault()`, and call `signInWithBwalletX` with `pairing` as shown above.
|
|
195
263
|
|
|
@@ -203,7 +271,7 @@ import { createChallenge, verifySignIn, originAllowed, memoryStore } from '@bwal
|
|
|
203
271
|
const ORIGIN = 'https://example.com'; // your site, from config. Never from the request.
|
|
204
272
|
const store = memoryStore(); // dev only. See "Nonce store" below.
|
|
205
273
|
|
|
206
|
-
// POST /auth/bwalletx/challenge body: { identityKey }
|
|
274
|
+
// POST /auth/bwalletx/challenge body: {} (or { identityKey })
|
|
207
275
|
app.post('/auth/bwalletx/challenge', async (req, res) => {
|
|
208
276
|
if (!originAllowed(req.get('origin'), ORIGIN)) return res.status(403).end();
|
|
209
277
|
try {
|
|
@@ -223,7 +291,7 @@ app.post('/auth/bwalletx/verify', async (req, res) => {
|
|
|
223
291
|
});
|
|
224
292
|
```
|
|
225
293
|
|
|
226
|
-
`verifySignIn` returns the identity key (66 lowercase hex characters) or `null`. It refuses a nonce that was already used, has expired (2 minutes), was issued for another origin or another identity key, or whose signature doesn't verify.
|
|
294
|
+
`verifySignIn` returns the identity key (66 lowercase hex characters) or `null`. It refuses a nonce that was already used, has expired (2 minutes), was issued for another origin or another identity key, or whose signature doesn't verify. Since 0.5.5 `identityKey` is optional in `createChallenge`: a challenge made without one binds the key the browser claims at verify, and the signature only verifies for that key. That lets the browser ask the wallet for the key and the signature in one sheet.
|
|
227
295
|
|
|
228
296
|
The text the wallet signs:
|
|
229
297
|
|