@islom929/react-eimzo 0.4.1 → 0.4.3
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 +0 -72
- package/package.json +19 -4
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@islom929/react-eimzo",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.4.3",
|
|
4
|
+
"description": "React hook for E-IMZO digital signatures. Simple API, zero UI dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -36,10 +36,25 @@
|
|
|
36
36
|
"keywords": [
|
|
37
37
|
"eimzo",
|
|
38
38
|
"e-imzo",
|
|
39
|
+
"e-imzo-react",
|
|
39
40
|
"digital-signature",
|
|
41
|
+
"electronic-signature",
|
|
40
42
|
"pkcs7",
|
|
41
43
|
"react",
|
|
42
|
-
"
|
|
44
|
+
"react-hook",
|
|
45
|
+
"uzbekistan",
|
|
46
|
+
"eri",
|
|
47
|
+
"capiws",
|
|
48
|
+
"imzo"
|
|
43
49
|
],
|
|
44
|
-
"license": "MIT"
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"homepage": "https://github.com/islom929/react-eimzo#readme",
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git+https://github.com/islom929/react-eimzo.git"
|
|
55
|
+
},
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/islom929/react-eimzo/issues"
|
|
58
|
+
},
|
|
59
|
+
"author": "islom929"
|
|
45
60
|
}
|