@opendatalabs/vana-sdk 0.1.0-alpha.98d1ef9 → 0.1.0-alpha.9d6d871

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 (44) hide show
  1. package/README.md +4 -13
  2. package/dist/{browser-Bb8gLWHp.d.ts → browser-DY8XDblx.d.ts} +14 -61
  3. package/dist/browser.d.ts +1 -1
  4. package/dist/browser.js +106 -617
  5. package/dist/browser.js.map +1 -1
  6. package/dist/chains.browser.cjs +2 -2
  7. package/dist/chains.browser.cjs.map +1 -1
  8. package/dist/chains.browser.js +2 -2
  9. package/dist/chains.browser.js.map +1 -1
  10. package/dist/chains.cjs +2 -2
  11. package/dist/chains.cjs.map +1 -1
  12. package/dist/chains.js +2 -2
  13. package/dist/chains.js.map +1 -1
  14. package/dist/chains.node.cjs +2 -2
  15. package/dist/chains.node.cjs.map +1 -1
  16. package/dist/chains.node.js +2 -2
  17. package/dist/chains.node.js.map +1 -1
  18. package/dist/index.browser.d.ts +332 -384
  19. package/dist/index.browser.js +786 -790
  20. package/dist/index.browser.js.map +1 -1
  21. package/dist/index.node.cjs +878 -994
  22. package/dist/index.node.cjs.map +1 -1
  23. package/dist/index.node.d.cts +336 -143
  24. package/dist/index.node.d.ts +336 -143
  25. package/dist/index.node.js +826 -953
  26. package/dist/index.node.js.map +1 -1
  27. package/dist/node.cjs +53 -599
  28. package/dist/node.cjs.map +1 -1
  29. package/dist/node.js +52 -611
  30. package/dist/node.js.map +1 -1
  31. package/dist/platform.browser.d.ts +2 -2
  32. package/dist/platform.browser.js +116 -665
  33. package/dist/platform.browser.js.map +1 -1
  34. package/dist/platform.cjs +156 -819
  35. package/dist/platform.cjs.map +1 -1
  36. package/dist/platform.js +156 -830
  37. package/dist/platform.js.map +1 -1
  38. package/dist/platform.node.cjs +156 -819
  39. package/dist/platform.node.cjs.map +1 -1
  40. package/dist/platform.node.d.cts +14 -61
  41. package/dist/platform.node.d.ts +14 -61
  42. package/dist/platform.node.js +156 -830
  43. package/dist/platform.node.js.map +1 -1
  44. package/package.json +15 -31
package/README.md CHANGED
@@ -28,19 +28,12 @@ npm install viem@^2.31.7
28
28
 
29
29
  ## Quick Start
30
30
 
31
- The Vana SDK provides optimized builds for different environments:
31
+ The Vana SDK supports both browser and Node.js environments with explicit entry points:
32
32
 
33
- | Build | Use Case | Crypto Implementation | Configuration |
34
- | -------------- | --------------------------------- | ---------------------------------- | ----------------- |
35
- | **`/browser`** | Browser apps (React, Vue) | Pure JavaScript (@noble/secp256k1) | **Zero config** ✓ |
36
- | **`/node`** | Server-side (Node.js, API routes) | Native bindings (secp256k1) | Zero config ✓ |
37
-
38
- ### Browser Applications
39
-
40
- The browser build uses pure JavaScript cryptography and requires **no special configuration**:
33
+ ### Browser Applications (React, Vue, etc.)
41
34
 
42
35
  ```typescript
43
- // Browser build - works out of the box with any bundler
36
+ // For browser-based applications (React, Vue, etc.)
44
37
  import { Vana, mokshaTestnet } from "@opendatalabs/vana-sdk/browser";
45
38
  import { createWalletClient, http } from "viem";
46
39
  import { privateKeyToAccount } from "viem/accounts";
@@ -60,9 +53,7 @@ const vana = Vana({
60
53
  });
61
54
  ```
62
55
 
63
- ### Server-side Applications (Node.js)
64
-
65
- The Node.js build uses native secp256k1 bindings for optimal performance:
56
+ ### Server-side Applications (Next.js API routes, Express)
66
57
 
