@islom929/react-eimzo 0.4.1 → 0.4.2

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 (2) hide show
  1. package/README.md +0 -72
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -169,78 +169,6 @@ function TokenSign() {
169
169
  }
170
170
  ```
171
171
 
172
- ### Form submission with signature
173
-
174
- Sign form data before submitting to backend.
175
-
176
- ```tsx
177
- function ApplicationForm() {
178
- const { sign, loadKeys, keyList, isInstalled } = useEimzo()
179
- const [step, setStep] = useState<'form' | 'sign'>('form')
180
- const [formData, setFormData] = useState({ name: '', amount: 0 })
181
-
182
- const handleSubmit = (e: React.FormEvent) => {
183
- e.preventDefault()
184
- loadKeys()
185
- setStep('sign')
186
- }
187
-
188
- const handleSign = (cert: ICertificate) => {
189
- sign({
190
- keyId: cert,
191
- data: JSON.stringify(formData),
192
- onSuccess: async (pkcs7) => {
193
- await fetch('/api/applications', {
194
- method: 'POST',
195
- headers: { 'Content-Type': 'application/json' },
196
- body: JSON.stringify({ ...formData, pkcs7 }),
197
- })
198
- alert('Application submitted!')
199
- setStep('form')
200
- },
201
- onError: (err) => alert(`Signing failed: ${err}`),
202
- })
203
- }
204
-
205
- if (step === 'form') {
206
- return (
207
- <form onSubmit={handleSubmit}>
208
- <input
209
- value={formData.name}
210
- onChange={(e) => setFormData({ ...formData, name: e.target.value })}
211
- placeholder="Name"
212
- />
213
- <input
214
- type="number"
215
- value={formData.amount}
216
- onChange={(e) => setFormData({ ...formData, amount: +e.target.value })}
217
- placeholder="Amount"
218
- />
219
- <button type="submit" disabled={!isInstalled}>
220
- Sign & Submit
221
- </button>
222
- </form>
223
- )
224
- }
225
-
226
- return (
227
- <div>
228
- <h3>Select certificate to sign:</h3>
229
- {keyList.map((cert, i) => (
230
- <button
231
- key={`${cert.serialNumber}-${i}`}
232
- onClick={() => handleSign(cert)}
233
- disabled={cert.expired}
234
- >
235
- {cert.CN}
236
- </button>
237
- ))}
238
- <button onClick={() => setStep('form')}>Back</button>
239
- </div>
240
- )
241
- }
242
- ```
243
-
244
172
  ### Check E-IMZO installation
245
173
 
246
174
  ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@islom929/react-eimzo",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Headless E-IMZO digital signature integration for React",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",