imzo-agnost 1.0.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.
@@ -0,0 +1,994 @@
1
+ declare global {
2
+ interface Date {
3
+ yyyymmdd(): string;
4
+ ddmmyyyy(): string;
5
+ }
6
+ interface String {
7
+ splitKeep(splitter: string | RegExp, ahead?: boolean): string[];
8
+ }
9
+ }
10
+ interface DateConvertible {
11
+ year?: number;
12
+ month?: number;
13
+ date?: number;
14
+ }
15
+ interface DatesUtility {
16
+ convert(d: Date | number[] | number | string | DateConvertible): Date | number;
17
+ compare(a: Date | number[] | number | string | DateConvertible, b: Date | number[] | number | string | DateConvertible): number;
18
+ inRange(d: Date | number[] | number | string | DateConvertible, start: Date | number[] | number | string | DateConvertible, end: Date | number[] | number | string | DateConvertible): boolean | number;
19
+ }
20
+ interface CertificateInfo$1 {
21
+ disk?: string;
22
+ path?: string;
23
+ name?: string;
24
+ alias?: string;
25
+ cardUID?: string;
26
+ statusInfo?: string;
27
+ ownerName?: string;
28
+ info?: string;
29
+ serialNumber: string;
30
+ validFrom: Date;
31
+ validTo: Date;
32
+ CN: string;
33
+ TIN: string;
34
+ UID: string;
35
+ PINFL: string;
36
+ O: string;
37
+ T: string;
38
+ type: 'pfx' | 'ftjc';
39
+ }
40
+ interface ErrorInfo {
41
+ e?: unknown;
42
+ r?: string;
43
+ }
44
+ type FailCallback = (error: unknown, reason: string | null) => void;
45
+ type ItemIdGenerator = (vo: CertificateInfo$1, rec: string) => string;
46
+ type ItemUiGenerator = (key: string, vo: CertificateInfo$1) => unknown;
47
+ interface EIMZOClientType {
48
+ NEW_API: boolean;
49
+ NEW_API2: boolean;
50
+ API_KEYS: string[];
51
+ checkVersion(success: (major: string, minor: string) => void, fail: FailCallback): void;
52
+ installApiKeys(success: () => void, fail: FailCallback): void;
53
+ listAllUserKeys(itemIdGen: ItemIdGenerator, itemUiGen: ItemUiGenerator, success: (items: unknown[], firstId: string | null) => void, fail: FailCallback): void;
54
+ idCardIsPLuggedIn(success: (isPlugged: boolean) => void, fail: FailCallback): void;
55
+ loadKey(itemObject: CertificateInfo$1, success: (id: string) => void, fail: FailCallback, verifyPassword?: boolean): void;
56
+ changeKeyPassword(itemObject: CertificateInfo$1, success: () => void, fail: FailCallback): void;
57
+ createPkcs7(id: string, data: string, timestamper: unknown, success: (pkcs7: string) => void, fail: FailCallback, detached?: boolean, isDataBase64Encoded?: boolean): void;
58
+ _getX500Val(s: string, f: string): string;
59
+ _findPfxs2(itemIdGen: ItemIdGenerator, itemUiGen: ItemUiGenerator, items: unknown[], errors: ErrorInfo[], callback: (firstItemId?: string) => void): void;
60
+ _findTokens2(itemIdGen: ItemIdGenerator, itemUiGen: ItemUiGenerator, items: unknown[], errors: ErrorInfo[], callback: (firstItemId?: string) => void): void;
61
+ }
62
+ declare const dates: DatesUtility;
63
+ declare const EIMZOClient: EIMZOClientType;
64
+
65
+ interface EIMZOEXTType {
66
+ URL: string;
67
+ callFunction: (funcDef: any, callback: (event: MessageEvent, data: any) => void, error?: (errorCode?: any) => void) => void;
68
+ version: (callback: (event: MessageEvent, data: any) => void, error?: (errorCode?: any) => void) => void;
69
+ apidoc: (callback: (event: MessageEvent, data: any) => void, error?: (errorCode?: any) => void) => void;
70
+ apikey: (domainAndKey: any, callback: (event: MessageEvent, data: any) => void, error?: (errorCode?: any) => void) => void;
71
+ }
72
+ declare const CAPIWS: EIMZOEXTType;
73
+
74
+ interface ApiResponse<T = unknown> {
75
+ success: boolean;
76
+ reason?: string;
77
+ data?: T;
78
+ [key: string]: unknown;
79
+ }
80
+ type CallbackFunction<T = unknown> = (event: MessageEvent, data: ApiResponse<T>) => void;
81
+ type ErrorCallback = (error: unknown) => void;
82
+ interface PluginMethodCall {
83
+ plugin: string;
84
+ name: string;
85
+ arguments?: unknown[];
86
+ }
87
+ interface BasePlugin {
88
+ readonly name: string;
89
+ readonly version?: string;
90
+ readonly description?: string;
91
+ }
92
+ type PluginMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: [...TArgs, CallbackFunction<TResult>, ErrorCallback]) => void;
93
+ type PluginMethodArgs<T> = T extends PluginMethod<infer Args, unknown> ? Args : never;
94
+ type PluginMethodResult<T> = T extends PluginMethod<unknown[], infer Result> ? Result : never;
95
+ interface ListResponse<T> {
96
+ success: true;
97
+ items: T[];
98
+ }
99
+ interface KeyResponse {
100
+ success: true;
101
+ keyId: string;
102
+ }
103
+ interface CertificateInfo {
104
+ disk?: string;
105
+ path?: string;
106
+ name?: string;
107
+ alias?: string;
108
+ serialNumber?: string;
109
+ subject?: string;
110
+ issuer?: string;
111
+ validFrom?: string;
112
+ validTo?: string;
113
+ [key: string]: unknown;
114
+ }
115
+ interface TokenInfo {
116
+ cardUID: string;
117
+ statusInfo?: string;
118
+ ownerName?: string;
119
+ info?: string;
120
+ [key: string]: unknown;
121
+ }
122
+
123
+ /**
124
+ * Core plugin base class that all E-IMZO plugins extend
125
+ */
126
+ declare abstract class EIMZOPlugin implements BasePlugin {
127
+ abstract readonly name: string;
128
+ readonly version: string;
129
+ readonly description: string;
130
+ /**
131
+ * Execute a plugin method call through CAPIWS
132
+ */
133
+ protected callMethod<T = unknown>(methodName: string, args: unknown[] | undefined, onSuccess: CallbackFunction<T>, onError: ErrorCallback): void;
134
+ /**
135
+ * Create a promise-based wrapper for plugin methods
136
+ */
137
+ protected createPromiseMethod<TArgs extends unknown[], TResult = unknown>(methodName: string): (...args: TArgs) => Promise<TResult>;
138
+ /**
139
+ * Create both callback and promise versions of a method
140
+ */
141
+ protected createMethod<TArgs extends unknown[], TResult = unknown>(methodName: string): {
142
+ promise: (...args: TArgs) => Promise<TResult>;
143
+ callback: (...args: [...TArgs, CallbackFunction<TResult>, ErrorCallback]) => void;
144
+ };
145
+ }
146
+ /**
147
+ * Plugin manager for registering and accessing plugins
148
+ */
149
+ declare class PluginManager {
150
+ private static plugins;
151
+ static register(plugin: EIMZOPlugin): void;
152
+ static get<T extends EIMZOPlugin>(name: string): T | undefined;
153
+ static getAll(): EIMZOPlugin[];
154
+ static has(name: string): boolean;
155
+ }
156
+
157
+ /**
158
+ * Плагин для работы с электронными ключами и сертификатами
159
+ */
160
+ declare class CertKeyPlugin extends EIMZOPlugin {
161
+ readonly name = "certkey";
162
+ readonly description = "Plugin for working with electronic keys and certificates";
163
+ /**
164
+ * Удалить загруженные ключи по идентификатору
165
+ */
166
+ unloadKey: (keyId: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
167
+ /**
168
+ * Получить список дисков
169
+ */
170
+ listDisks: (onSuccess: CallbackFunction<string[]>, onError: ErrorCallback) => void;
171
+ /**
172
+ * Получить список сертификатов пользователя
173
+ */
174
+ listCertificates: (diskPath: string, onSuccess: CallbackFunction<CertificateInfo[]>, onError: ErrorCallback) => void;
175
+ /**
176
+ * Получить список всех сертификатов пользователя
177
+ */
178
+ listAllCertificates: (onSuccess: CallbackFunction<CertificateInfo[]>, onError: ErrorCallback) => void;
179
+ /**
180
+ * Загрузить ключ и получить идентификатор ключа
181
+ */
182
+ loadKey: (keyPath: string, password: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
183
+ }
184
+
185
+ /**
186
+ * Плагин для шифрования и дешифрования документа по алг.шифрования ГОСТ-28147, алг.обмена ключа ECDH-SHA256 в режиме P2P
187
+ */
188
+ declare class CipherPlugin extends EIMZOPlugin {
189
+ readonly name = "cipher";
190
+ readonly description = "Plugin for encryption/decryption using GOST-28147 and ECDH-SHA256";
191
+ /**
192
+ * Создать зашифрованный документ
193
+ */
194
+ encryptDocument: (data: string, recipientCertificate: string, senderKeyId: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
195
+ /**
196
+ * Дешифровать зашифрованный документ
197
+ */
198
+ decryptDocument: (encryptedData: string, recipientKeyId: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
199
+ }
200
+
201
+ interface CRLInfo {
202
+ issuer: string;
203
+ thisUpdate: string;
204
+ nextUpdate: string;
205
+ revokedCertificates: {
206
+ serialNumber: string;
207
+ revocationDate: string;
208
+ reason?: string;
209
+ }[];
210
+ }
211
+ interface CertificateStatus {
212
+ isRevoked: boolean;
213
+ revocationDate?: string;
214
+ reason?: string;
215
+ }
216
+ /**
217
+ * Плагин для работы с CRL (Certificate Revocation List)
218
+ */
219
+ declare class CRLPlugin extends EIMZOPlugin {
220
+ readonly name = "crl";
221
+ readonly description = "Plugin for working with Certificate Revocation Lists";
222
+ /**
223
+ * Открывает CRL
224
+ */
225
+ openCrl: (crlData: string, onSuccess: CallbackFunction<unknown>, onError: ErrorCallback) => void;
226
+ /**
227
+ * Открывает CRL из файла
228
+ */
229
+ openCrlFile: (filePath: string, onSuccess: CallbackFunction<unknown>, onError: ErrorCallback) => void;
230
+ /**
231
+ * Проверка статуса сертификата по CRL
232
+ */
233
+ checkCertificate: (certificate: string, crlId: string, onSuccess: CallbackFunction<CertificateStatus>, onError: ErrorCallback) => void;
234
+ /**
235
+ * Получить информацию о CRL
236
+ */
237
+ getCrlInfo: (crlId: string, onSuccess: CallbackFunction<CRLInfo>, onError: ErrorCallback) => void;
238
+ /**
239
+ * Верификация CRL
240
+ */
241
+ verifyCrl: (crlId: string, issuerCertificate: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
242
+ }
243
+
244
+ /**
245
+ * Плагин для выполнения низкоуровневых криптографических преобразований
246
+ */
247
+ declare class CryptoAuthPlugin extends EIMZOPlugin {
248
+ readonly name = "cryptoauth";
249
+ readonly description = "Plugin for low-level cryptographic operations";
250
+ /**
251
+ * Подписать данные ключем задаваемым идентификатором
252
+ */
253
+ getSignature: (keyId: string, data: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
254
+ /**
255
+ * Вычислить хеш (в формате HEX) данных по алгоритму OZDST-1106-2009-2-A
256
+ */
257
+ getDigestHex: (data: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
258
+ /**
259
+ * Верифицировать подпись данных сертификатом
260
+ */
261
+ verifySignatureWithCertificate: (data: string, signature: string, certificate: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
262
+ /**
263
+ * Верифицировать подпись хеша (в формате HEX) ключем задаваемым идентификатором
264
+ */
265
+ verifyDigestHexSignatureWithId: (digestHex: string, signature: string, keyId: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
266
+ /**
267
+ * Подписать хеш (в формате HEX) ключем задаваемым идентификатором
268
+ */
269
+ getDigestHexSignature: (digestHex: string, keyId: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
270
+ /**
271
+ * Верифицировать подпись данных ключем задаваемым идентификатором
272
+ */
273
+ verifySignatureWithId: (data: string, signature: string, keyId: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
274
+ /**
275
+ * Верифицировать подпись хеша (в формате HEX) сертификатом
276
+ */
277
+ verifyDigestHexSignatureWithCertificate: (digestHex: string, signature: string, certificate: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
278
+ }
279
+
280
+ /**
281
+ * Плагин для работы с файлами
282
+ */
283
+ declare class FileIOPlugin extends EIMZOPlugin {
284
+ readonly name = "fileio";
285
+ readonly description = "Plugin for file input/output operations";
286
+ /**
287
+ * Загруить файл
288
+ */
289
+ loadFile: (filePath: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
290
+ /**
291
+ * Записать содержимое zip файла на диск
292
+ */
293
+ writeFile: (zipContent: string, destinationPath: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
294
+ }
295
+
296
+ interface FtjcTokenInfo extends TokenInfo {
297
+ cardUID: string;
298
+ statusInfo: string;
299
+ ownerName: string;
300
+ info: string;
301
+ }
302
+ interface FtjcListResponse {
303
+ success: true;
304
+ tokens: FtjcTokenInfo[];
305
+ }
306
+ interface UserDataResponse {
307
+ success: true;
308
+ data_64: string;
309
+ }
310
+ interface RandomDataResponse {
311
+ success: true;
312
+ random_64: string;
313
+ }
314
+ /**
315
+ * FTJC Plugin for working with USB FT Javacard tokens
316
+ */
317
+ declare class FtjcPlugin extends EIMZOPlugin {
318
+ readonly name = "ftjc";
319
+ readonly description = "Plugin for working with USB FT Javacard tokens - STUB";
320
+ /**
321
+ * Get list of all keys from connected tokens
322
+ */
323
+ listAllKeys: (exceptCards: string | undefined, onSuccess: CallbackFunction<FtjcListResponse>, onError: ErrorCallback) => void;
324
+ /**
325
+ * Get list of tokens
326
+ */
327
+ listTokens: (onSuccess: CallbackFunction<FtjcListResponse>, onError: ErrorCallback) => void;
328
+ /**
329
+ * Load key and get key identifier
330
+ */
331
+ loadKey: (cardUID: string, onSuccess: CallbackFunction<KeyResponse>, onError: ErrorCallback) => void;
332
+ /**
333
+ * Unload key by identifier
334
+ */
335
+ unloadKey: (tokenId: string, onSuccess: CallbackFunction<{
336
+ success: true;
337
+ }>, onError: ErrorCallback) => void;
338
+ /**
339
+ * Verify PIN code of token
340
+ * @param pinType 0 - Initialization, 1 - User, 2 - Reset
341
+ */
342
+ verifyPin: (tokenId: string, pinType: "0" | "1" | "2", onSuccess: CallbackFunction<{
343
+ success: true;
344
+ }>, onError: ErrorCallback) => void;
345
+ /**
346
+ * Change PIN code of token
347
+ * @param pinType 0 - Initialization, 1 - User, 2 - Reset
348
+ */
349
+ changePin: (tokenId: string, pinType: "0" | "1" | "2", onSuccess: CallbackFunction<{
350
+ success: true;
351
+ }>, onError: ErrorCallback) => void;
352
+ /**
353
+ * Set name for USB token
354
+ */
355
+ setName: (tokenId: string, name: string, onSuccess: CallbackFunction<{
356
+ success: true;
357
+ }>, onError: ErrorCallback) => void;
358
+ /**
359
+ * Store certificates in USB token
360
+ */
361
+ storeCertificates: (tokenId: string, subjectCertificate64: string, caCertificate64: string, rootCertificate64: string, onSuccess: CallbackFunction<{
362
+ success: true;
363
+ }>, onError: ErrorCallback) => void;
364
+ /**
365
+ * Get user data from token
366
+ */
367
+ getUserData: (tokenId: string, onSuccess: CallbackFunction<UserDataResponse>, onError: ErrorCallback) => void;
368
+ /**
369
+ * Set or delete user data in token
370
+ * @param data64 Data in BASE64 encoding or empty string to delete
371
+ */
372
+ setUserData: (tokenId: string, data64: string, onSuccess: CallbackFunction<{
373
+ success: true;
374
+ }>, onError: ErrorCallback) => void;
375
+ /**
376
+ * Generate random data in USB token
377
+ */
378
+ getRandomData: (tokenId: string, onSuccess: CallbackFunction<RandomDataResponse>, onError: ErrorCallback) => void;
379
+ /**
380
+ * Install applet in USB token
381
+ */
382
+ installApplet: (cardUID: string, applet64: string, signatureHex: string, onSuccess: CallbackFunction<{
383
+ success: true;
384
+ }>, onError: ErrorCallback) => void;
385
+ /**
386
+ * List all keys (Promise version)
387
+ */
388
+ listAllKeysAsync: (args_0?: string | undefined) => Promise<FtjcListResponse>;
389
+ /**
390
+ * List tokens (Promise version)
391
+ */
392
+ listTokensAsync: () => Promise<FtjcListResponse>;
393
+ /**
394
+ * Load key (Promise version)
395
+ */
396
+ loadKeyAsync: (args_0: string) => Promise<KeyResponse>;
397
+ /**
398
+ * Unload key (Promise version)
399
+ */
400
+ unloadKeyAsync: (args_0: string) => Promise<{
401
+ success: true;
402
+ }>;
403
+ /**
404
+ * Verify PIN (Promise version)
405
+ */
406
+ verifyPinAsync: (args_0: string, args_1: "0" | "1" | "2") => Promise<{
407
+ success: true;
408
+ }>;
409
+ /**
410
+ * Change PIN (Promise version)
411
+ */
412
+ changePinAsync: (args_0: string, args_1: "0" | "1" | "2") => Promise<{
413
+ success: true;
414
+ }>;
415
+ /**
416
+ * Set name (Promise version)
417
+ */
418
+ setNameAsync: (args_0: string, args_1: string) => Promise<{
419
+ success: true;
420
+ }>;
421
+ /**
422
+ * Store certificates (Promise version)
423
+ */
424
+ storeCertificatesAsync: (args_0: string, args_1: string, args_2: string, args_3: string) => Promise<{
425
+ success: true;
426
+ }>;
427
+ /**
428
+ * Get user data (Promise version)
429
+ */
430
+ getUserDataAsync: (args_0: string) => Promise<UserDataResponse>;
431
+ /**
432
+ * Set user data (Promise version)
433
+ */
434
+ setUserDataAsync: (args_0: string, args_1: string) => Promise<{
435
+ success: true;
436
+ }>;
437
+ /**
438
+ * Get random data (Promise version)
439
+ */
440
+ getRandomDataAsync: (args_0: string) => Promise<RandomDataResponse>;
441
+ /**
442
+ * Install applet (Promise version)
443
+ */
444
+ installAppletAsync: (args_0: string, args_1: string, args_2: string) => Promise<{
445
+ success: true;
446
+ }>;
447
+ }
448
+ declare const ftjcPlugin: FtjcPlugin;
449
+
450
+ interface ReaderInfo {
451
+ name: string;
452
+ connected: boolean;
453
+ cardPresent: boolean;
454
+ }
455
+ /**
456
+ * Плагин для работы с ID-card E-IMZO
457
+ */
458
+ declare class IDCardPlugin extends EIMZOPlugin {
459
+ readonly name = "idcard";
460
+ readonly description = "Plugin for working with E-IMZO ID cards";
461
+ /**
462
+ * Проверить пароль хранилища ключей (заглушка)
463
+ */
464
+ verifyPassword: (password: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
465
+ /**
466
+ * Персонализировать ID-карту записав новые сертификаты и установив PIN-код
467
+ */
468
+ personalize: (certificates: string[], pinCode: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
469
+ /**
470
+ * Получить список считывателей
471
+ */
472
+ listReaders: (onSuccess: CallbackFunction<ReaderInfo[]>, onError: ErrorCallback) => void;
473
+ /**
474
+ * Получить список всех сертификатов пользователя (заглушка)
475
+ */
476
+ listAllCertificates: (onSuccess: CallbackFunction<CertificateInfo[]>, onError: ErrorCallback) => void;
477
+ /**
478
+ * Получить зашифрованный и подписанный заводской номер USB-токена
479
+ */
480
+ getEncryptedSignedCplc: (onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
481
+ /**
482
+ * Загрузить ключ и получить идентификатор ключа. Ключ будет доступен определенное время (заглушка)
483
+ */
484
+ loadKey: (cardIndex: number, password: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
485
+ }
486
+
487
+ interface PfxCertificate extends CertificateInfo {
488
+ disk: string;
489
+ path: string;
490
+ name: string;
491
+ alias: string;
492
+ }
493
+ interface PfxListResponse extends ListResponse<PfxCertificate> {
494
+ certificates: PfxCertificate[];
495
+ }
496
+ interface DiskInfo$1 {
497
+ name: string;
498
+ label?: string;
499
+ available: boolean;
500
+ }
501
+ /**
502
+ * PFX Plugin for working with PFX key storage files
503
+ */
504
+ declare class PfxPlugin extends EIMZOPlugin {
505
+ readonly name = "pfx";
506
+ readonly description = "Plugin for working with PFX key storage files";
507
+ /**
508
+ * Get list of available disks
509
+ */
510
+ listDisks: (onSuccess: CallbackFunction<{
511
+ disks: DiskInfo$1[];
512
+ }>, onError: ErrorCallback) => void;
513
+ /**
514
+ * Get list of certificates from specific disk
515
+ */
516
+ listCertificates: (disk: string, onSuccess: CallbackFunction<PfxListResponse>, onError: ErrorCallback) => void;
517
+ /**
518
+ * Get list of all certificates from all disks
519
+ */
520
+ listAllCertificates: (onSuccess: CallbackFunction<PfxListResponse>, onError: ErrorCallback) => void;
521
+ /**
522
+ * Load key and get key identifier
523
+ */
524
+ loadKey: (disk: string, path: string, name: string, alias: string, onSuccess: CallbackFunction<KeyResponse>, onError: ErrorCallback) => void;
525
+ /**
526
+ * Unload key by identifier
527
+ */
528
+ unloadKey: (keyId: string, onSuccess: CallbackFunction<{
529
+ success: true;
530
+ }>, onError: ErrorCallback) => void;
531
+ /**
532
+ * Verify password for key storage
533
+ */
534
+ verifyPassword: (keyId: string, onSuccess: CallbackFunction<{
535
+ success: true;
536
+ }>, onError: ErrorCallback) => void;
537
+ /**
538
+ * Change password for key storage
539
+ */
540
+ changePassword: (keyId: string, onSuccess: CallbackFunction<{
541
+ success: true;
542
+ }>, onError: ErrorCallback) => void;
543
+ /**
544
+ * Save key pair and certificates to new PFX file
545
+ */
546
+ savePfx: (disk: string, path: string, name: string, alias: string, id: string, newKeyPassword: string, subjectCertificate64: string, caCertificate64: string, rootCertificate64: string, onSuccess: CallbackFunction<{
547
+ success: true;
548
+ }>, onError: ErrorCallback) => void;
549
+ /**
550
+ * Save temporary PFX with self-signed certificate
551
+ */
552
+ saveTemporaryPfx: (disk: string, path: string, name: string, alias: string, id: string, password: string, subjectX500Name: string, onSuccess: CallbackFunction<{
553
+ success: true;
554
+ }>, onError: ErrorCallback) => void;
555
+ /**
556
+ * Get list of available disks (Promise version)
557
+ */
558
+ listDisksAsync: () => Promise<{
559
+ disks: DiskInfo$1[];
560
+ }>;
561
+ /**
562
+ * Get list of certificates from specific disk (Promise version)
563
+ */
564
+ listCertificatesAsync: (args_0: string) => Promise<PfxListResponse>;
565
+ /**
566
+ * Get list of all certificates (Promise version)
567
+ */
568
+ listAllCertificatesAsync: () => Promise<PfxListResponse>;
569
+ /**
570
+ * Load key (Promise version)
571
+ */
572
+ loadKeyAsync: (args_0: string, args_1: string, args_2: string, args_3: string) => Promise<KeyResponse>;
573
+ /**
574
+ * Unload key (Promise version)
575
+ */
576
+ unloadKeyAsync: (args_0: string) => Promise<{
577
+ success: true;
578
+ }>;
579
+ /**
580
+ * Verify password (Promise version)
581
+ */
582
+ verifyPasswordAsync: (args_0: string) => Promise<{
583
+ success: true;
584
+ }>;
585
+ /**
586
+ * Change password (Promise version)
587
+ */
588
+ changePasswordAsync: (args_0: string) => Promise<{
589
+ success: true;
590
+ }>;
591
+ /**
592
+ * Save PFX (Promise version)
593
+ */
594
+ savePfxAsync: (args_0: string, args_1: string, args_2: string, args_3: string, args_4: string, args_5: string, args_6: string, args_7: string, args_8: string) => Promise<{
595
+ success: true;
596
+ }>;
597
+ /**
598
+ * Save temporary PFX (Promise version)
599
+ */
600
+ saveTemporaryPfxAsync: (args_0: string, args_1: string, args_2: string, args_3: string, args_4: string, args_5: string, args_6: string) => Promise<{
601
+ success: true;
602
+ }>;
603
+ }
604
+ declare const pfxPlugin: PfxPlugin;
605
+
606
+ interface PKCS10Info {
607
+ subject: string;
608
+ publicKey: string;
609
+ signatureAlgorithm: string;
610
+ [key: string]: unknown;
611
+ }
612
+ interface KeyPairInfo {
613
+ privateKeyId: string;
614
+ publicKey: string;
615
+ }
616
+ /**
617
+ * Плагин для генерации ключевой пары и формирования запроса на сертификат формата PKCS#10
618
+ */
619
+ declare class PKCS10Plugin extends EIMZOPlugin {
620
+ readonly name = "pkcs10";
621
+ readonly description = "Plugin for generating key pairs and PKCS#10 certificate requests";
622
+ /**
623
+ * Формировать запрос на сертификат формата PKCS#10 из существующего ключа
624
+ */
625
+ createPkcs10FromKey: (keyId: string, subject: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
626
+ /**
627
+ * Сгенерировать ключевую пару
628
+ */
629
+ generateKeypair: (keySize: number, onSuccess: CallbackFunction<KeyPairInfo>, onError: ErrorCallback) => void;
630
+ /**
631
+ * Формировать запрос на сертификат формата PKCS#10
632
+ */
633
+ createPkcs10: (subject: string, keySize: number, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
634
+ /**
635
+ * Получить информацию о запросе PKCS#10
636
+ */
637
+ getPkcs10Info: (pkcs10: string, onSuccess: CallbackFunction<PKCS10Info>, onError: ErrorCallback) => void;
638
+ }
639
+
640
+ interface Pkcs7Response {
641
+ success: true;
642
+ pkcs7_64: string;
643
+ }
644
+ interface Pkcs7InfoResponse {
645
+ success: boolean;
646
+ signatures: {
647
+ signer: string;
648
+ timestamp?: string;
649
+ valid: boolean;
650
+ }[];
651
+ }
652
+ /**
653
+ * PKCS7 Plugin for working with PKCS#7/CMS format
654
+ */
655
+ declare class Pkcs7Plugin extends EIMZOPlugin {
656
+ readonly name = "pkcs7";
657
+ readonly description = "Plugin for working with PKCS#7/CMS format";
658
+ /**
659
+ * Create PKCS#7/CMS document by signing with key
660
+ */
661
+ createPkcs7: (data64: string, keyId: string, detached: "yes" | "no" | "" | undefined, onSuccess: CallbackFunction<Pkcs7Response>, onError: ErrorCallback) => void;
662
+ /**
663
+ * Get full information about PKCS#7/CMS document (attached)
664
+ */
665
+ getPkcs7AttachedInfo: (pkcs764: string, trustStoreId: string | undefined, onSuccess: CallbackFunction<Pkcs7InfoResponse>, onError: ErrorCallback) => void;
666
+ /**
667
+ * Get full information about PKCS#7/CMS document (detached)
668
+ */
669
+ getPkcs7DetachedInfo: (data64: string, pkcs764: string, trustStoreId: string | undefined, onSuccess: CallbackFunction<Pkcs7InfoResponse>, onError: ErrorCallback) => void;
670
+ /**
671
+ * Verify PKCS#7/CMS document (attached) - STUB
672
+ */
673
+ verifyPkcs7Attached: (pkcs764: string, trustStoreId: string, requesterId: string | undefined, onSuccess: CallbackFunction<{
674
+ success: true;
675
+ valid: boolean;
676
+ }>, onError: ErrorCallback) => void;
677
+ /**
678
+ * Verify PKCS#7/CMS document (detached) - STUB
679
+ */
680
+ verifyPkcs7Detached: (data64: string, pkcs764: string, trustStoreId: string, requesterId: string | undefined, onSuccess: CallbackFunction<{
681
+ success: true;
682
+ valid: boolean;
683
+ }>, onError: ErrorCallback) => void;
684
+ /**
685
+ * Verify PKCS#7/CMS document with CRL (attached) - STUB
686
+ */
687
+ verifyPkcs7AttachedCrl: (pkcs764: string, trustStoreId: string, crlId: string, onSuccess: CallbackFunction<{
688
+ success: true;
689
+ valid: boolean;
690
+ }>, onError: ErrorCallback) => void;
691
+ /**
692
+ * Verify PKCS#7/CMS document with CRL (detached) - STUB
693
+ */
694
+ verifyPkcs7DetachedCrl: (data64: string, pkcs764: string, trustStoreId: string, crlId: string, onSuccess: CallbackFunction<{
695
+ success: true;
696
+ valid: boolean;
697
+ }>, onError: ErrorCallback) => void;
698
+ /**
699
+ * Attach timestamp token to PKCS#7/CMS document - STUB
700
+ */
701
+ attachTimestampTokenPkcs7: (pkcs764: string, signerSerialNumber: string, timestampToken64: string, onSuccess: CallbackFunction<Pkcs7Response>, onError: ErrorCallback) => void;
702
+ /**
703
+ * Add signature to existing PKCS#7/CMS document (attached) - DEPRECATED
704
+ */
705
+ appendPkcs7Attached: (pkcs764: string, keyId: string, onSuccess: CallbackFunction<Pkcs7Response>, onError: ErrorCallback) => void;
706
+ /**
707
+ * Add signature to existing PKCS#7/CMS document (detached) - DEPRECATED
708
+ */
709
+ appendPkcs7Detached: (data64: string, pkcs764: string, keyId: string, onSuccess: CallbackFunction<Pkcs7Response>, onError: ErrorCallback) => void;
710
+ /**
711
+ * Create PKCS#7/CMS document (Promise version)
712
+ */
713
+ createPkcs7Async: (args_0: string, args_1: string, args_2?: "" | "yes" | "no" | undefined) => Promise<Pkcs7Response>;
714
+ /**
715
+ * Get PKCS#7 attached info (Promise version)
716
+ */
717
+ getPkcs7AttachedInfoAsync: (args_0: string, args_1?: string | undefined) => Promise<Pkcs7InfoResponse>;
718
+ /**
719
+ * Get PKCS#7 detached info (Promise version)
720
+ */
721
+ getPkcs7DetachedInfoAsync: (args_0: string, args_1: string, args_2?: string | undefined) => Promise<Pkcs7InfoResponse>;
722
+ /**
723
+ * Verify PKCS#7 attached (Promise version)
724
+ */
725
+ verifyPkcs7AttachedAsync: (args_0: string, args_1: string, args_2?: string | undefined) => Promise<{
726
+ success: true;
727
+ valid: boolean;
728
+ }>;
729
+ /**
730
+ * Verify PKCS#7 detached (Promise version)
731
+ */
732
+ verifyPkcs7DetachedAsync: (args_0: string, args_1: string, args_2: string, args_3?: string | undefined) => Promise<{
733
+ success: true;
734
+ valid: boolean;
735
+ }>;
736
+ /**
737
+ * Attach timestamp token (Promise version)
738
+ */
739
+ attachTimestampTokenPkcs7Async: (args_0: string, args_1: string, args_2: string) => Promise<Pkcs7Response>;
740
+ }
741
+ declare const pkcs7Plugin: Pkcs7Plugin;
742
+
743
+ /**
744
+ * Плагин для взаимодейтвия с ИОК (инфраструктура открытых ключей)
745
+ */
746
+ declare class PKIPlugin extends EIMZOPlugin {
747
+ readonly name = "pki";
748
+ readonly description = "Plugin for PKI (Public Key Infrastructure) interaction";
749
+ /**
750
+ * Шаг №1 для получения ключа PFX
751
+ */
752
+ enrollPfxStep1: (request: string, onSuccess: CallbackFunction<unknown>, onError: ErrorCallback) => void;
753
+ /**
754
+ * Шаг №2 для получения ключа PFX
755
+ */
756
+ enrollPfxStep2: (response: string, onSuccess: CallbackFunction<unknown>, onError: ErrorCallback) => void;
757
+ }
758
+
759
+ /**
760
+ * Плагин для работы с хранилищами доверенных сертификатов формата JKS
761
+ */
762
+ declare class TruststoreJKSPlugin extends EIMZOPlugin {
763
+ readonly name = "truststore-jks";
764
+ readonly description = "Plugin for working with JKS trust stores";
765
+ /**
766
+ * Открывает хранилище доверенных сертификатов 'truststore.jks' в домашней директории пользователя
767
+ */
768
+ openTruststore: (onSuccess: CallbackFunction<unknown>, onError: ErrorCallback) => void;
769
+ /**
770
+ * Открывает хранилище доверенных сертификатов 'truststore.jks' в домашней директории пользователя
771
+ */
772
+ openTruststoreAsync(): Promise<unknown>;
773
+ }
774
+
775
+ /**
776
+ * Плагин для работы с хранилищами доверенных сертификатов
777
+ */
778
+ declare class TruststorePlugin extends EIMZOPlugin {
779
+ readonly name = "truststore";
780
+ readonly description = "Plugin for working with trust stores";
781
+ /**
782
+ * Получить список доверенных сертификатов (ЗАГЛУШКА)
783
+ */
784
+ listTruststore: (onSuccess: CallbackFunction<CertificateInfo[]>, onError: ErrorCallback) => void;
785
+ }
786
+
787
+ interface TimestampTokenInfo {
788
+ timestamp: string;
789
+ tsaName: string;
790
+ serialNumber: string;
791
+ messageImprint: string;
792
+ policy?: string;
793
+ }
794
+ /**
795
+ * Плагин для работы с токенами штампов времени
796
+ */
797
+ declare class TSAClientPlugin extends EIMZOPlugin {
798
+ readonly name = "tsaclient";
799
+ readonly description = "Plugin for working with timestamp tokens";
800
+ /**
801
+ * Получить запрос на получения токена штампа времени для данных
802
+ */
803
+ getTimestampTokenRequestForData: (data: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
804
+ /**
805
+ * Получить токен штампа времени на подпись от службы штампов времени по веб-ссылке
806
+ */
807
+ getTimestampTokenForSignature: (signature: string, tsaUrl: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
808
+ /**
809
+ * Получить токен штампа времени на данные от службы штампов времени по веб-ссылке
810
+ */
811
+ getTimestampTokenForData: (data: string, tsaUrl: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
812
+ /**
813
+ * Получить информацию о токене штампа времени
814
+ */
815
+ getTimestampTokenInfo: (token: string, onSuccess: CallbackFunction<TimestampTokenInfo>, onError: ErrorCallback) => void;
816
+ /**
817
+ * Получить запрос на получения токена штампа времени для подписи
818
+ */
819
+ getTimestampTokenRequestForSignature: (signature: string, onSuccess: CallbackFunction<string>, onError: ErrorCallback) => void;
820
+ }
821
+
822
+ /**
823
+ * Плагин для установки зашифрованного соединения с сервером по алг.шифрования ГОСТ-28147
824
+ */
825
+ declare class TunnelPlugin extends EIMZOPlugin {
826
+ readonly name = "tunnel";
827
+ readonly description = "Plugin for establishing encrypted connections using GOST-28147";
828
+ /**
829
+ * Создать зашифрованного соединения с сервером и вернуть TCP-порт для приема/передачи данных
830
+ */
831
+ createTunnel: (serverHost: string, serverPort: number, keyId: string, onSuccess: CallbackFunction<{
832
+ port: number;
833
+ }>, onError: ErrorCallback) => void;
834
+ createTunnelAsync(serverHost: string, serverPort: number, keyId: string): Promise<unknown>;
835
+ }
836
+
837
+ /**
838
+ * Плагин для работы с сертификатами X.509
839
+ */
840
+ declare class X509Plugin extends EIMZOPlugin {
841
+ readonly name = "x509";
842
+ readonly description = "Plugin for working with X.509 certificates";
843
+ /**
844
+ * Верификация подписи сертификата субъектка сертификатом издателя
845
+ */
846
+ verifyCertificate: (subjectCert: string, issuerCert: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
847
+ /**
848
+ * Получить цепочку сертификатов в кодировке BASE64 по идентификатору ключа
849
+ */
850
+ getCertificateChain: (keyId: string, onSuccess: CallbackFunction<string[]>, onError: ErrorCallback) => void;
851
+ /**
852
+ * Получить информацию о сертификате
853
+ */
854
+ getCertificateInfo: (certificate: string, onSuccess: CallbackFunction<CertificateInfo>, onError: ErrorCallback) => void;
855
+ }
856
+
857
+ interface DiskInfo {
858
+ name: string;
859
+ path: string;
860
+ available: boolean;
861
+ }
862
+ /**
863
+ * Плагин для работы с файлами хранилища ключей формата YTKS
864
+ */
865
+ declare class YTKSPlugin extends EIMZOPlugin {
866
+ readonly name = "ytks";
867
+ readonly description = "Plugin for working with YTKS key storage files";
868
+ /**
869
+ * Удалить загруженные ключи по идентификатору
870
+ */
871
+ unloadKey: (keyId: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
872
+ /**
873
+ * Изменить пароль хранилища ключей
874
+ */
875
+ changePassword: (disk: string, path: string, name: string, oldPassword: string, newPassword: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
876
+ /**
877
+ * Получить список дисков
878
+ */
879
+ listDisks: (onSuccess: CallbackFunction<{
880
+ disks: DiskInfo[];
881
+ }>, onError: ErrorCallback) => void;
882
+ /**
883
+ * Получить список сертификатов пользователя
884
+ */
885
+ listCertificates: (disk: string, onSuccess: CallbackFunction<{
886
+ certificates: CertificateInfo[];
887
+ }>, onError: ErrorCallback) => void;
888
+ /**
889
+ * Проверить пароль хранилища ключей
890
+ */
891
+ verifyPassword: (disk: string, path: string, name: string, password: string, onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
892
+ /**
893
+ * Получить список всех сертификатов пользователя
894
+ */
895
+ listAllCertificates: (onSuccess: CallbackFunction<{
896
+ certificates: CertificateInfo[];
897
+ }>, onError: ErrorCallback) => void;
898
+ /**
899
+ * Загрузить ключ и получить идентификатор ключа
900
+ */
901
+ loadKey: (disk: string, path: string, name: string, alias: string, onSuccess: CallbackFunction<{
902
+ keyId: string;
903
+ }>, onError: ErrorCallback) => void;
904
+ /**
905
+ * Сохранить ключевую пару или существующий ключ и новые сертификаты в новый файл формата YTKS
906
+ */
907
+ saveYtks: (disk: string, path: string, name: string, password: string, keyId: string, certificates: string[], onSuccess: CallbackFunction<boolean>, onError: ErrorCallback) => void;
908
+ }
909
+
910
+ /**
911
+ * Main E-IMZO API class providing unified access to all plugins
912
+ */
913
+ declare class EIMZOApi {
914
+ readonly capiws: EIMZOEXTType;
915
+ readonly client: EIMZOClientType;
916
+ readonly plugins: typeof PluginManager;
917
+ readonly pfx: EIMZOPlugin | undefined;
918
+ readonly pkcs7: EIMZOPlugin | undefined;
919
+ readonly ftjc: EIMZOPlugin | undefined;
920
+ readonly cryptoauth: EIMZOPlugin | undefined;
921
+ readonly truststoreJks: EIMZOPlugin | undefined;
922
+ readonly tunnel: EIMZOPlugin | undefined;
923
+ readonly certkey: EIMZOPlugin | undefined;
924
+ readonly x509: EIMZOPlugin | undefined;
925
+ readonly cipher: EIMZOPlugin | undefined;
926
+ readonly pki: EIMZOPlugin | undefined;
927
+ readonly pkcs10: EIMZOPlugin | undefined;
928
+ readonly idcard: EIMZOPlugin | undefined;
929
+ readonly truststore: EIMZOPlugin | undefined;
930
+ readonly crl: EIMZOPlugin | undefined;
931
+ readonly fileio: EIMZOPlugin | undefined;
932
+ readonly tsaclient: EIMZOPlugin | undefined;
933
+ readonly ytks: EIMZOPlugin | undefined;
934
+ /**
935
+ * Initialize E-IMZO API and check version
936
+ */
937
+ initialize(): Promise<{
938
+ major: string;
939
+ minor: string;
940
+ }>;
941
+ /**
942
+ * Install API keys
943
+ */
944
+ installApiKeys(): Promise<void>;
945
+ /**
946
+ * Check if ID card is plugged in
947
+ */
948
+ isIdCardPluggedIn(): Promise<boolean>;
949
+ /**
950
+ * Get version information
951
+ */
952
+ getVersion(): Promise<{
953
+ major: string;
954
+ minor: string;
955
+ }>;
956
+ /**
957
+ * Get API documentation
958
+ */
959
+ getApiDoc(): Promise<unknown>;
960
+ /**
961
+ * Setup API keys
962
+ */
963
+ setupApiKeys(domainAndKey: string[]): Promise<void>;
964
+ /**
965
+ * Get all available plugins
966
+ */
967
+ getAvailablePlugins(): string[];
968
+ /**
969
+ * Check if a plugin is available
970
+ */
971
+ hasPlugin(name: string): boolean;
972
+ /**
973
+ * Get plugin by name with type safety
974
+ */
975
+ getPlugin<T extends EIMZOPlugin>(name: string): T | undefined;
976
+ }
977
+ declare const eimzoApi: EIMZOApi;
978
+
979
+ /**
980
+ * Global browser setup for E-IMZO Agnostic
981
+ * Bu fayl browserda window obyektiga global o'zgaruvchilarni qo'shadi
982
+ */
983
+
984
+ declare global {
985
+ interface Window {
986
+ CAPIWS: typeof CAPIWS;
987
+ EIMZOClient: typeof EIMZOClient;
988
+ capiws: typeof CAPIWS;
989
+ eimzoApi: typeof eimzoApi;
990
+ imzoPlugins?: Record<string, unknown>;
991
+ }
992
+ }
993
+
994
+ export { type ApiResponse, type BasePlugin, CAPIWS, type CRLInfo, CRLPlugin, type CallbackFunction, CertKeyPlugin, type CertificateInfo$1 as CertificateInfo, type CertificateStatus, CipherPlugin, CryptoAuthPlugin, EIMZOApi, EIMZOClient, type EIMZOClientType, EIMZOPlugin, type ErrorCallback, FileIOPlugin, FtjcPlugin, type FtjcTokenInfo, IDCardPlugin, type KeyPairInfo, type KeyResponse, type ListResponse, type PKCS10Info, PKCS10Plugin, PKIPlugin, type PfxCertificate, PfxPlugin, Pkcs7Plugin, type Pkcs7Response, PluginManager, type PluginMethod, type PluginMethodArgs, type PluginMethodCall, type PluginMethodResult, type ReaderInfo, TSAClientPlugin, type TimestampTokenInfo, type TokenInfo, TruststoreJKSPlugin, TruststorePlugin, TunnelPlugin, X509Plugin, YTKSPlugin, dates, eimzoApi, ftjcPlugin, pfxPlugin, pkcs7Plugin };