@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.
- package/README.md +4 -13
- package/dist/{browser-Bb8gLWHp.d.ts → browser-DY8XDblx.d.ts} +14 -61
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +106 -617
- package/dist/browser.js.map +1 -1
- package/dist/chains.browser.cjs +2 -2
- package/dist/chains.browser.cjs.map +1 -1
- package/dist/chains.browser.js +2 -2
- package/dist/chains.browser.js.map +1 -1
- package/dist/chains.cjs +2 -2
- package/dist/chains.cjs.map +1 -1
- package/dist/chains.js +2 -2
- package/dist/chains.js.map +1 -1
- package/dist/chains.node.cjs +2 -2
- package/dist/chains.node.cjs.map +1 -1
- package/dist/chains.node.js +2 -2
- package/dist/chains.node.js.map +1 -1
- package/dist/index.browser.d.ts +332 -384
- package/dist/index.browser.js +786 -790
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +878 -994
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.cts +336 -143
- package/dist/index.node.d.ts +336 -143
- package/dist/index.node.js +826 -953
- package/dist/index.node.js.map +1 -1
- package/dist/node.cjs +53 -599
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +52 -611
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.d.ts +2 -2
- package/dist/platform.browser.js +116 -665
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.cjs +156 -819
- package/dist/platform.cjs.map +1 -1
- package/dist/platform.js +156 -830
- package/dist/platform.js.map +1 -1
- package/dist/platform.node.cjs +156 -819
- package/dist/platform.node.cjs.map +1 -1
- package/dist/platform.node.d.cts +14 -61
- package/dist/platform.node.d.ts +14 -61
- package/dist/platform.node.js +156 -830
- package/dist/platform.node.js.map +1 -1
- 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
|
|
31
|
+
The Vana SDK supports both browser and Node.js environments with explicit entry points:
|
|
32
32
|
|
|
33
|
-
|
|
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
|
-
//
|
|
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 (
|
|
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
|
|
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
|
-
*
|
|
222
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
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-
|
|
1
|
+
export { B as BrowserPlatformAdapter } from './browser-DY8XDblx.js';
|