67
58
  ```typescript
68
59
  // For server-side applications (Next.js API routes, Express)
@@ -216,73 +216,26 @@ interface VanaPlatformAdapter {
216
216
  }
217
217
 
218
218
  /**
219
- * Browser implementation of the Vana Platform Adapter using Uint8Array
219
+ * Browser implementation of the Vana Platform Adapter
220
+ *
221
+ * This implementation uses browser-compatible libraries and configurations
222
+ * to provide crypto, PGP, and HTTP functionality without Node.js dependencies.
220
223
  *
221
- * This implementation uses browser-compatible libraries and native APIs
222
- * without requiring Buffer or other Node.js polyfills.
224
+ * WARNING: Dependencies that access globals during init
225
+ * MUST be dynamically imported to support Turbopack.
226
+ * See: https://github.com/vercel/next.js/issues/82632
223
227
  */
224
228
 
225
229
  /**
226
- * Browser implementation of crypto operations using Uint8Array
227
- */
228
- declare class BrowserCryptoAdapter implements VanaCryptoAdapter {
229
- private eciesProvider;
230
- private walletKeyEncryptionService;
231
- encryptWithPublicKey(data: string, publicKeyHex: string): Promise<string>;
232
- decryptWithPrivateKey(encryptedData: string, privateKeyHex: string): Promise<string>;
233
- encryptWithWalletPublicKey(data: string, publicKey: string): Promise<string>;
234
- decryptWithWalletPrivateKey(encryptedData: string, privateKey: string): Promise<string>;
235
- generateKeyPair(): Promise<{
236
- privateKey: string;
237
- publicKey: string;
238
- }>;
239
- encryptWithPassword(data: Uint8Array, password: string): Promise<Uint8Array>;
240
- decryptWithPassword(encryptedData: Uint8Array, password: string): Promise<Uint8Array>;
241
- }
242
- /**
243
- * Browser implementation of PGP operations
244
- */
245
- declare class BrowserPGPAdapter implements VanaPGPAdapter {
246
- encrypt(data: string, publicKeyArmored: string): Promise<string>;
247
- decrypt(encryptedData: string, privateKeyArmored: string): Promise<string>;
248
- generateKeyPair(options?: {
249
- name?: string;
250
- email?: string;
251
- passphrase?: string;
252
- }): Promise<{
253
- publicKey: string;
254
- privateKey: string;
255
- }>;
256
- }
257
- /**
258
- * Browser implementation of HTTP operations using Fetch API
259
- */
260
- declare class BrowserHttpAdapter implements VanaHttpAdapter {
261
- fetch(url: string, options?: RequestInit): Promise<Response>;
262
- }
263
- /**
264
- * Browser implementation of caching using sessionStorage for security
265
- * SessionStorage is cleared when the tab closes, making it more secure for signature caching
266
- */
267
- declare class BrowserCacheAdapter implements VanaCacheAdapter {
268
- private readonly prefix;
269
- get(key: string): string | null;
270
- set(key: string, value: string): void;
271
- delete(key: string): void;
272
- clear(): void;
273
- }
274
- /**
275
- * Browser implementation of the Vana Platform Adapter
276
- *
277
- * This adapter provides all platform-specific functionality for browser environments
278
- * without requiring any Node.js polyfills.
230
+ * Complete browser platform adapter implementation
279
231
  */
280
232
  declare class BrowserPlatformAdapter implements VanaPlatformAdapter {
281
- readonly crypto: BrowserCryptoAdapter;
282
- readonly pgp: BrowserPGPAdapter;
283
- readonly http: BrowserHttpAdapter;
284
- readonly cache: BrowserCacheAdapter;
285
- readonly platform: "browser";
233
+ crypto: VanaCryptoAdapter;
234
+ pgp: VanaPGPAdapter;
235
+ http: VanaHttpAdapter;
236
+ cache: VanaCacheAdapter;
237
+ platform: "browser";
238
+ constructor();
286
239
  }
287
240
 
288
241
  export { BrowserPlatformAdapter as B, type PlatformType as P, type VanaPlatformAdapter as V };
package/dist/browser.d.ts CHANGED
@@ -1 +1 @@
1
- export { B as BrowserPlatformAdapter } from './browser-Bb8gLWHp.js';
1
+ export { B as BrowserPlatformAdapter } from './browser-DY8XDblx.js';