@cofhe/react 0.1.0 → 0.2.0
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 +23 -20
- package/dist/index.cjs +8977 -338
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1252 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +15419 -27
- package/dist/index.d.ts +15419 -27
- package/dist/index.js +8930 -308
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1512 -190
- package/package.json +50 -17
- package/dist/styles.css.map +0 -1
- package/dist/styles.d.cts +0 -2
- package/dist/styles.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @cofhe/react
|
|
2
2
|
|
|
3
3
|
React component and hook for the CoFHE SDK - featuring the advanced FnxEncryptInput component.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @cofhe/react @cofhe/sdk @mui/icons-material @mui/material
|
|
9
9
|
# or
|
|
10
|
-
pnpm add @
|
|
10
|
+
pnpm add @cofhe/react @cofhe/sdk @mui/icons-material @mui/material
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Quick Start
|
|
@@ -15,9 +15,9 @@ pnpm add @cofhesdk/react @cofhesdk/web @cofhesdk/adapters @mui/icons-material @m
|
|
|
15
15
|
### 1. Wrap your app with CofheProvider
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
|
-
import { CofheProvider } from '@
|
|
19
|
-
import '@
|
|
20
|
-
import { createCofhesdkClient } from '@
|
|
18
|
+
import { CofheProvider } from '@cofhe/react';
|
|
19
|
+
import '@cofhe/react/styles.css'; // Import component styles
|
|
20
|
+
import { createCofhesdkClient } from '@cofhe/sdk/web';
|
|
21
21
|
|
|
22
22
|
const client = createCofhesdkClient(config);
|
|
23
23
|
|
|
@@ -33,7 +33,7 @@ function App() {
|
|
|
33
33
|
### 2. Use the FnxEncryptInput component
|
|
34
34
|
|
|
35
35
|
```tsx
|
|
36
|
-
import { FnxEncryptInput, FheTypesList } from '@
|
|
36
|
+
import { FnxEncryptInput, FheTypesList } from '@cofhe/react';
|
|
37
37
|
|
|
38
38
|
function MyComponent() {
|
|
39
39
|
return (
|
|
@@ -51,7 +51,7 @@ function MyComponent() {
|
|
|
51
51
|
### 3. Use the hook directly for custom implementations
|
|
52
52
|
|
|
53
53
|
```tsx
|
|
54
|
-
import { useEncryptInput } from '@
|
|
54
|
+
import { useEncryptInput } from '@cofhe/react';
|
|
55
55
|
|
|
56
56
|
function CustomComponent() {
|
|
57
57
|
const { onEncryptInput, isEncryptingInput, encryptionProgress } = useEncryptInput();
|
|
@@ -80,6 +80,7 @@ function CustomComponent() {
|
|
|
80
80
|
Advanced input component with integrated features:
|
|
81
81
|
|
|
82
82
|
### Features
|
|
83
|
+
|
|
83
84
|
- ✅ **Type Selection Dropdown** - Choose from uint8, uint16, uint32, uint64, uint128, bool, address
|
|
84
85
|
- ✅ **Real-time Input Validation** - Validates input against selected FHE type
|
|
85
86
|
- ✅ **Progress Tracking** - Shows encryption steps with progress bar
|
|
@@ -119,12 +120,12 @@ Hook for custom encryption workflows with progress tracking:
|
|
|
119
120
|
|
|
120
121
|
```tsx
|
|
121
122
|
const {
|
|
122
|
-
onEncryptInput,
|
|
123
|
-
isEncryptingInput,
|
|
124
|
-
encryptionStep,
|
|
125
|
-
encryptionProgress,
|
|
126
|
-
encryptionProgressLabel,
|
|
127
|
-
inputEncryptionDisabled,
|
|
123
|
+
onEncryptInput, // (type, value) => Promise<encrypted>
|
|
124
|
+
isEncryptingInput, // boolean - encryption in progress
|
|
125
|
+
encryptionStep, // Current step: 'fetchKeys' | 'pack' | 'prove' | 'verify' | 'done'
|
|
126
|
+
encryptionProgress, // Progress percentage (0-100)
|
|
127
|
+
encryptionProgressLabel, // Human-readable progress label
|
|
128
|
+
inputEncryptionDisabled, // boolean - whether encryption is disabled
|
|
128
129
|
} = useEncryptInput();
|
|
129
130
|
```
|
|
130
131
|
|
|
@@ -133,7 +134,7 @@ const {
|
|
|
133
134
|
The package includes Tailwind CSS styles. Import them in your app:
|
|
134
135
|
|
|
135
136
|
```tsx
|
|
136
|
-
import '@
|
|
137
|
+
import '@cofhe/react/styles.css';
|
|
137
138
|
```
|
|
138
139
|
|
|
139
140
|
If you're using Tailwind CSS in your project, the component classes will work automatically.
|
|
@@ -141,16 +142,18 @@ If you're using Tailwind CSS in your project, the component classes will work au
|
|
|
141
142
|
## Dependencies
|
|
142
143
|
|
|
143
144
|
### Required Peer Dependencies
|
|
145
|
+
|
|
144
146
|
- `@mui/icons-material` ^5.0.0
|
|
145
|
-
- `@mui/material` ^5.0.0
|
|
147
|
+
- `@mui/material` ^5.0.0
|
|
146
148
|
- `react` ^16.8.0 || ^17.0.0 || ^18.0.0
|
|
147
149
|
- `react-dom` ^16.8.0 || ^17.0.0 || ^18.0.0
|
|
148
150
|
|
|
149
151
|
### CoFHE SDK Dependencies
|
|
150
|
-
|
|
151
|
-
- `@
|
|
152
|
-
- `@
|
|
152
|
+
|
|
153
|
+
- `@cofhe/sdk/web` - Web-specific CoFHE SDK
|
|
154
|
+
- `@cofhe/sdk/adapters` - Provider adapters
|
|
155
|
+
- `@cofhe/sdk/chains` - Chain configurations
|
|
153
156
|
|
|
154
157
|
## Example
|
|
155
158
|
|
|
156
|
-
See the complete example application in the `/example` directory of this repository for interactive demonstrations of all features.
|
|
159
|
+
See the complete example application in the `/example` directory of this repository for interactive demonstrations of all features.
|