@opendatalabs/vana-sdk 0.1.0-alpha.8eb4e46 → 0.1.0-alpha.a145c3c

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.
@@ -3,6 +3,15 @@
3
3
  *
4
4
  * This interface abstracts all environment-specific dependencies to ensure
5
5
  * the SDK works seamlessly across Node.js and browser/SSR environments.
6
+ *
7
+ * **Implementation Context:**
8
+ * - Node.js: Uses native crypto modules and full OpenPGP support
9
+ * - Browser: Uses Web Crypto API and browser-compatible libraries
10
+ * - SSR: Automatically selects appropriate implementation based on runtime
11
+ *
12
+ * **Usage Notes:**
13
+ * Platform adapters are automatically selected by the SDK. Direct usage is only
14
+ * needed for custom implementations or testing.
6
15
  */
7
16
  /**
8
17
  * Platform type identifier
@@ -15,6 +24,11 @@ interface VanaCryptoAdapter {
15
24
  /**
16
25
  * Encrypt data with a public key using asymmetric cryptography
17
26
  *
27
+ * **Usage Context:**
28
+ * - Used internally for file encryption before storage
29
+ * - Public key format: Armored PGP public key string
30
+ * - Returns base64-encoded encrypted data
31
+ *
18
32
  * @param data The data to encrypt
19
33
  * @param publicKey The public key for encryption
20
34
  * @returns Promise resolving to encrypted data
@@ -41,6 +55,11 @@ interface VanaCryptoAdapter {
41
55
  * Encrypt data with a wallet's public key using ECDH cryptography
42
56
  * Uses platform-appropriate ECDH implementation (eccrypto vs eccrypto-js)
43
57
  *
58
+ * **Usage Context:**
59
+ * - Used for sharing encryption keys with permission recipients
60
+ * - Public key format: Compressed or uncompressed secp256k1 hex string
61
+ * - Compatible with Ethereum wallet public keys
62
+ *
44
63
  * @param data The data to encrypt (string)
45
64
  * @param publicKey The wallet's public key (secp256k1)
46
65
  * @returns Promise resolving to encrypted data as hex string
@@ -127,6 +146,22 @@ interface VanaHttpAdapter {
127
146
  }
128
147
  /**
129
148
  * Main platform adapter interface that combines all platform-specific functionality
149
+ *
150
+ * **Implementation Guidelines:**
151
+ * 1. All methods must maintain consistent behavior across platforms
152
+ * 2. Error types and messages should be unified
153
+ * 3. Data formats (encoding, serialization) must be identical
154
+ * 4. Performance characteristics can vary but API must be consistent
155
+ *
156
+ * **Custom Implementation Example:**
157
+ * ```typescript
158
+ * class CustomPlatformAdapter implements VanaPlatformAdapter {
159
+ * crypto = new CustomCryptoAdapter();
160
+ * pgp = new CustomPGPAdapter();
161
+ * http = new CustomHttpAdapter();
162
+ * platform = 'browser' as const;
163
+ * }
164
+ * ```
130
165
  */
