windkit 0.2.2 → 0.2.3

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 (3) hide show
  1. package/CHANGELOG.md +59 -22
  2. package/README.md +91 -47
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,54 +1,91 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to this project will be documented in this file.
3
+ All notable changes to this project are documented in this file.
4
4
 
5
- This project follows Semantic Versioning.
5
+ This project follows [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ---
8
8
 
9
- ## [0.2.2] - 2026-03-02
9
+ ## [0.2.3] - 2026-03-02
10
+
11
+ Published: 2026-03-02T14:07:04Z
10
12
 
11
13
  ### Changed
12
14
 
13
15
  - Session storage key standardized to `"vex-session"`.
14
- - Login identity request now stores compact app info keys:
15
- - `pi` (peer id), `na` (app name), `ic` (icon), `do` (origin), optional `auth` (cached proof).
16
- - Request method names standardized:
17
- - `signRequest`, `signMessage`, `sharedSecret`.
16
+ - Login identity payload compacted with standardized keys:
17
+ - `pi` (peer id)
18
+ - `na` (app name)
19
+ - `ic` (icon)
20
+ - `do` (origin)
21
+ - optional `auth` (cached identity proof)
22
+ - RPC method names standardized:
23
+ - `signRequest`
24
+ - `signMessage`
25
+ - `sharedSecret`
18
26
 
19
27
  ### Added
20
28
 
21
- - `clearSession()` helper.
22
- - Session reuse:
23
- - Reuses saved `peerID` and hints (`account@permission`) when present.
29
+ - `clearSession()` helper for manual session reset.
30
+ - Smart session reuse:
31
+ - Reuses stored `peerID`
32
+ - Reuses permission hints (`account@permission`) when available.
24
33
 
25
34
  ### Fixed
26
35
 
27
- - Safer session loading (auto-clears invalid or expired payloads).
28
- - Improved cleanup on disconnect (best-effort destroy/disconnect).
36
+ - Hardened session loader:
37
+ - Automatically clears expired or malformed session payloads.
38
+ - Improved disconnect cleanup:
39
+ - Safe destroy/disconnect (best-effort, non-throwing).
29
40
 
30
41
  ### Improved
31
42
 
32
- - Low-memory friendly behavior:
33
- - Lightweight heartbeat/ping with jitter (best-effort).
34
- - Minimal allocations on message routing.
43
+ - Optimized for low-memory environments:
44
+ - Lightweight heartbeat with jitter
45
+ - Reduced message routing allocations
46
+ - Lower background CPU usage on mobile devices
35
47
 
36
48
  ---
37
49
 
38
- ## [0.2.1]
50
+ ## [0.2.1] - 2025-10-13
51
+
52
+ Published: 2025-10-13T16:28:38Z
39
53
 
40
54
  ### Added
41
55
 
42
- - Initial PeerJS signaling support.
43
- - Session persistence via sessionStorage.
44
- - Transaction signing via VSR.
45
- - Message signing.
46
- - Shared secret (ECDH).
56
+ - PeerJS signaling support.
57
+ - Session persistence via `sessionStorage`.
58
+ - Transaction signing via Vexanium Signing Request (VSR).
59
+ - Message signing support.
60
+ - Shared secret derivation (ECDH).
47
61
 
48
62
  ---
49
63
 
50
- ## [0.1.1]
64
+ ## [0.2.0] - 2025-10-06
65
+
66
+ Published: 2025-10-06T14:44:23Z
67
+
68
+ ### Added
69
+
70
+ - Structured WebRTC connection lifecycle.
71
+ - WalletSession abstraction layer.
72
+ - Basic login flow via embedded PeerID inside VSR.
73
+ - Request/response routing via internal request IDs.
74
+
75
+ ### Improved
76
+
77
+ - More predictable session initialization flow.
78
+ - Internal protocol normalization groundwork.
79
+
80
+ ---
81
+
82
+ ## [0.1.1] - 2025-08-12
83
+
84
+ Published: 2025-08-12T01:33:25Z
51
85
 
52
86
  ### Added
53
87
 
54
88
  - Initial public release of WindKit.
89
+ - Basic VSR identity login.
90
+ - WebRTC DataConnection integration.
91
+ - Minimal transaction signing flow.
package/README.md CHANGED
@@ -7,39 +7,46 @@ WindKit is a lightweight WebRTC protocol for connecting Vexanium DApps to Wind W
7
7
 
8
8
  It enables secure cross-device login and transaction signing without requiring browser extensions.
9
9
 
10
+ Designed for production environments, including low-RAM mobile devices.
11
+
10
12
  ---
11
13
 
12
- ## Features
14
+ ## Features
13
15
 
14
16
  - Cross-device login via VSR (Vexanium Signing Request)
15
17
  - Transaction signing (single action, multiple actions, or full transaction)
16
- - Optional broadcast (sign-only or broadcast)
18
+ - Optional broadcast control (sign-only or broadcast)
17
19
  - Message signing
18
20
  - Shared secret derivation (ECDH)
19
- - Session persistence via sessionStorage
20
- - Lightweight keepalive (low memory footprint)
21
- - Pure ESM module
21
+ - Session persistence via `sessionStorage`
22
+ - Low-memory heartbeat strategy
23
+ - Pure ESM module (JavaScript-only)
22
24
 
23
25
  ---
24
26
 
25
- ## Installation
27
+ ## 📦 Installation
26
28
 
29
+ ```bash
27
30
  npm install windkit
31
+ ```
28
32
 
29
- WindKit is ESM-only.
33
+ WindKit is **ESM-only**.
30
34
 
31
- Your project must use:
35
+ Your project must include:
32
36
 
37
+ ```json
33
38
  {
34
39
  "type": "module"
35
40
  }
41
+ ```
36
42
 
37
43
  ---
38
44
 
39
- ## Quick Start
45
+ ## 🚀 Quick Start
40
46
 
41
47
  ### Create Connector
42
48
 
49
+ ```js
43
50
  import { WindConnector } from "windkit";
44
51
 
45
52
  const connector = new WindConnector();
@@ -49,29 +56,37 @@ connector.on("session", (session, proof) => {
49
56
  });
50
57
 
51
58
  await connector.connect();
59
+ ```
52
60
 
53
- By default, WindKit relies on PeerJS default signaling behavior (no host/port/path/secure configured).
61
+ By default, WindKit uses PeerJS default signaling.
54
62
 
55
63
  ---
56
64
 
57
- ### Use Your Own PeerJS Server (Optional)
65
+ ## 🌐 Custom PeerJS Server (Optional)
58
66
 
67
+ ```js
59
68
  connector.setServer("peer.yourdomain.com", 443, "/", true);
69
+ ```
60
70
 
61
71
  Signature:
62
72
 
63
- setServer(host, port, path, secure)
73
+ ```js
74
+ setServer(host, port, path, secure);
75
+ ```
64
76
 
65
- Add custom STUN/TURN server:
77
+ Add custom ICE server:
66
78
 
79
+ ```js
67
80
  connector.addIceServer({
68
81
  urls: "stun:stun.cloudflare.com:3478"
69
82
  });
83
+ ```
70
84
 
71
85
  ---
72
86
 
73
- ## Login Flow (VSR)
87
+ ## 🔐 Login Flow (VSR)
74
88
 
89
+ ```js
75
90
  const vsr = connector.createLoginRequest(
76
91
  "My Vexanium DApp",
77
92
  "https://example.com/icon.png"
@@ -83,20 +98,21 @@ window.open(
83
98
  `https://wallet.windcrypto.com/login?vsr=${encodeURIComponent(payload)}`,
84
99
  "Wind Wallet"
85
100
  );
