@islom929/react-eimzo 0.3.1 → 0.3.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 +14 -53
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -19,13 +19,20 @@ import { EimzoProvider } from '@islom929/react-eimzo'
19
19
 
20
20
  function App() {
21
21
  return (
22
- <EimzoProvider>
22
+ <EimzoProvider
23
+ apiKeys={[
24
+ 'yourdomain.uz', 'YOUR_PRODUCTION_API_KEY_HERE',
25
+ 'test.yourdomain.uz', 'YOUR_TEST_API_KEY_HERE',
26
+ ]}
27
+ >
23
28
  <YourApp />
24
29
  </EimzoProvider>
25
30
  )
26
31
  }
27
32
  ```
28
33
 
34
+ Default keys for `localhost` and `127.0.0.1` are always included.
35
+
29
36
  ### 2. Use the hook
30
37
 
31
38
  ```tsx
@@ -121,19 +128,19 @@ function PfxSign() {
121
128
  }
122
129
  ```
123
130
 
124
- ### Sign with hardware device
131
+ ### Sign with tokens
125
132
 
126
133
  No certificate selection needed. Pass device type directly.
127
134
 
128
135
  ```tsx
129
- function DeviceSign() {
136
+ function TokenSign() {
130
137
  const { sign, deviceStatus, loadKeys, isInstalled, isLoading } = useEimzo()
131
138
 
132
139
  useEffect(() => {
133
140
  if (isInstalled) loadKeys()
134
141
  }, [isInstalled])
135
142
 
136
- const handleDeviceSign = (device: 'idcard' | 'baikey' | 'ckc') => {
143
+ const handleTokenSign = (device: 'idcard' | 'baikey' | 'ckc') => {
137
144
  sign({
138
145
  keyId: device,
139
146
  data: JSON.stringify({ document: 'content' }),
@@ -145,21 +152,21 @@ function DeviceSign() {
145
152
  return (
146
153
  <div>
147
154
  <button
148
- onClick={() => handleDeviceSign('idcard')}
155
+ onClick={() => handleTokenSign('idcard')}
149
156
  disabled={!deviceStatus.idcard || isLoading}
150
157
  >
151
158
  ID Card {deviceStatus.idcard ? '(connected)' : '(not connected)'}
152
159
  </button>
153
160
 
154
161
  <button
155
- onClick={() => handleDeviceSign('baikey')}
162
+ onClick={() => handleTokenSign('baikey')}
156
163
  disabled={!deviceStatus.baikey || isLoading}
157
164
  >
158
165
  BAIK Token {deviceStatus.baikey ? '(connected)' : '(not connected)'}
159
166
  </button>
160
167
 
161
168
  <button
162
- onClick={() => handleDeviceSign('ckc')}
169
+ onClick={() => handleTokenSign('ckc')}
163
170
  disabled={!deviceStatus.ckc || isLoading}
164
171
  >
165
172
  CKC {deviceStatus.ckc ? '(connected)' : '(not connected)'}
@@ -241,23 +248,6 @@ function ApplicationForm() {
241
248
  }
242
249
  ```
243
250
 
244
- ### Production API keys
245
-
246
- Add your domain's API key for production deployment.
247
-
248
- ```tsx
249
- <EimzoProvider
250
- apiKeys={[
251
- 'yourdomain.uz', 'YOUR_PRODUCTION_API_KEY_HERE',
252
- 'test.yourdomain.uz', 'YOUR_TEST_API_KEY_HERE',
253
- ]}
254
- >
255
- <App />
256
- </EimzoProvider>
257
- ```
258
-
259
- Default keys for `localhost` and `127.0.0.1` are always included.
260
-
261
251
  ### Check E-IMZO installation
262
252
 
263
253
  ```tsx
@@ -277,35 +267,6 @@ function EimzoStatus() {
277
267
  }
278
268
  ```
279
269
 
280
- ### Filter certificates
281
-
282
- ```tsx
283
- function FilteredKeys() {
284
- const { keyList, loadKeys, isInstalled } = useEimzo()
285
-
286
- useEffect(() => {
287
- if (isInstalled) loadKeys()
288
- }, [isInstalled])
289
-
290
- // Only valid (not expired) certificates
291
- const validCerts = keyList.filter((cert) => !cert.expired)
292
-
293
- // Filter by organization
294
- const orgCerts = keyList.filter((cert) => cert.O === 'MY COMPANY')
295
-
296
- // Filter by PINFL
297
- const userCerts = keyList.filter((cert) => cert.PINFL === '12345678901234')
298
-
299
- return (
300
- <div>
301
- <p>All: {keyList.length}</p>
302
- <p>Valid: {validCerts.length}</p>
303
- <p>My org: {orgCerts.length}</p>
304
- </div>
305
- )
306
- }
307
- ```
308
-
309
270
  ## API
310
271
 
311
272
  ### EimzoProvider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@islom929/react-eimzo",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Headless E-IMZO digital signature integration for React",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",