@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.
Files changed (48) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +76 -8
  3. package/dist/bwalletx-connect.global.js +92 -25
  4. package/dist/bwalletx-connect.global.js.map +1 -1
  5. package/dist/{wallets-CbzMtxrf.d.ts → choice-DCh-tgpT.d.cts} +112 -4
  6. package/dist/{wallets-CbzMtxrf.d.cts → choice-DCh-tgpT.d.ts} +112 -4
  7. package/dist/chunk-34DKBQNN.js +222 -0
  8. package/dist/chunk-34DKBQNN.js.map +1 -0
  9. package/dist/{chunk-QRXFL66W.js → chunk-A2WLGS25.js} +6 -4
  10. package/dist/chunk-A2WLGS25.js.map +1 -0
  11. package/dist/chunk-IFGOAROM.js +255 -0
  12. package/dist/chunk-IFGOAROM.js.map +1 -0
  13. package/dist/chunk-LS6AYEBO.js +1886 -0
  14. package/dist/chunk-LS6AYEBO.js.map +1 -0
  15. package/dist/element-D9Zl-x12.d.cts +46 -0
  16. package/dist/element-D9Zl-x12.d.ts +46 -0
  17. package/dist/element.cjs +1147 -61
  18. package/dist/element.cjs.map +1 -1
  19. package/dist/element.d.cts +23 -28
  20. package/dist/element.d.ts +23 -28
  21. package/dist/element.js +29 -2
  22. package/dist/element.js.map +1 -1
  23. package/dist/index.cjs +1469 -453
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +163 -14
  26. package/dist/index.d.ts +163 -14
  27. package/dist/index.js +100 -12
  28. package/dist/index.js.map +1 -1
  29. package/dist/next.cjs +5 -3
  30. package/dist/next.cjs.map +1 -1
  31. package/dist/next.js +1 -1
  32. package/dist/react.cjs +994 -183
  33. package/dist/react.cjs.map +1 -1
  34. package/dist/react.d.cts +75 -8
  35. package/dist/react.d.ts +75 -8
  36. package/dist/react.js +121 -40
  37. package/dist/react.js.map +1 -1
  38. package/dist/server.cjs +5 -3
  39. package/dist/server.cjs.map +1 -1
  40. package/dist/server.d.cts +8 -3
  41. package/dist/server.d.ts +8 -3
  42. package/dist/server.js +1 -1
  43. package/package.json +10 -9
  44. package/dist/chunk-EXRQJTXF.js +0 -910
  45. package/dist/chunk-EXRQJTXF.js.map +0 -1
  46. package/dist/chunk-QRXFL66W.js.map +0 -1
  47. package/dist/chunk-RIOHG5JH.js +0 -459
  48. package/dist/chunk-RIOHG5JH.js.map +0 -1
package/dist/server.d.ts CHANGED
@@ -316,6 +316,7 @@ declare function checkTokenHolding(require: AccessRequirement, addresses: string
316
316
  declare const LOGIN_PROTOCOL: WalletProtocol;
317
317
  declare const CHALLENGE_LIFETIME_MS: number;
318
318
  interface PendingChallenge {
319
+ /** The key the challenge was made for, or '' when none was given (verifySignIn then binds the claimed key). */
319
320
  identityKey: string;
320
321
  origin: string;
321
322
  message: string;
@@ -342,8 +343,12 @@ declare function loginMessage(origin: string, nonce: string, expiresAt: number):
342
343
  interface CreateChallengeOptions {
343
344
  /** YOUR site's origin from config, e.g. "https://example.com". Never take it from the request. */
344
345
  origin: string;
345
- /** The identity key the browser claims. Checked again at verify. */
346
- identityKey: unknown;
346
+ /**
347
+ * The identity key the browser claims, checked again at verify. Optional since 0.5.5: leave it out so the browser
348
+ * can ask the wallet for the key and the signature in ONE sheet; verifySignIn then binds the key the browser claims,
349
+ * and the signature only verifies for that key. A challenge made WITH a key still only verifies for that key.
350
+ */
351
+ identityKey?: unknown;
347
352
  /** Default: a process-wide in-memory store (dev only). */
348
353
  store?: NonceStore;
349
354
  }
@@ -354,7 +359,7 @@ interface ChallengeResponse {
354
359
  keyID: string;
355
360
  expiresAt: number;
356
361
  }
357
- /** Step 1. Throws if identityKey is not a valid compressed public key. Send the result to the browser. */
362
+ /** Step 1. Throws if an identityKey is given and is not a valid compressed public key. Send the result to the browser. */
358
363
  declare function createChallenge(opts: CreateChallengeOptions): Promise<ChallengeResponse>;
359
364
  interface VerifySignInOptions {
360
365
  /** YOUR site's origin from config. Must equal the origin the challenge was made for. */
package/dist/server.js CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  verifyPayment,
27
27
  verifySession,
28
28
  verifySignIn
29
- } from "./chunk-QRXFL66W.js";
29
+ } from "./chunk-A2WLGS25.js";
30
30
  import {
31
31
  ACCESS_CHALLENGE_LIFETIME_S,
32
32
  ACCESS_ERROR_STATUS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bwalletx/connect",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Sign in with bWalletX or any BRC-100 wallet: button, React provider, Next.js sessions, nonce stores, pay/tip helpers, payment verification, wallet picker, and the bApp shell",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -129,6 +129,14 @@
129
129
  "engines": {
130
130
  "node": ">=20"
131
131
  },
132
+ "scripts": {
133
+ "build": "tsup",
134
+ "typecheck": "tsc --noEmit",
135
+ "test": "vitest run",
136
+ "test:live": "LIVE_RELAY=1 vitest run test/live-relay.test.ts",
137
+ "prepublishOnly": "pnpm typecheck && pnpm lint && pnpm test && pnpm build",
138
+ "lint": "eslint src test"
139
+ },
132
140
  "peerDependencies": {
133
141
  "@bsv/sdk": ">=2.2.0 <4",
134
142
  "next": ">=14",
@@ -159,12 +167,5 @@
159
167
  },
160
168
  "dependencies": {
161
169
  "qrcode-generator": "^1.5.2"
162
- },
163
- "scripts": {
164
- "build": "tsup",
165
- "typecheck": "tsc --noEmit",
166
- "test": "vitest run",
167
- "test:live": "LIVE_RELAY=1 vitest run test/live-relay.test.ts",
168
- "lint": "eslint src test"
169
170
  }
170
- }
171
+ }