@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.
- package/dist/index.browser.d.ts +717 -306
- package/dist/index.browser.js +281 -120
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +282 -121
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.cts +744 -306
- package/dist/index.node.d.ts +744 -306
- package/dist/index.node.js +281 -120
- package/dist/index.node.js.map +1 -1
- package/dist/platform.browser.d.ts +35 -0
- package/dist/platform.node.d.cts +35 -0
- package/dist/platform.node.d.ts +35 -0
- package/package.json +1 -1
|
@@ -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/dist/platform.node.d.cts
CHANGED
|
@@ -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/dist/platform.node.d.ts
CHANGED
|
@@ -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