w3pk 0.7.0 → 0.7.2
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/README.md +76 -19
- package/dist/index.d.mts +650 -5
- package/dist/index.d.ts +650 -5
- package/dist/index.js +776 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +776 -5
- package/dist/index.mjs.map +1 -1
- package/docs/BUNDLE_SIZES.md +7 -4
- package/docs/MIGRATION.md +15 -15
- package/docs/QR_CODE.md +1887 -0
- package/docs/RECOVERY.md +992 -0
- package/docs/SECURITY.md +631 -0
- package/docs/ZK_INTEGRATION_GUIDE.md +6 -4
- package/docs/index.html +4 -3
- package/package.json +9 -2
package/docs/BUNDLE_SIZES.md
CHANGED
|
@@ -61,10 +61,13 @@ npm install w3pk ethers snarkjs circomlibjs
|
|
|
61
61
|
## Production Optimization
|
|
62
62
|
|
|
63
63
|
### Tree-Shaking
|
|
64
|
-
Modern bundlers (Vite, Webpack 5, Rollup)
|
|
65
|
-
1.
|
|
66
|
-
2.
|
|
67
|
-
3.
|
|
64
|
+
Modern bundlers (Vite, Webpack 5, Rollup) automatically exclude ZK dependencies from your bundle:
|
|
65
|
+
1. ZK module loads **only when accessed** via `w3pk.zk`
|
|
66
|
+
2. No webpack configuration needed for Next.js, Vite, or other frameworks
|
|
67
|
+
3. Zero bundle size impact if you don't use ZK features
|
|
68
|
+
4. Works automatically with ES modules (`import` not `require`)
|
|
69
|
+
|
|
70
|
+
**Result**: If you don't use ZK features, `circomlibjs` and `snarkjs` never load, keeping your bundle small.
|
|
68
71
|
|
|
69
72
|
### Code Splitting
|
|
70
73
|
For applications that need ZK features for some users:
|
package/docs/MIGRATION.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
# Migration Guide: v0.
|
|
1
|
+
# Migration Guide: v0.6.0 → v0.7.0
|
|
2
2
|
|
|
3
|
-
This guide helps you migrate from w3pk v0.
|
|
3
|
+
This guide helps you migrate from w3pk v0.6.0 (server-based) to v0.7.0 (client-only).
|
|
4
4
|
|
|
5
5
|
## Breaking Changes
|
|
6
6
|
|
|
7
7
|
### 1. Client-Only Architecture
|
|
8
8
|
|
|
9
|
-
**v0.
|
|
9
|
+
**v0.6.0** required a backend server for WebAuthn verification.
|
|
10
10
|
|
|
11
|
-
**v0.
|
|
11
|
+
**v0.7.0** is fully client-side - no server needed.
|
|
12
12
|
|
|
13
13
|
```diff
|
|
14
|
-
- // v0.
|
|
14
|
+
- // v0.6.0: Required backend API
|
|
15
15
|
- const w3pk = createWeb3Passkey({
|
|
16
16
|
- apiUrl: 'https://your-backend.com/api'
|
|
17
17
|
- })
|
|
18
18
|
|
|
19
|
-
+ // v0.
|
|
19
|
+
+ // v0.7.0: No backend needed
|
|
20
20
|
+ const w3pk = createWeb3Passkey()
|
|
21
21
|
```
|
|
22
22
|
|
|
@@ -24,7 +24,7 @@ This guide helps you migrate from w3pk v0.5.0 (server-based) to v0.6.0 (client-o
|
|
|
24
24
|
|
|
25
25
|
The wallet generation flow has been reordered for better UX and security.
|
|
26
26
|
|
|
27
|
-
**Old Flow (v0.
|
|
27
|
+
**Old Flow (v0.6.0):**
|
|
28
28
|
```typescript
|
|
29
29
|
// 1. Register first
|
|
30
30
|
await w3pk.register({ username: 'alice' })
|
|
@@ -94,11 +94,11 @@ await w3pk.login()
|
|
|
94
94
|
|
|
95
95
|
### For Existing Installations
|
|
96
96
|
|
|
97
|
-
If you have users on v0.
|
|
97
|
+
If you have users on v0.6.0, you'll need to migrate their data:
|
|
98
98
|
|
|
99
|
-
1. **Export data from v0.
|
|
99
|
+
1. **Export data from v0.6.0** (before upgrading):
|
|
100
100
|
```typescript
|
|
101
|
-
// Run this with v0.
|
|
101
|
+
// Run this with v0.6.0 still installed
|
|
102
102
|
const users = await getAllUsers() // Your backend
|
|
103
103
|
const wallets = await exportAllWallets() // Your backend
|
|
104
104
|
```
|
|
@@ -122,7 +122,7 @@ async function migrateUser(username: string, savedMnemonic: string) {
|
|
|
122
122
|
|
|
123
123
|
### Methods That Changed
|
|
124
124
|
|
|
125
|
-
| Method | v0.
|
|
125
|
+
| Method | v0.6.0 | v0.7.0 | Notes |
|
|
126
126
|
|--------|--------|--------|-------|
|
|
127
127
|
| `generateWallet()` | Required auth, returned full wallet | No auth needed, returns `{ mnemonic }` | Optional - for pre-generating wallet |
|
|
128
128
|
| `register()` | `{ username }` | `{ username }`, returns `{ mnemonic }` | Auto-generates wallet and stores it |
|
|
@@ -148,7 +148,7 @@ These methods work identically:
|
|
|
148
148
|
|
|
149
149
|
## Configuration Changes
|
|
150
150
|
|
|
151
|
-
### Before (v0.
|
|
151
|
+
### Before (v0.6.0)
|
|
152
152
|
```typescript
|
|
153
153
|
const w3pk = createWeb3Passkey({
|
|
154
154
|
apiUrl: 'https://backend.com/api', // Removed
|
|
@@ -180,7 +180,7 @@ const w3pk = createWeb3Passkey({
|
|
|
180
180
|
|
|
181
181
|
### Issue: "Must be authenticated to generate wallet"
|
|
182
182
|
|
|
183
|
-
**Cause:** You're using the old v0.
|
|
183
|
+
**Cause:** You're using the old v0.6.0 pattern.
|
|
184
184
|
|
|
185
185
|
**Solution:** Simply call `register()` - it auto-generates the wallet:
|
|
186
186
|
```typescript
|
|
@@ -294,5 +294,5 @@ initApp()
|
|
|
294
294
|
|
|
295
295
|
---
|
|
296
296
|
|
|
297
|
-
**Last Updated:** v0.
|
|
298
|
-
**Previous Version:** v0.
|
|
297
|
+
**Last Updated:** v0.7.0
|
|
298
|
+
**Previous Version:** v0.6.0
|