101
+ ```
86
102
 
87
103
  Wallet flow:
88
104
 
89
105
  1. Decode VSR
90
106
  2. Connect to embedded PeerID
91
- 3. Send LOGIN_OK
107
+ 3. Send `LOGIN_OK`
92
108
  4. Emit session
93
109
 
94
110
  ---
95
111
 
96
- ## Session Handling
112
+ ## 🔄 Session Handling
97
113
 
114
+ ```js
98
115
  connector.on("session", (session, proof) => {
99
-
100
116
  session.onClose(() => {
101
117
  console.log("Wallet disconnected");
102
118
  });
@@ -107,13 +123,15 @@ connector.on("session", (session, proof) => {
107
123
 
108
124
  window.appSession = session;
109
125
  });
126
+ ```
110
127
 
111
128
  ---
112
129
 
113
- ## Send Transaction
130
+ ## ✍️ Send Transaction
114
131
 
115
132
  ### With ABI Cache (Recommended)
116
133
 
134
+ ```js
117
135
  import { Action } from "@wharfkit/antelope";
118
136
  import { ABICache } from "@wharfkit/abicache";
119
137
 
@@ -130,7 +148,7 @@ const action = Action.from(
130
148
  from: "alice",
131
149
  to: "bob",
132
150
  quantity: "1.0000 VEX",
133
- memo: "test"
151
+ memo: "WindKit test"
134
152
  },
135
153
  authorization: [appSession.permissionLevel]
136
154
  },
@@ -140,119 +158,145 @@ const action = Action.from(
140
158
  const result = await appSession.transact({ action });
141
159
 
142
160
  console.log(result.transaction_id ?? result.id);
161
+ ```
143
162
 
144
163
  ---
145
164
 
146
165
  ### Sign Only (No Broadcast)
147
166
 
167
+ ```js
148
168
  await appSession.transact(
149
169
  { action },
150
170
  { broadcast: false }
151
171
  );
172
+ ```
152
173
 
153
174
  ---
154
175
 
155
- ## Sign Message
176
+ ## 📝 Sign Message
156
177
 
178
+ ```js
157
179
  const signature = await appSession.signMessage("Hello Wind!");
158
180
  console.log(signature.toString());
181
+ ```
159
182
 
160
183
  ---
161
184
 
162
- ## Shared Secret (ECDH)
185
+ ## 🔑 Shared Secret (ECDH)
163
186
 
187
+ ```js
164
188
  import { PublicKey } from "@wharfkit/antelope";
165
189
 
166
190
  const pub = PublicKey.from("PUB_K1_...");
167
191
  const secret = await appSession.sharedSecret(pub);
168
192
 
169
193
  console.log(secret.toString());
194
+ ```
170
195
 
171
196
  ---
172
197
 
173
- ## Session Storage
198
+ ## 💾 Session Storage
174
199
 
175
200
  WindKit stores session data in:
176
201
 
202
+ ```js
177
203
  sessionStorage["vex-session"]
204
+ ```
178
205
 
179
206
  Example structure:
180
207
 
208
+ ```json
181
209
  {
182
210
  "peerID": "VEX-xxxx",
183
211
  "permission": "account@active",
184
212
  "expiration": "2026-03-01T12:00:00",
185
213
  "auth": "base64u_identity_proof"
186
214
  }
215
+ ```
187
216
 
188
- To clear session manually:
217
+ Clear session manually:
189
218
 
219
+ ```js
190
220
  import { clearSession } from "windkit";
191
221
 
192
222
  clearSession();
223
+ ```
193
224
 
194
225
  ---
195
226
 
196
- ## Architecture
227
+ ## 🏗 Architecture
228
+
229
+ ### WindConnector
197
230
 
198
- WindConnector
199
231
  - Creates VSR identity login
200
232
  - Hosts PeerJS PeerID (DApp-side)
201
233
  - Waits for wallet connection
202
234
  - Emits session
203
235
 
204
- WalletSession
236
+ ### WalletSession
237
+
205
238
  - Sends:
206
- - signRequest
207
- - signMessage
208
- - sharedSecret
239
+ - `signRequest`
240
+ - `signMessage`
241
+ - `sharedSecret`
209
242
  - Routes replies via request IDs
210
- - Lightweight keepalive ping
243
+ - Lightweight heartbeat ping
211
244
  - Handles account change events
212
245
 
213
246
  ---
214
247
 
215
- ## Protocol Notes
248
+ ## 🔎 Protocol Notes
249
+
250
+ Transaction signing method:
216
251
 
217
- Transaction signing method name:
218
- "signRequest"
252
+ ```
253
+ signRequest
254
+ ```
219
255
 
220
256
  Wallet push events handled:
257
+
258
+ ```
221
259
  LOGIN_OK
222
260
  ACTIVE_ACCOUNT_CHANGED
261
+ ```
223
262
 
224
- All communication occurs via PeerJS DataConnection.
263
+ All communication occurs over PeerJS `DataConnection`.
225
264
 
226
265
  ---
227
266
 
228
- ## Technical Details
267
+ ## Technical Details
268
+
269
+ Chain ID is internally fixed via:
229
270
 
230
- Chain ID is fixed internally via:
271
+ ```js
231
272
  WalletSession.ChainID
273
+ ```
274
+
275
+ Dependencies:
276
+
277
+ - `@wharfkit/signing-request`
278
+ - `@wharfkit/antelope`
279
+ - `peerjs`
280
+ - `pako`
232
281
 
233
- Uses:
234
- - @wharfkit/signing-request
235
- - @wharfkit/antelope
236
- - peerjs
237
- - pako (zlib compression)
282
+ Optimized for:
238
283
 
239
- Designed for:
240
284
  - Low-RAM mobile devices
241
- - Background tabs
242
- - Unstable WebRTC environments
285
+ - Background browser tabs
286
+ - Unstable WebRTC networks
243
287
 
244
288
  ---
245
289
 
246
- ## Security Model
290
+ ## 🔐 Security Model
247
291
 
248
292
  - IdentityProof can be verified by the DApp (recommended).
249
293
  - Private keys never leave the wallet.
250
294
  - VSR ensures transaction integrity.
251
- - PeerID is embedded inside VSR to prevent misrouting.
295
+ - PeerID is embedded inside the VSR payload to prevent misrouting.
252
296
 
253
297
  ---
254
298
 
255
- ## License
299
+ ## 📄 License
256
300
 
257
301
  MIT License
258
302
  © Wind Stack
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windkit",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Lightweight protocol to connect Vexanium DApps to Wind Wallet via PeerJS and VSR.",
5
5
  "license": "MIT",
6
6
  "author": "windstack",