131
166
  interface VanaPlatformAdapter {
132
167
  /**
@@ -3,6 +3,15 @@
3
3
  *
4
4
  * This interface abstracts all environment-specific dependencies to ensure
5
5
  * the SDK works seamlessly across Node.js and browser/SSR environments.
6
+ *
7
+ * **Implementation Context:**
8
+ * - Node.js: Uses native crypto modules and full OpenPGP support
9
+ * - Browser: Uses Web Crypto API and browser-compatible libraries
10
+ * - SSR: Automatically selects appropriate implementation based on runtime
11
+ *
12
+ * **Usage Notes:**
13
+ * Platform adapters are automatically selected by the SDK. Direct usage is only
14
+ * needed for custom implementations or testing.
6
15
  */
7
16
  /**
8
17
  * Platform type identifier
@@ -15,6 +24,11 @@ interface VanaCryptoAdapter {
15
24
  /**
16
25
  * Encrypt data with a public key using asymmetric cryptography
17
26
  *
27
+ * **Usage Context:**
28
+ * - Used internally for file encryption before storage
29
+ * - Public key format: Armored PGP public key string
30
+ * - Returns base64-encoded encrypted data
31
+ *
18
32
  * @param data The data to encrypt
19
33
  * @param publicKey The public key for encryption
20
34
  * @returns Promise resolving to encrypted data
@@ -41,6 +55,11 @@ interface VanaCryptoAdapter {
41
55
  * Encrypt data with a wallet's public key using ECDH cryptography
42
56
  * Uses platform-appropriate ECDH implementation (eccrypto vs eccrypto-js)
43
57
  *
58
+ * **Usage Context:**
59
+ * - Used for sharing encryption keys with permission recipients
60
+ * - Public key format: Compressed or uncompressed secp256k1 hex string
61
+ * - Compatible with Ethereum wallet public keys
62
+ *
44
63
  * @param data The data to encrypt (string)
45
64
  * @param publicKey The wallet's public key (secp256k1)
46
65
  * @returns Promise resolving to encrypted data as hex string
@@ -127,6 +146,22 @@ interface VanaHttpAdapter {
127
146
  }
128
147
  /**
129
148
  * Main platform adapter interface that combines all platform-specific functionality
149
+ *
150
+ * **Implementation Guidelines:**
151
+ * 1. All methods must maintain consistent behavior across platforms
152
+ * 2. Error types and messages should be unified
153
+ * 3. Data formats (encoding, serialization) must be identical
154
+ * 4. Performance characteristics can vary but API must be consistent
155
+ *
156
+ * **Custom Implementation Example:**
157
+ * ```typescript
158
+ * class CustomPlatformAdapter implements VanaPlatformAdapter {
159
+ * crypto = new CustomCryptoAdapter();
160
+ * pgp = new CustomPGPAdapter();
161
+ * http = new CustomHttpAdapter();
162
+ * platform = 'browser' as const;
163
+ * }
164
+ * ```
130
165
  */
131
166
  interface VanaPlatformAdapter {
132
167
  /**
@@ -3,6 +3,15 @@
3
3
  *
4
4
  * This interface abstracts all environment-specific dependencies to ensure
5
5
  * the SDK works seamlessly across Node.js and browser/SSR environments.
6
+ *
7
+ * **Implementation Context:**
8
+ * - Node.js: Uses native crypto modules and full OpenPGP support
9
+ * - Browser: Uses Web Crypto API and browser-compatible libraries
10
+ * - SSR: Automatically selects appropriate implementation based on runtime
11
+ *
12
+ * **Usage Notes:**
13
+ * Platform adapters are automatically selected by the SDK. Direct usage is only
14
+ * needed for custom implementations or testing.
6
15
  */
7
16
  /**
8
17
  * Platform type identifier
@@ -15,6 +24,11 @@ interface VanaCryptoAdapter {
15
24
  /**
16
25
  * Encrypt data with a public key using asymmetric cryptography
17
26
  *
27
+ * **Usage Context:**
28
+ * - Used internally for file encryption before storage
29
+ * - Public key format: Armored PGP public key string
30
+ * - Returns base64-encoded encrypted data
31
+ *
18
32
  * @param data The data to encrypt
19
33
  * @param publicKey The public key for encryption
20
34
  * @returns Promise resolving to encrypted data
@@ -41,6 +55,11 @@ interface VanaCryptoAdapter {
41
55
  * Encrypt data with a wallet's public key using ECDH cryptography
42
56
  * Uses platform-appropriate ECDH implementation (eccrypto vs eccrypto-js)
43
57
  *
58
+ * **Usage Context:**
59
+ * - Used for sharing encryption keys with permission recipients
60
+ * - Public key format: Compressed or uncompressed secp256k1 hex string
61
+ * - Compatible with Ethereum wallet public keys
62
+ *
44
63
  * @param data The data to encrypt (string)
45
64
  * @param publicKey The wallet's public key (secp256k1)
46
65
  * @returns Promise resolving to encrypted data as hex string
@@ -127,6 +146,22 @@ interface VanaHttpAdapter {
127
146
  }
128
147
  /**
129
148
  * Main platform adapter interface that combines all platform-specific functionality
149
+ *
150
+ * **Implementation Guidelines:**
151
+ * 1. All methods must maintain consistent behavior across platforms
152
+ * 2. Error types and messages should be unified
153
+ * 3. Data formats (encoding, serialization) must be identical
154
+ * 4. Performance characteristics can vary but API must be consistent
155
+ *
156
+ * **Custom Implementation Example:**
157
+ * ```typescript
158
+ * class CustomPlatformAdapter implements VanaPlatformAdapter {
159
+ * crypto = new CustomCryptoAdapter();
160
+ * pgp = new CustomPGPAdapter();
161
+ * http = new CustomHttpAdapter();
162
+ * platform = 'browser' as const;
163
+ * }
164
+ * ```
130
165
  */
131
166
  interface VanaPlatformAdapter {
132
167
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendatalabs/vana-sdk",
3
- "version": "0.1.0-alpha.8eb4e46",
3
+ "version": "0.1.0-alpha.a145c3c",
4
4
  "description": "A TypeScript library for interacting with Vana Network smart contracts.",
5
5
  "publishConfig": {
6
6
  "access": "public"