@bwalletx/connect 0.0.0-stage → 0.2.0
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/BRAND.md +68 -0
- package/LICENSE +21 -0
- package/README.md +214 -2
- package/TRADEMARKS.md +9 -0
- package/assets/bwalletx-mark-circle.svg +1 -0
- package/assets/bwalletx-mark.svg +1 -0
- package/assets/signin-dark.svg +8 -0
- package/assets/signin-gold.svg +8 -0
- package/assets/signin-light.svg +8 -0
- package/assets/snippet.html +17 -0
- package/dist/bwalletx-connect.global.js +54 -0
- package/dist/bwalletx-connect.global.js.map +1 -0
- package/dist/chunk-NNMUSWPG.js +649 -0
- package/dist/chunk-NNMUSWPG.js.map +1 -0
- package/dist/element.cjs +665 -0
- package/dist/element.cjs.map +1 -0
- package/dist/element.d.cts +29 -0
- package/dist/element.d.ts +29 -0
- package/dist/element.js +24 -0
- package/dist/element.js.map +1 -0
- package/dist/index.cjs +742 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +149 -0
- package/dist/index.d.ts +149 -0
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +700 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +70 -0
- package/dist/react.d.ts +70 -0
- package/dist/react.js +59 -0
- package/dist/react.js.map +1 -0
- package/dist/server.cjs +150 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +64 -0
- package/dist/server.d.ts +64 -0
- package/dist/server.js +118 -0
- package/dist/server.js.map +1 -0
- package/package.json +117 -4
package/BRAND.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Sign in with bWalletX: brand guidelines
|
|
2
|
+
|
|
3
|
+
The standard button is the gold one from bit-sign's sign-in card. Use `<bwalletx-signin>` (or the React wrapper) and you get it right by default. These rules are for when you place it, size it, or draw your own.
|
|
4
|
+
|
|
5
|
+
## Variants and where to use them
|
|
6
|
+
|
|
7
|
+
| Variant | Use it for |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `theme="gold"` (default) | The main way in. Sign-in pages, the first button in a list of sign-in options. |
|
|
10
|
+
| `theme="dark"` | Dark UIs where gold would compete with your own primary button, or a secondary row of sign-in options. |
|
|
11
|
+
| `theme="light"` | Light pages, and lists of outlined "Continue with …" buttons beside Google, Apple and so on. |
|
|
12
|
+
| `size="lg"` (default) | Sign-in cards and landing pages. Shows the subtitle. |
|
|
13
|
+
| `size="md"` | Dialogs and narrow cards. Shows the subtitle. |
|
|
14
|
+
| `size="sm"` | Navigation bars and toolbars. No subtitle. |
|
|
15
|
+
| `size="icon"` | Only where space is very tight and the context already says "sign in" (a row of provider icons). Always keep the aria-label. |
|
|
16
|
+
| `label="signin"` / `"continue"` / `"connect"` | "Sign in with" on sign-in pages, "Continue with" in mixed provider lists and onboarding, "Connect" when the user is already signed in and is linking a wallet. |
|
|
17
|
+
| `brand="bWallet"` | Store builds and pages shown inside the App Store / Play edition. Drops the subtitle. |
|
|
18
|
+
|
|
19
|
+
## Do
|
|
20
|
+
|
|
21
|
+
- Keep the black circle with the gold "b" on the left of the text.
|
|
22
|
+
- Keep the text exactly as given ("Sign in with bWalletX", "Continue with bWalletX", "Connect bWalletX"). Translations are fine.
|
|
23
|
+
- Give the gold button the most prominent position when bWalletX is your main sign-in.
|
|
24
|
+
- Keep the subtitle "also works with bWallet" on lg and md, so store users know the button is for them.
|
|
25
|
+
- Make it the same height as the other sign-in buttons next to it.
|
|
26
|
+
|
|
27
|
+
## Don't
|
|
28
|
+
|
|
29
|
+
- Don't recolour the gold, change the gradient direction, or put the mark on a coloured circle.
|
|
30
|
+
- Don't stretch, rotate, outline or add effects to the mark.
|
|
31
|
+
- Don't use the "b" mark alone as a generic Bitcoin or wallet icon.
|
|
32
|
+
- Don't write "BWalletX", "bwalletx", "B Wallet X" or "bWallet X" in the button.
|
|
33
|
+
- Don't make the bWalletX button smaller or less visible than other providers' buttons in the same list.
|
|
34
|
+
- Don't imply that bWalletX endorses your product.
|
|
35
|
+
|
|
36
|
+
## Minimum sizes
|
|
37
|
+
|
|
38
|
+
| | Minimum |
|
|
39
|
+
|---|---|
|
|
40
|
+
| Button height | 36px (`sm`). 48px or more on touch screens (`md`, `lg`, `icon`). |
|
|
41
|
+
| Icon-only button | 40px across. 48px recommended. |
|
|
42
|
+
| Mark on its own | 16px tall on screen, 6mm in print. |
|
|
43
|
+
| Label text | 13px. Subtitle 10.5px, and only on `md` and `lg`. |
|
|
44
|
+
|
|
45
|
+
## Clear space
|
|
46
|
+
|
|
47
|
+
Leave space around the button equal to half its height (at least 8px) free of other text and logos. Around the mark on its own, leave the width of the mark's bowl (about a third of the mark's height).
|
|
48
|
+
|
|
49
|
+
## Colours
|
|
50
|
+
|
|
51
|
+
| Token | Value |
|
|
52
|
+
|---|---|
|
|
53
|
+
| Gold gradient top / bottom | `#fcd34d` → `#f59e0b` (hover `#fde68a` → `#fbbf24`) |
|
|
54
|
+
| Mark gradient | `#FFE58A` → `#FFD24D` (55%) → `#C98F00` |
|
|
55
|
+
| Mark circle | `#000000` |
|
|
56
|
+
| Label on gold | `#000000`, subtitle `rgba(0,0,0,.65)` |
|
|
57
|
+
| Corner radius | 12px (lg), 10px (md), 8px (sm), round (icon) |
|
|
58
|
+
| Shadow (gold) | `0 10px 15px -3px rgba(245,158,11,.2), 0 4px 6px -4px rgba(245,158,11,.2)` |
|
|
59
|
+
|
|
60
|
+
Black on the gold gradient is above 9:1, and the subtitle stays above 4.5:1 (WCAG AA) at every point of the gradient.
|
|
61
|
+
|
|
62
|
+
## Files
|
|
63
|
+
|
|
64
|
+
`assets/` has the mark (`bwalletx-mark.svg`, `bwalletx-mark-circle.svg`), full buttons (`signin-gold.svg`, `signin-dark.svg`, `signin-light.svg`) and a no-JavaScript HTML/CSS version (`snippet.html`).
|
|
65
|
+
|
|
66
|
+
## Trademarks
|
|
67
|
+
|
|
68
|
+
The code in this package is MIT. The names bWalletX and bWallet, and the "b" mark, are not covered by that licence. See [TRADEMARKS.md](./TRADEMARKS.md).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 The Bitcoin Corporation Ltd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,215 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @bwalletx/connect
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Add "Sign in with bWalletX" to a website.
|
|
4
|
+
|
|
5
|
+
The user's wallet signs a one-time challenge from your server with a key derived from its identity key. Your server checks the signature and signs the user in as that identity key. You don't need an API key or an account with us, and nothing passes through bwalletx.com. The only service of ours involved is the encrypted pairing relay (`relay.bwallet.space`), and only when the user signs in from a phone or the web wallet.
|
|
6
|
+
|
|
7
|
+
The full protocol is described at https://bwalletx.com/connect.md. This package is the same code, packaged.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add @bwalletx/connect @bsv/sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`@bsv/sdk` (2.2 or later, 2.x or 3.x) is a peer dependency.
|
|
16
|
+
|
|
17
|
+
## The button
|
|
18
|
+
|
|
19
|
+
`<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.
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<script src="https://unpkg.com/@bwalletx/connect@0.2.0"></script>
|
|
23
|
+
<bwalletx-signin challenge-url="/auth/bwalletx/challenge" verify-url="/auth/bwalletx/verify"></bwalletx-signin>
|
|
24
|
+
<script>
|
|
25
|
+
document.addEventListener('bwalletx-signed-in', (e) => location.assign('/'));
|
|
26
|
+
</script>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
With a bundler: `import '@bwalletx/connect/element'` registers the element. In React:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { BwalletxSignin } from '@bwalletx/connect/react';
|
|
33
|
+
|
|
34
|
+
<BwalletxSignin challengeUrl="/auth/bwalletx/challenge" verifyUrl="/auth/bwalletx/verify" onSignedIn={(d) => console.log(d.identityKey)} />
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
| Attribute | Values |
|
|
38
|
+
|---|---|
|
|
39
|
+
| `size` | `lg` (default), `md`, `sm`, `icon` |
|
|
40
|
+
| `theme` | `gold` (default), `dark`, `light` |
|
|
41
|
+
| `label` | `signin` (default), `continue`, `connect` |
|
|
42
|
+
| `brand` | `bWalletX` (default), `bWallet` (store edition) |
|
|
43
|
+
| `subtitle` | `on`, `off`, or your own text. Default "also works with bWallet" on lg/md |
|
|
44
|
+
| `full-width`, `loading`, `disabled` | flags |
|
|
45
|
+
| `challenge-url`, `verify-url` | run the sign-in flow on click: POST `{ identityKey }`, then POST `{ identityKey, nonce, signature }` |
|
|
46
|
+
| `get-url`, `web-url` | where "Get bWalletX" and the web wallet link go (bwalletx.com/get, web.bwalletx.com) |
|
|
47
|
+
| `href` | navigate on click instead |
|
|
48
|
+
| `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 |
|
|
49
|
+
|
|
50
|
+
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 }`.
|
|
51
|
+
|
|
52
|
+
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.
|
|
53
|
+
|
|
54
|
+
SVG files, and an HTML/CSS version with no JavaScript, are in `assets/`. All variants: `examples/buttons.html`. Placement, sizes and do/don't: [BRAND.md](./BRAND.md). The names and logo are not MIT licensed: [TRADEMARKS.md](./TRADEMARKS.md).
|
|
55
|
+
|
|
56
|
+
## Server
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { createChallenge, verifySignIn, originAllowed, memoryStore } from '@bwalletx/connect/server';
|
|
60
|
+
|
|
61
|
+
const ORIGIN = 'https://example.com'; // your site, from config. Never from the request.
|
|
62
|
+
const store = memoryStore(); // dev only. See "Nonce store" below.
|
|
63
|
+
|
|
64
|
+
// POST /auth/bwalletx/challenge body: { identityKey }
|
|
65
|
+
app.post('/auth/bwalletx/challenge', async (req, res) => {
|
|
66
|
+
if (!originAllowed(req.get('origin'), ORIGIN)) return res.status(403).end();
|
|
67
|
+
try {
|
|
68
|
+
res.json(await createChallenge({ origin: ORIGIN, identityKey: req.body?.identityKey, store }));
|
|
69
|
+
} catch (e) {
|
|
70
|
+
res.status(400).json({ error: (e as Error).message });
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// POST /auth/bwalletx/verify body: { identityKey, nonce, signature }
|
|
75
|
+
app.post('/auth/bwalletx/verify', async (req, res) => {
|
|
76
|
+
if (!originAllowed(req.get('origin'), ORIGIN)) return res.status(403).end();
|
|
77
|
+
const identityKey = await verifySignIn({ origin: ORIGIN, store, ...req.body });
|
|
78
|
+
if (!identityKey) return res.status(401).json({ error: 'That signature was not accepted. Start again.' });
|
|
79
|
+
// Find or create the user keyed on identityKey, then start your own session.
|
|
80
|
+
res.json({ identityKey });
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`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.
|
|
85
|
+
|
|
86
|
+
The text the wallet signs:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
Sign in to example.com with bWallet
|
|
90
|
+
|
|
91
|
+
This proves you hold this wallet. It does not spend anything.
|
|
92
|
+
|
|
93
|
+
Origin: https://example.com
|
|
94
|
+
Nonce: <nonce>
|
|
95
|
+
Expires: <ISO time>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
It is signed with BRC-100 `createSignature`, protocol `[2, 'bwallet sign in']`, keyID = the nonce, counterparty `'anyone'`. bChat and bit-sign use the same format.
|
|
99
|
+
|
|
100
|
+
### Nonce store
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
interface NonceStore {
|
|
104
|
+
put(nonce: string, c: PendingChallenge): Promise<void> | void;
|
|
105
|
+
take(nonce: string): Promise<PendingChallenge | null> | PendingChallenge | null; // read AND delete
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`take` must read and delete in one step. `verifySignIn` calls it before checking anything else, so each nonce gets exactly one attempt.
|
|
110
|
+
|
|
111
|
+
`memoryStore()` keeps challenges in the process. It is lost on restart and isn't shared between processes or serverless instances, so it prints a warning the first time it is used. If you leave out `store`, a shared in-memory store is used and you get the same warning. In production, use Redis (`GETDEL`) or a database row you delete with `DELETE ... RETURNING`.
|
|
112
|
+
|
|
113
|
+
Also rate-limit the challenge route per IP. It is unauthenticated.
|
|
114
|
+
|
|
115
|
+
## Browser
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import { signInWithBwalletX, renderButton } from '@bwalletx/connect';
|
|
119
|
+
import QRCode from 'qrcode'; // any QR library
|
|
120
|
+
|
|
121
|
+
const panel = document.getElementById('bwx-pair')!;
|
|
122
|
+
|
|
123
|
+
renderButton('#bwx-button', {
|
|
124
|
+
onClick: async (button) => {
|
|
125
|
+
button.disabled = true;
|
|
126
|
+
try {
|
|
127
|
+
const r = await signInWithBwalletX({
|
|
128
|
+
challenge: (identityKey) => post('/auth/bwalletx/challenge', { identityKey }),
|
|
129
|
+
pairing: {
|
|
130
|
+
onLink: async (link) => {
|
|
131
|
+
panel.innerHTML = `<img src="${await QRCode.toDataURL(link)}" alt="Scan with bWalletX">`;
|
|
132
|
+
},
|
|
133
|
+
onCode: (code) => panel.append(`Check bWalletX shows ${code}, then tap Connect.`),
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
await post('/auth/bwalletx/verify', { identityKey: r.identityKey, nonce: r.nonce, signature: r.signature });
|
|
137
|
+
// r.method is 'extension', 'in-app' or 'pairing'
|
|
138
|
+
} finally {
|
|
139
|
+
button.disabled = false;
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
async function post(url: string, body: unknown) {
|
|
145
|
+
const res = await fetch(url, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) });
|
|
146
|
+
if (!res.ok) throw new Error((await res.json().catch(() => ({}))).error ?? `HTTP ${res.status}`);
|
|
147
|
+
return res.json();
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`signInWithBwalletX` finds a wallet in this order:
|
|
152
|
+
|
|
153
|
+
1. The bWalletX Chrome extension: BRC-100 discovery, `rdns` `com.bwalletx.extension`. Gives `method: 'extension'`.
|
|
154
|
+
2. The bWalletX app's in-app browser: `rdns` `space.bwallet.mobile`, or `window.CWI` if nothing announced. Gives `method: 'in-app'`. Note that `window.CWI` can also be set by another wallet.
|
|
155
|
+
3. A pairing stored by an earlier sign-in on this browser (`reusePairing`, default on).
|
|
156
|
+
4. A new pairing, if you passed `pairing`. Show the link as a QR code for the phone, and as text the user can paste into web.bwalletx.com. Both screens show the same 4-digit code. Gives `method: 'pairing'`.
|
|
157
|
+
|
|
158
|
+
If none of these works, it throws an error with `code: 'NOT_FOUND'`.
|
|
159
|
+
|
|
160
|
+
It returns `{ identityKey, signature, nonce, method, wallet }`. Post the first three to your verify route. `wallet` is a BRC-100 `WalletInterface` you can keep using.
|
|
161
|
+
|
|
162
|
+
### Lower-level pieces
|
|
163
|
+
|
|
164
|
+
| Export | What it does |
|
|
165
|
+
|---|---|
|
|
166
|
+
| `findBwalletX(ms?)` | The extension or in-app wallet, or `null`. |
|
|
167
|
+
| `discoverBwalletX(ms?)` | The same, plus `method` and `rdns`. |
|
|
168
|
+
| `pairBwalletX({ onLink, onCode, storage?, signal?, socket?, origin?, relay? })` | Pair over the relay. Resolves with a wallet when the user taps Connect. |
|
|
169
|
+
| `restorePairing({ storage? })` | The wallet from a stored pairing, or `null`. It connects on the first call. |
|
|
170
|
+
| `clearPairing()` | Delete the stored pairing without telling the wallet. |
|
|
171
|
+
| `wallet.close()` / `wallet.forget()` | On a paired wallet: close the socket, or unpair and delete it. |
|
|
172
|
+
| `connectBwalletX(opts)` | The wallet-finding half of `signInWithBwalletX`. |
|
|
173
|
+
| `renderButton(el, { onClick?, subtitle? })` | Draws the gold button into `el`. |
|
|
174
|
+
| `inOrder(handler)` | Wraps an async WebSocket handler so frames run one at a time, in order. |
|
|
175
|
+
|
|
176
|
+
### Pairing storage
|
|
177
|
+
|
|
178
|
+
The pairing is saved under `bwalletx.connect.pairing.v1` in `localStorage` by default. It holds a random pairing key (not a wallet key), the wallet's pairing public key, the channel, and the message counters. To store it elsewhere, pass `storage` (anything with `getItem`, `setItem` and `removeItem`, sync or async). Pass `storage: null` to keep it in memory only.
|
|
179
|
+
|
|
180
|
+
### Frame order
|
|
181
|
+
|
|
182
|
+
The phone sends a plain `hello` and then, as soon as the user taps Connect, an encrypted `ready`. An async `onmessage` handler that is still deriving the key from `hello` when `ready` arrives drops `ready`, and pairing never finishes. This package handles frames one at a time in arrival order (`inOrder`). `test/pair.test.ts` reproduces the race.
|
|
183
|
+
|
|
184
|
+
## One script tag
|
|
185
|
+
|
|
186
|
+
```html
|
|
187
|
+
<script src="https://unpkg.com/@bwalletx/connect/dist/bwalletx-connect.global.js"></script>
|
|
188
|
+
<script>
|
|
189
|
+
const { signInWithBwalletX, renderButton } = window.bWalletXConnect;
|
|
190
|
+
</script>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
This build includes `@bsv/sdk` (about 125 KB minified). The server functions are not in it.
|
|
194
|
+
|
|
195
|
+
## Limits
|
|
196
|
+
|
|
197
|
+
- You get the identity key and nothing else: no handle, paymail or name.
|
|
198
|
+
- The identity key is the same on every site that uses this method, so two sites can tell it is the same wallet.
|
|
199
|
+
- `relay.bwallet.space` is run by The Bitcoin Corporation. It has no published uptime guarantee and allows about 60 frames a minute per channel.
|
|
200
|
+
- There is no hosted sign-in page or OAuth-style redirect. You run the two routes yourself.
|
|
201
|
+
|
|
202
|
+
## Testing
|
|
203
|
+
|
|
204
|
+
```sh
|
|
205
|
+
pnpm test # unit tests: challenge/verify, frame order, reload, sign-in paths
|
|
206
|
+
pnpm test:live # pairs with a simulated phone over the real relay.bwallet.space
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
To test your own server without a wallet, sign with `new ProtoWallet(PrivateKey.fromRandom()).createSignature(...)` using the same arguments. That is the signature bWalletX makes.
|
|
210
|
+
|
|
211
|
+
`src/protocol.ts` is copied unchanged from bWalletX `src/pair/protocol.ts`. Don't edit it; the app must understand every byte.
|
|
212
|
+
|
|
213
|
+
## License
|
|
214
|
+
|
|
215
|
+
MIT
|
package/TRADEMARKS.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Trademarks
|
|
2
|
+
|
|
3
|
+
bWalletX, bWallet and the gold "b" mark are trademarks of The Bitcoin Corporation Ltd. The MIT licence in [LICENSE](./LICENSE) covers the code in this package. It does not grant any right to the names or the logo.
|
|
4
|
+
|
|
5
|
+
You may use the names and the mark, unchanged, to let your users sign in with bWalletX or bWallet: the button in this package, the SVG files in `assets/`, and text such as "Sign in with bWalletX". Follow [BRAND.md](./BRAND.md) when you do.
|
|
6
|
+
|
|
7
|
+
You may not use them in your own product, company or domain name, in a way that suggests bWalletX sponsors or endorses you, or in a changed form.
|
|
8
|
+
|
|
9
|
+
Questions: https://bwalletx.com
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" role="img" aria-label="bWalletX"><defs><linearGradient id="g" gradientUnits="userSpaceOnUse" x1="0" y1="12" x2="0" y2="105"><stop offset="0" stop-color="#FFE58A"/><stop offset=".55" stop-color="#FFD24D"/><stop offset="1" stop-color="#C98F00"/></linearGradient><mask id="h"><rect width="140" height="140" fill="#fff"/><circle cx="60" cy="72" r="15" fill="#000"/></mask></defs><circle cx="60" cy="60" r="60" fill="#000"/><g transform="translate(60 60) scale(.62) translate(-60 -58)"><g fill="url(#g)" mask="url(#h)"><polygon points="45,12 45,76 27,76 27,30"/><circle cx="60" cy="72" r="33"/></g></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="23 8 74 100" role="img" aria-label="bWalletX"><defs><linearGradient id="g" gradientUnits="userSpaceOnUse" x1="0" y1="12" x2="0" y2="105"><stop offset="0" stop-color="#FFE58A"/><stop offset=".55" stop-color="#FFD24D"/><stop offset="1" stop-color="#C98F00"/></linearGradient><mask id="h"><rect width="140" height="140" fill="#fff"/><circle cx="60" cy="72" r="15" fill="#000"/></mask></defs><g fill="url(#g)" mask="url(#h)"><polygon points="45,12 45,76 27,76 27,30"/><circle cx="60" cy="72" r="33"/></g></svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="260" height="60" viewBox="0 0 260 60" role="img" aria-label="Sign in with bWalletX, also works with bWallet">
|
|
2
|
+
<defs><linearGradient id="g" gradientUnits="userSpaceOnUse" x1="0" y1="12" x2="0" y2="105"><stop offset="0" stop-color="#FFE58A"/><stop offset=".55" stop-color="#FFD24D"/><stop offset="1" stop-color="#C98F00"/></linearGradient><mask id="h"><rect width="140" height="140" fill="#fff"/><circle cx="60" cy="72" r="15" fill="#000"/></mask><linearGradient id="bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fcd34d"/><stop offset="1" stop-color="#f59e0b"/></linearGradient></defs>
|
|
3
|
+
<rect x="1" y=".5" width="252" height="59" rx="12" fill="#0a0a0a" stroke="#3f3f46" stroke-width="1"/>
|
|
4
|
+
<circle cx="38" cy="30" r="14" fill="#000"/>
|
|
5
|
+
<g transform="translate(38 30) scale(.2) translate(-60 -58)"><g fill="url(#g)" mask="url(#h)"><polygon points="45,12 45,76 27,76 27,30"/><circle cx="60" cy="72" r="33"/></g></g>
|
|
6
|
+
<text x="64" y="28" font-family="Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif" font-size="16" font-weight="700" fill="#fafafa">Sign in with bWalletX</text>
|
|
7
|
+
<text x="64" y="42" font-family="Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif" font-size="11" font-weight="500" fill="rgba(255,255,255,.65)">also works with bWallet</text>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="260" height="60" viewBox="0 0 260 60" role="img" aria-label="Sign in with bWalletX, also works with bWallet">
|
|
2
|
+
<defs><linearGradient id="g" gradientUnits="userSpaceOnUse" x1="0" y1="12" x2="0" y2="105"><stop offset="0" stop-color="#FFE58A"/><stop offset=".55" stop-color="#FFD24D"/><stop offset="1" stop-color="#C98F00"/></linearGradient><mask id="h"><rect width="140" height="140" fill="#fff"/><circle cx="60" cy="72" r="15" fill="#000"/></mask><linearGradient id="bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fcd34d"/><stop offset="1" stop-color="#f59e0b"/></linearGradient></defs>
|
|
3
|
+
<rect x="0" y=".5" width="252" height="59" rx="12" fill="url(#bg)" stroke="none" stroke-width="0"/>
|
|
4
|
+
<circle cx="38" cy="30" r="14" fill="#000"/>
|
|
5
|
+
<g transform="translate(38 30) scale(.2) translate(-60 -58)"><g fill="url(#g)" mask="url(#h)"><polygon points="45,12 45,76 27,76 27,30"/><circle cx="60" cy="72" r="33"/></g></g>
|
|
6
|
+
<text x="64" y="28" font-family="Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif" font-size="16" font-weight="700" fill="#000">Sign in with bWalletX</text>
|
|
7
|
+
<text x="64" y="42" font-family="Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif" font-size="11" font-weight="500" fill="rgba(0,0,0,.65)">also works with bWallet</text>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="260" height="60" viewBox="0 0 260 60" role="img" aria-label="Sign in with bWalletX, also works with bWallet">
|
|
2
|
+
<defs><linearGradient id="g" gradientUnits="userSpaceOnUse" x1="0" y1="12" x2="0" y2="105"><stop offset="0" stop-color="#FFE58A"/><stop offset=".55" stop-color="#FFD24D"/><stop offset="1" stop-color="#C98F00"/></linearGradient><mask id="h"><rect width="140" height="140" fill="#fff"/><circle cx="60" cy="72" r="15" fill="#000"/></mask><linearGradient id="bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fcd34d"/><stop offset="1" stop-color="#f59e0b"/></linearGradient></defs>
|
|
3
|
+
<rect x="1" y=".5" width="252" height="59" rx="12" fill="#ffffff" stroke="#d4d4d8" stroke-width="1"/>
|
|
4
|
+
<circle cx="38" cy="30" r="14" fill="#000"/>
|
|
5
|
+
<g transform="translate(38 30) scale(.2) translate(-60 -58)"><g fill="url(#g)" mask="url(#h)"><polygon points="45,12 45,76 27,76 27,30"/><circle cx="60" cy="72" r="33"/></g></g>
|
|
6
|
+
<text x="64" y="28" font-family="Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif" font-size="16" font-weight="700" fill="#09090b">Sign in with bWalletX</text>
|
|
7
|
+
<text x="64" y="42" font-family="Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif" font-size="11" font-weight="500" fill="#52525b">also works with bWallet</text>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- "Sign in with bWalletX" without JavaScript or a build step. Gold, large. Wire the click yourself. -->
|
|
2
|
+
<style>
|
|
3
|
+
.bwx-btn{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;gap:12px;padding:16px 20px;border-radius:12px;cursor:pointer;
|
|
4
|
+
background:linear-gradient(180deg,#fcd34d,#f59e0b);color:#000;font:700 16px/1.2 Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
|
|
5
|
+
box-shadow:0 10px 15px -3px rgba(245,158,11,.2),0 4px 6px -4px rgba(245,158,11,.2)}
|
|
6
|
+
.bwx-btn:hover{background:linear-gradient(180deg,#fde68a,#fbbf24)}
|
|
7
|
+
.bwx-btn:active{background:linear-gradient(180deg,#fbbf24,#d97706)}
|
|
8
|
+
.bwx-btn:focus-visible{outline:2px solid #b45309;outline-offset:3px}
|
|
9
|
+
.bwx-btn:disabled{opacity:.6;cursor:not-allowed}
|
|
10
|
+
.bwx-btn .bwx-mark{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;background:#000;flex:none}
|
|
11
|
+
.bwx-btn .bwx-txt{display:flex;flex-direction:column;align-items:flex-start}
|
|
12
|
+
.bwx-btn small{font-size:11px;font-weight:500;color:rgba(0,0,0,.65)}
|
|
13
|
+
</style>
|
|
14
|
+
<button type="button" class="bwx-btn" aria-label="Sign in with bWalletX, also works with bWallet">
|
|
15
|
+
<span class="bwx-mark"><svg viewBox="23 8 74 100" width="15" height="20" aria-hidden="true"><defs><linearGradient id="bwxg" gradientUnits="userSpaceOnUse" x1="0" y1="12" x2="0" y2="105"><stop offset="0" stop-color="#FFE58A"/><stop offset=".55" stop-color="#FFD24D"/><stop offset="1" stop-color="#C98F00"/></linearGradient><mask id="bwxh"><rect width="140" height="140" fill="#fff"/><circle cx="60" cy="72" r="15" fill="#000"/></mask></defs><g fill="url(#bwxg)" mask="url(#bwxh)"><polygon points="45,12 45,76 27,76 27,30"/><circle cx="60" cy="72" r="33"/></g></svg></span>
|
|
16
|
+
<span class="bwx-txt">Sign in with bWalletX<small>also works with bWallet</small></span>
|
|
17
|
+
</button>
|