ckb-session-kit 2.0.0 → 2.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/CHANGELOG.md CHANGED
@@ -3,6 +3,99 @@
3
3
  This project follows [semantic versioning](https://semver.org/). The session lock is
4
4
  deployed on CKB **testnet only**; there is no mainnet deployment yet.
5
5
 
6
+ ## 2.2.0 (2026-11-07)
7
+
8
+ ### Added
9
+ - `minConfirmations` on `verifyAccess`, `verifySubscription` and (as a new
10
+ fifth argument, `{ minConfirmations }`) `subscriptionStatus` (review, tracker
11
+ #47 point 5). Default 0: committed is enough, exactly as before, with no
12
+ extra RPC call. Confirmations are `tip - block + 1` (the payment's own block
13
+ is the first). A payment valid in every other way but short of the depth
14
+ gives `{ ok: false, code: "unconfirmed", reason, confirmations,
15
+ minConfirmations }`; one whose block is no longer on the main chain (the
16
+ node's header at that height, read without cache, has another hash) gives
17
+ `code: "reorged"`. The tip is read once per call. In `subscriptionStatus` an
18
+ opening short of the depth is refused that way, and a charge short of it does
19
+ not renew yet: it shows as `status.unconfirmedThroughBlock`.
20
+ - `MAX_MIN_CONFIRMATIONS` (10000) and the `ConfirmationFault` type. A
21
+ `minConfirmations` that is negative, fractional, not a number or bigint, or
22
+ past the maximum throws a `RangeError` before any RPC call.
23
+ - Build pinning for type-id owner locks (review, tracker #47 point 2).
24
+ `openSession` and `openSubscription` read the live code cell of an Omnilock,
25
+ JoyID or Nostr owner lock referenced by type id and compare `ccc.hashCkb` of
26
+ its data with the new `REVIEWED_OWNER_LOCK_BUILDS` (type `OwnerLockBuild`):
27
+ mainnet Omnilock `0x768f3066…118d`, JoyID `0x4af7d832…1ebe`, Nostr lock
28
+ `0x2effea19…9795`, and the builds deployed on testnet. A build not listed
29
+ raises a `SessionWarning` with code `"owner-lock-build-unreviewed"` and the
30
+ observed `dataHash`; a code cell that cannot be read raises
31
+ `"owner-lock-build-unresolved"`. Neither refuses: throw from `onWarning` to
32
+ stop. One indexer query per opening for these three locks; none for others.
33
+ `checkOwnerLockBuild(lock, client, reviewed?)` runs the check alone.
34
+ `openSubscription` takes `onWarning` too.
35
+
36
+ ### Changed
37
+ - `AccessCheck`, `SubscriptionCheck` and `subscriptionStatus`'s result add the
38
+ `ConfirmationFault` variant; the plain `{ ok: false, reason }` variant has
39
+ `code?: undefined`, so `r.code === "unconfirmed"` narrows. Callers that only
40
+ read `ok` and `reason` need no change.
41
+
42
+ ### Docs
43
+ - `docs/design/owner-locks.md` (review, tracker #47 point 2): every unlocking
44
+ path of each owner lock `assertSigningLock` accepts, what it signs, and
45
+ whether it is accepted, from the deployed code (Omnilock `cd764d7`, the
46
+ genesis secp256k1 and multisig scripts, nostr-lock `eef134e`; JoyID from its
47
+ documentation only). No accepted path signs less than the whole transaction;
48
+ the mainnet Omnilock has no CoBuild/open-transaction code. README, "Which
49
+ wallets can own a session": never sign a partial transaction with a lock that
50
+ owns sessions, and type-id upgrades of Omnilock, JoyID and the Nostr lock
51
+ apply to open sessions.
52
+ - `docs/design/subscriptions.md`, "How a payment history is reconstructed"
53
+ (review, tracker #47 point 4): which transactions renew a period (the proven
54
+ opening, or a charge, and either must pay `payTo` the prices of the cells it
55
+ creates), why cells a third party creates under the same lock add no period,
56
+ how the scan and history budgets refuse rather than answer from a partial
57
+ read, and what a forced refusal costs and how it is cleared, with file:line
58
+ and test references. New test: a stranger's transaction that pays `payTo`
59
+ and carries the account memo in its own witness is refused as an opening.
60
+ - README, "If the page is compromised" (tracker #47 point 5): the session key
61
+ is raw hex in JavaScript memory and IndexedDB, so same-origin script can read
62
+ it and sign within the lock's scope; what the lock still bounds on chain, what
63
+ browser expiry does not, and what an app should do (CSP, small budgets,
64
+ recipient and rate limit, server-side checks with `minConfirmations`, sweep
65
+ on suspicion).
66
+
67
+ ## 2.1.0 (2026-11-05)
68
+
69
+ ### Added
70
+ - `fundInSession` and `sendWithSession`: fund a transaction the app built (its
71
+ own inputs, typed outputs, cell deps and witnesses) from a session without a
72
+ recipient, with no wallet prompt. The key cell pays the fee (default 2000
73
+ shannons/KB, `DEFAULT_FUND_FEE_RATE`, the same on every retry). Refused
74
+ before signing: a session with an on-chain recipient, an input under the
75
+ owner's lock (owner mode), an outflow over `maxPerTx`. `sendWithSession`
76
+ retries only when the node names one of the session's own cells as spent, and
77
+ rethrows any other refusal (the app's own cell taken, an RBF refusal) for the
78
+ app's loop. For CrowdCell pledges (CKBuilder-projects#6).
79
+ - `deadInputs` exported, `FundedTransaction`, `FundOptions`,
80
+ `SendWithSessionOptions` types, and `SessionPolicyError` reasons
81
+ `"session-has-recipient"`, `"owner-lock-input"`, `"app-tx-shape"`.
82
+ - CKB-VM tests of a session-funded pledge against CrowdCell's live testnet
83
+ scripts (`scripts/fetch-crowdcell.ts` saves them; not committed), and
84
+ `npm run smoke:fund-pledge`.
85
+ - `npm run smoke:pool-lag`: how long `get_live_cell(include_tx_pool=true)`
86
+ still shows a just-spent input live, per answering node (mentor review,
87
+ tracker #47, 3 Nov). On one node (testnet.ckb.dev) the node that took the
88
+ send never showed the input live (158 polls); on testnet.ckbapp.dev (two
89
+ backends) only the other backend did, in 13 of 20 sends, for up to about
90
+ 0.5 s. One kept-alive socket does not pin a backend there. Logs and table in
91
+ docs/SECURITY-EVIDENCE.md.
92
+
93
+ ### Documentation
94
+ - JoyID is accepted as an owner lock but reviewed from its documentation only:
95
+ its contract is closed source. README and docs/API.md show how an app refuses
96
+ JoyID owners itself before `openSession` (no option in the kit; no behaviour
97
+ change).
98
+
6
99
  ## 2.0.0 (2026-11-03)
7
100
 
8
101
  ### Upgrading from 1.0.0