eimzo-sign-core 0.1.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 ADDED
@@ -0,0 +1,62 @@
1
+ # eimzo-sign-core
2
+
3
+ E-IMZO (O'zbekiston ARM) bilan imzolashning **framework-agnostik yadrosi**.
4
+ Vue / React / vanilla — farqi yo'q.
5
+
6
+ ## Kafolatlar
7
+
8
+ - Har CAPIWS chaqiruvida **timeout** (osilib qolmaydi).
9
+ - `signBatch` kalitni **bir marta** yuklaydi — parol bir marta so'raladi.
10
+ - Har imzodan keyin **seriya raqami** tanlangan sertifikatga tekshiriladi
11
+ (`E_SERIAL_MISMATCH`).
12
+ - Sessiya tugagach yuklangan kalit holati JS'da **saqlanmaydi**.
13
+ - `console` ga **hech narsa yozilmaydi** — barchasi `onAudit(event)` orqali,
14
+ faqat `serial` / `docId` (shaxsiy ma'lumot emas).
15
+ - Barcha rad etishlar `EimzoError` — barqaror `.code` bilan.
16
+
17
+ ## Foydalanish
18
+
19
+ ```ts
20
+ import { EimzoClient } from 'eimzo-sign-core'
21
+
22
+ const eimzo = new EimzoClient({
23
+ apiKeys: [['example.uz', process.env.EIMZO_KEY!]],
24
+ timeoutMs: 30_000,
25
+ onAudit: (e) => auditLog.write(e),
26
+ })
27
+
28
+ await eimzo.install() // versiya + API kalitlari
29
+ const certs = await eimzo.listCerts() // Cert[]
30
+ const items = await eimzo.signBatch(certs[0], [
31
+ { id: 'doc-1', content: xml1 },
32
+ { id: 'doc-2', content: xml2 },
33
+ ], {
34
+ signal: abortController.signal,
35
+ onProgress: (p) => console.debug(p.done, '/', p.total),
36
+ })
37
+ // items: ({ id, ok:true, pkcs7_64, signature_hex, signer_serial_number } | { id, ok:false, error })[]
38
+ ```
39
+
40
+ ## API
41
+
42
+ | Metod | Qaytadi |
43
+ |---|---|
44
+ | `install()` | `{ major, minor }` — yoki `E_NOT_INSTALLED` / `E_VERSION_LOW` / `E_API_KEY_REJECTED` |
45
+ | `checkVersion()` | `{ major, minor }` |
46
+ | `listCerts()` | `Cert[]` (normallashtirilgan; `raw` — vendor obyekti) |
47
+ | `isIdCardPlugged()` | `boolean` (timeout'da `false`) |
48
+ | `signBatch(cert, docs, opts?)` | `BatchSignItem[]` |
49
+ | `sign(cert, content, opts?)` | `BatchSignItem` |
50
+ | `EimzoClient.idCardCert()` | ID-karta uchun belgili `Cert` |
51
+
52
+ Yordamchilar: `certIsExpired`, `certIsNotYetValid`, `certIsUsable`,
53
+ `certExpiresSoon`, `sortCerts`, `dedupeCerts`.
54
+
55
+ ## Vendored SDK
56
+
57
+ `src/vendor/` — E-IMZO rasmiy brauzer SDK'si, 3 qatorlik bundler-moslik patchi
58
+ bilan. Manba, versiya, SHA-256 va yangilash tartibi:
59
+ [`src/vendor/VENDOR.md`](src/vendor/VENDOR.md).
60
+
61
+ > SSR: `install()` modul yuklanganda `window.location` ni o'qiydi — faqat
62
+ > brauzerda import qiling.