@gerege-systems/eid-mongolia-sdk 0.41.0 → 0.43.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/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { R as RpCredentials, C as CertificateLevel, I as Interaction, S as SignatureAlgorithm, H as HashAlgorithm, N as NotificationSession, D as DeviceLinkSession, a as SessionResult, P as PersonBlock, b as RepresentationsResponse, A as AcspContext, F as FlowType } from './browser-Cbph4U6r.cjs';
2
- export { c as DEFAULT_SIGN_SESSION_TTL_MS, E as EndResult, d as NavigatorLike, O as OrgResult, e as Representation, f as SessionPresentation, g as SessionState, h as SignContext, i as SignatureAlgorithmParameters, j as SignatureProtocol, T as TokenCertSessionBlock, k as TokenCertStatus, l as isMobileUserAgent, p as parseExpiresAt, s as sessionExpiry, m as startExpiry } from './browser-Cbph4U6r.cjs';
3
- import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-CgJcEjrZ.cjs';
4
- export { a as AppTransactionTooLargeError, b as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, F as ForbiddenError, N as NetworkError, c as NoSigningCertificateError, d as ON_BEHALF_ERROR_CODES, P as PDF_REGISTER_ERROR_CODES, e as PdfRegisterErrorCode, Q as QrTokenInvalidError, f as RETRYABLE_ERROR_CODES, g as RequestInvalidError, h as ResponseTooLargeError, S as SessionFailedError, V as ValidationError, p as parseRetryAfter } from './errors-CgJcEjrZ.cjs';
1
+ import { R as RpCredentials, C as CertificateLevel, I as Interaction, S as SignatureAlgorithm, H as HashAlgorithm, N as NotificationSession, D as DeviceLinkSession, a as SessionResult, P as PersonBlock, b as RepresentationsResponse, A as AcspContext, F as FlowType } from './browser-BRCGPiTf.cjs';
2
+ export { c as DEFAULT_SIGN_SESSION_TTL_MS, E as EndResult, d as NavigatorLike, O as OrgResult, e as Representation, f as SessionPresentation, g as SessionState, h as SignContext, i as SignatureAlgorithmParameters, j as SignatureProtocol, T as TokenCertSessionBlock, k as TokenCertStatus, l as isMobileUserAgent, p as parseExpiresAt, s as sessionExpiry, m as startExpiry } from './browser-BRCGPiTf.cjs';
5
3
  import { X509Certificate, KeyObject } from 'node:crypto';
4
+ import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-BN0Fp3qd.cjs';
5
+ export { a as AppTransactionTooLargeError, b as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, F as ForbiddenError, N as NetworkError, c as NoSigningCertificateError, d as ON_BEHALF_ERROR_CODES, P as PDF_REGISTER_ERROR_CODES, e as PdfRegisterErrorCode, Q as QrTokenInvalidError, f as RETRYABLE_ERROR_CODES, g as RequestInvalidError, h as ResponseTooLargeError, S as SealApproverUnavailableError, i as SealCertificateRequestError, j as SealRequestNotFoundError, k as SealRequestOutcome, l as SessionFailedError, V as ValidationError, p as parseRetryAfter } from './errors-BN0Fp3qd.cjs';
6
6
 
7
7
  interface HttpConfig {
8
8
  /** RP-API-ийн бүтэн суурь URL. Ж: https://rp.eidmongolia.mn */
@@ -410,6 +410,115 @@ declare class OrganizationApi {
410
410
  getRepresentations(personEtsi: string): Promise<RepresentationsResponse>;
411
411
  }
412
412
 
413
+ /** `GET /seal/certificate/{orgEtsi}` (CA `dto.SealCertificateResponse`). */
414
+ interface SealCertificate {
415
+ orgEtsi: string;
416
+ /** DER. */
417
+ certificate: Uint8Array;
418
+ serialNumber: string;
419
+ subjectDn: string;
420
+ issuerDn: string;
421
+ /** RFC 3339. */
422
+ notBefore: string;
423
+ notAfter: string;
424
+ certificateLevel: CertificateLevel | string;
425
+ /** Серверийн түүхий JSON. */
426
+ raw: unknown;
427
+ }
428
+ /** Тамганы гэрчилгээний хүсэлтийн төлөв (CA `dto.SealCertificateRequestResponse.status`). */
429
+ type SealCertificateRequestStatus = "PENDING" | "APPROVED" | "ISSUED" | "REJECTED" | "EXPIRED" | "FAILED";
430
+ /**
431
+ * `POST /seal/certificate/{orgEtsi}` (202) ба `GET /seal/certificate/{orgEtsi}/requests/{requestId}` (CA
432
+ * `dto.SealCertificateRequestResponse`).
433
+ */
434
+ interface SealCertificateRequest {
435
+ requestId: string;
436
+ orgEtsi: string;
437
+ /** PENDING / APPROVED — хүлээнэ; ISSUED — `certificate` бөглөгдсөн; REJECTED / EXPIRED / FAILED — шинэ хүсэлт. */
438
+ status: SealCertificateRequestStatus | string;
439
+ /** RFC 3339. */
440
+ createdAt: string;
441
+ /** RFC 3339 — батлах хугацааны төгсгөл (дараа нь EXPIRED). */
442
+ expiresAt: string;
443
+ decidedAt?: string;
444
+ /** PIN2 push илгээсэн ADMIN-ийн тоо (шинэ/PENDING хариунд). */
445
+ approvers?: number;
446
+ /** FAILED/EXPIRED үеийн машин код: `EXPIRED` | `SEAL_ISSUANCE_FAILED` | `PUSH_FAILED`. */
447
+ failure?: string;
448
+ /** ISSUED үед — {@link SealApi.getCertificate}-тэй ижил хэлбэр. */
449
+ certificate?: SealCertificate;
450
+ raw: unknown;
451
+ }
452
+ /** {@link SealApi.waitForCertificate}-ийн сонголт. */
453
+ interface SealWaitOptions {
454
+ /** Нийт хүлээх дээд хугацаа (мс). Анхдагч {@link DEFAULT_SEAL_WAIT_TIMEOUT_MS}. */
455
+ timeoutMs?: number;
456
+ /** Poll хоорондын зай (мс). Анхдагч {@link DEFAULT_SEAL_POLL_INTERVAL_MS}; 429/503-ын Retry-After илүү бол түүнийг дагана. */
457
+ intervalMs?: number;
458
+ /** Цуцлах — тасармагц `signal.reason`-ыг шиднэ. */
459
+ signal?: AbortSignal;
460
+ }
461
+ /** `waitForCertificate`-ийн анхдагч хүлээх хугацаа — CA-ийн батлах цонх (sign session TTL + 2 мин)-оос урт. */
462
+ declare const DEFAULT_SEAL_WAIT_TIMEOUT_MS: number;
463
+ /** `waitForCertificate`-ийн анхдагч poll зай (CA зөвлөмж 2–5 с). */
464
+ declare const DEFAULT_SEAL_POLL_INTERVAL_MS = 3000;
465
+ /** `POST /seal/{orgEtsi}` (CA `dto.SealResponse`). */
466
+ interface SealResult {
467
+ orgEtsi: string;
468
+ /** digest дээрх ECDSA гарын үсэг (ASN.1 DER). */
469
+ signature: Uint8Array;
470
+ /** ж: `ecdsa-with-SHA256` (digest-ийн hash-аас). */
471
+ signatureAlgorithm: string;
472
+ /** Тамгалсан гэрчилгээ (DER). */
473
+ certificate: Uint8Array;
474
+ certificateLevel: CertificateLevel | string;
475
+ /** RFC 3339. */
476
+ sealedAt: string;
477
+ raw: unknown;
478
+ }
479
+ /**
480
+ * e-Seal профайл: KeyUsage-д nonRepudiation (contentCommitment) байгаа, digitalSignature байхгүй, EKU байхгүй, CA биш
481
+ * (CA/SDK шалгагчийн `usage: "seal"` ангилалтай ижил; Go `eid.IsSealCertificate`).
482
+ */
483
+ declare function isSealCertificate(cert: X509Certificate | Uint8Array): boolean;
484
+ declare class SealApi {
485
+ private readonly http;
486
+ constructor(http: Http);
487
+ /**
488
+ * `GET /seal/certificate/{orgEtsi}` — байгууллагын одоогийн (хамгийн сүүлд олгогдсон, идэвхтэй) тамганы гэрчилгээ
489
+ * (PAdES-ийн signerCert). Шинээр олгохгүй — олголт {@link requestCertificate}. Идэвхтэй cert алга / цуцлагдсан бол 409.
490
+ */
491
+ getCertificate(orgEtsi: string): Promise<SealCertificate>;
492
+ /**
493
+ * `POST /seal/certificate/{orgEtsi}` — тамганы гэрчилгээний ХҮСЭЛТ (202, `status: "PENDING"`). Байгууллагын ADMIN
494
+ * төлөөлөгч(ид) eID аппаараа PIN2-оор батална; {@link waitForCertificate} / {@link getCertificateRequest}-ээр асууна.
495
+ * Байгууллагад PENDING хүсэлт байвал CA түүнийг буцаана (шинэ push үгүй). Алдаа: 409 {@link
496
+ * SealApproverUnavailableError} (идэвхтэй төхөөрөмжтэй ADMIN алга), 409 `ApiError` (байгууллага ACTIVE биш), 403
497
+ * `ForbiddenError` (`SEAL:<orgEtsi>` эрхгүй), 404 (байгууллага олдсонгүй), 429 `RATE_LIMITED` (байгууллагад 5/цаг;
498
+ * `retryAfterMs`).
499
+ */
500
+ requestCertificate(orgEtsi: string): Promise<SealCertificateRequest>;
501
+ /**
502
+ * `GET /seal/certificate/{orgEtsi}/requests/{requestId}` — хүсэлтийн төлөв; ISSUED үед `certificate` бөглөгдөнө. Олдоогүй
503
+ * (эсвэл өөр байгууллагынх) → {@link SealRequestNotFoundError} 404.
504
+ */
505
+ getCertificateRequest(orgEtsi: string, requestId: string): Promise<SealCertificateRequest>;
506
+ /**
507
+ * Хүсэлт ISSUED болтол `intervalMs` тутамд асууж олгогдсон гэрчилгээг буцаана. REJECTED / EXPIRED / FAILED →
508
+ * {@link SealCertificateRequestError} (`outcome`, `failure`; шинэ хүсэлт хэрэгтэй); `timeoutMs` дуусвал `outcome:
509
+ * "TIMEOUT"` (хүсэлт серверт PENDING хэвээр — ижил `requestId`-аар дахин хүлээж болно). Түр алдаа (`ApiError.retryable`:
510
+ * 429/503 + Retry-After) — Retry-After-ийг хүлээгээд үргэлжилнэ; бусад алдаа шууд шидэгдэнэ.
511
+ */
512
+ waitForCertificate(orgEtsi: string, requestId: string, opts?: SealWaitOptions): Promise<SealCertificate>;
513
+ /**
514
+ * `POST /seal/{orgEtsi}` — digest-ийг байгууллагын тамгаар тамгална. `hashAlgorithm`: SHA-256 (анхдагч) | SHA-384 |
515
+ * SHA-512; digest-ийн урт таарахгүй бол сүлжээнд гарахгүй. Хариуны гарын үсгийг хариуны гэрчилгээгээр digest дээр
516
+ * шалгаж, гэрчилгээ e-Seal ({@link isSealCertificate}) эсэхийг тулгана — эс бөгөөс ValidationError. Гинж/цуцлалтыг
517
+ * `sealPdf` (OCSP/CRL) шалгана.
518
+ */
519
+ seal(orgEtsi: string, digest: Uint8Array, hashAlgorithm?: HashAlgorithm): Promise<SealResult>;
520
+ }
521
+
413
522
  /** Токенд холбогдсон байгууллага. */
414
523
  interface TokenOrganization {
415
524
  etsi: string;
@@ -1447,6 +1556,8 @@ declare class EidClient {
1447
1556
  readonly auth: AuthApi;
1448
1557
  readonly sign: SignApi;
1449
1558
  readonly organization: OrganizationApi;
1559
+ /** Байгууллагын цахим тамга (e-Seal) — `SEAL:<orgEtsi>` эрх. */
1560
+ readonly seal: SealApi;
1450
1561
  readonly person: PersonApi;
1451
1562
  readonly token: TokenApi;
1452
1563
  /** «Миний QR» (биечлэн шалгах): parse → start → result / check. */
@@ -1483,6 +1594,11 @@ declare const PDF_SIGNATURE_REGISTER_FIELDS: readonly ["docID", "revIndex", "med
1483
1594
  * 0329ef95, !371). CA үл мэдэгдэх талбарыг 400 REQUEST_INVALID-аар татгалздаг. Live discovery-ийн `endpoints.share`
1484
1595
  * тайлбартай гэрээний тест тулгана.
1485
1596
  */
1597
+ /**
1598
+ * `POST /seal/{orgEtsi}`-ийн биеийн талбарууд, SDK-ийн илгээдэг — CA `server/internal/dto/org_dtos.go` `SealRequest`-ийн
1599
+ * JSON tag (`relyingPartyUUID`/`relyingPartyName` нь CA-д заавал биш). CA `DisallowUnknownFields`.
1600
+ */
1601
+ declare const SEAL_REQUEST_FIELDS: readonly ["digest", "hashType"];
1486
1602
  declare const SHARE_FORM_FIELDS: readonly ["file", "filename", "to", "subject", "message", "lang"];
1487
1603
 
1488
1604
  interface OcspCheckerOptions {
@@ -1873,4 +1989,4 @@ declare function withReturnHint(callbackUrl: string, userAgent: string): string;
1873
1989
  */
1874
1990
  declare function createEidLogin(opts: EidLoginOptions): EidLogin;
1875
1991
 
1876
- export { APP_ATTESTATION_INVALID, AcspContext, type AcspV2Params, type ActivityCounts, type ActivityItem, type ActivityQuery, ApiError, AuthApi, type AuthDefaults, type AuthOptions, type BuildDeviceLinkInput, CITIZEN_INTERMEDIATES_PEM, CITIZEN_ISSUING_CA_SKI, CSR_KEY_REUSED, type CertChoiceOptions, type CertCounts, type CertSubject, CertificateLevel, type ClientConfig, type CompletedForRegistration, DEFAULT_BASE_URL, DEFAULT_MAX_WAIT_MS, DEFAULT_PDF_TIMEOUT_MS, DEFAULT_QR_ISSUER, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, EidError, type EidLogin, type EidLoginContext, type EidLoginEvent, type EidLoginEventKind, type EidLoginIdentity, type EidLoginMode, type EidLoginOptions, type EidLoginRateLimitFn, type EidLoginRateLimits, type EidLoginRateRule, type EidLoginRequest, type EidLoginResponse, type EidLoginStore, type EidLoginSuccess, type EidLoginTx, FlowType, HashAlgorithm, Http, type HttpConfig, HttpErrorInit, Interaction, KYC_INCOMPLETE, LoginStoreFullError, MAX_APP_TRANSACTION_BYTES, MEMORY_LOGIN_STORE_MAX, NATIONAL_ROOT_CA_PEM, NO_ACTIVE_DEVICE, NotificationSession, type OcspCheckerOptions, OnBehalfErrorCode, OrganizationApi, PDF_SIGNATURE_REGISTER_FIELDS, type ParsedQr, type PdfDigestInput, type PdfDigestSession, type PdfDigestSigner, type PersonActivity, PersonApi, PersonBlock, type PersonCertificate, type PersonCertificates, type PersonChild, type PersonChildren, type PersonDevice, type PersonDevices, type PersonSummary, type PriorSignature, QR_CLOCK_SKEW_SECONDS, QR_ERROR_CODES, QR_LIMITS, QR_MAX_AGE_SECONDS, QR_PREFIX, QrApi, type QrApiDeps, type QrCheck, type QrClaims, type QrConfig, type QrDeviceLinkTickerOptions, QrError, type QrErrorCode, type QrExpect, type QrPresentation, type QrSession, type QrSigner, type QrStartInput, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, RetryableErrorCode, type RevocationChecker, type RevocationOutcome, type RevocationStatus, RpCredentials, SHARE_ERROR_CODES, SHARE_FORM_FIELDS, SessionApi, SessionResult, type SessionTtl, ShareError, type ShareErrorCode, type ShareInfo, type ShareInput, type ShareNotSignedReason, type ShareResult, SignApi, type SignDefaults, type SignOptions, SignatureAlgorithm, type Signer, type SignerRef, TOKEN_CONFLICT_CODES, TOKEN_ERROR_CODES, TOKEN_ISSUANCE_PENDING, TokenApi, type TokenAuthChallenge, type TokenAuthResult, type TokenCertInfo, type TokenCertInput, type TokenCertItem, type TokenCertPreview, type TokenCertResult, type TokenCertStart, type TokenConflictCode, type TokenErrorCode, type TokenIdentity, type TokenLimit, type TokenOrganization, type TrustConfig, type ValidateAuthOptions, type ValidateSignOptions, type VerifiedIdentity, type VerifiedSignature, WAIT_GRACE_MS, acspV2Digest, buildAcspV2Payload, buildDeviceLink, buildRegisterBody, certificateLevelOf, createEidLogin, defaultRateLimit, deviceLinkInput, forwardedClientIp, interactionsToBase64, memoryLoginStore, ocspRevocationChecker, parseQr, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, qrStatement, randomChallenge, registrationFromCompleted, resolveBaseUrl, sessionSecretDigest, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyQrPresentation, verifySessionSecretDigest, verifyTokenCertificates, withReturnHint };
1992
+ export { APP_ATTESTATION_INVALID, AcspContext, type AcspV2Params, type ActivityCounts, type ActivityItem, type ActivityQuery, ApiError, AuthApi, type AuthDefaults, type AuthOptions, type BuildDeviceLinkInput, CITIZEN_INTERMEDIATES_PEM, CITIZEN_ISSUING_CA_SKI, CSR_KEY_REUSED, type CertChoiceOptions, type CertCounts, type CertSubject, CertificateLevel, type ClientConfig, type CompletedForRegistration, DEFAULT_BASE_URL, DEFAULT_MAX_WAIT_MS, DEFAULT_PDF_TIMEOUT_MS, DEFAULT_QR_ISSUER, DEFAULT_SEAL_POLL_INTERVAL_MS, DEFAULT_SEAL_WAIT_TIMEOUT_MS, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, EidError, type EidLogin, type EidLoginContext, type EidLoginEvent, type EidLoginEventKind, type EidLoginIdentity, type EidLoginMode, type EidLoginOptions, type EidLoginRateLimitFn, type EidLoginRateLimits, type EidLoginRateRule, type EidLoginRequest, type EidLoginResponse, type EidLoginStore, type EidLoginSuccess, type EidLoginTx, FlowType, HashAlgorithm, Http, type HttpConfig, HttpErrorInit, Interaction, KYC_INCOMPLETE, LoginStoreFullError, MAX_APP_TRANSACTION_BYTES, MEMORY_LOGIN_STORE_MAX, NATIONAL_ROOT_CA_PEM, NO_ACTIVE_DEVICE, NotificationSession, type OcspCheckerOptions, OnBehalfErrorCode, OrganizationApi, PDF_SIGNATURE_REGISTER_FIELDS, type ParsedQr, type PdfDigestInput, type PdfDigestSession, type PdfDigestSigner, type PersonActivity, PersonApi, PersonBlock, type PersonCertificate, type PersonCertificates, type PersonChild, type PersonChildren, type PersonDevice, type PersonDevices, type PersonSummary, type PriorSignature, QR_CLOCK_SKEW_SECONDS, QR_ERROR_CODES, QR_LIMITS, QR_MAX_AGE_SECONDS, QR_PREFIX, QrApi, type QrApiDeps, type QrCheck, type QrClaims, type QrConfig, type QrDeviceLinkTickerOptions, QrError, type QrErrorCode, type QrExpect, type QrPresentation, type QrSession, type QrSigner, type QrStartInput, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, RetryableErrorCode, type RevocationChecker, type RevocationOutcome, type RevocationStatus, RpCredentials, SEAL_REQUEST_FIELDS, SHARE_ERROR_CODES, SHARE_FORM_FIELDS, SealApi, type SealCertificate, type SealCertificateRequest, type SealCertificateRequestStatus, type SealResult, type SealWaitOptions, SessionApi, SessionResult, type SessionTtl, ShareError, type ShareErrorCode, type ShareInfo, type ShareInput, type ShareNotSignedReason, type ShareResult, SignApi, type SignDefaults, type SignOptions, SignatureAlgorithm, type Signer, type SignerRef, TOKEN_CONFLICT_CODES, TOKEN_ERROR_CODES, TOKEN_ISSUANCE_PENDING, TokenApi, type TokenAuthChallenge, type TokenAuthResult, type TokenCertInfo, type TokenCertInput, type TokenCertItem, type TokenCertPreview, type TokenCertResult, type TokenCertStart, type TokenConflictCode, type TokenErrorCode, type TokenIdentity, type TokenLimit, type TokenOrganization, type TrustConfig, type ValidateAuthOptions, type ValidateSignOptions, type VerifiedIdentity, type VerifiedSignature, WAIT_GRACE_MS, acspV2Digest, buildAcspV2Payload, buildDeviceLink, buildRegisterBody, certificateLevelOf, createEidLogin, defaultRateLimit, deviceLinkInput, forwardedClientIp, interactionsToBase64, isSealCertificate, memoryLoginStore, ocspRevocationChecker, parseQr, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, qrStatement, randomChallenge, registrationFromCompleted, resolveBaseUrl, sessionSecretDigest, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyQrPresentation, verifySessionSecretDigest, verifyTokenCertificates, withReturnHint };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { R as RpCredentials, C as CertificateLevel, I as Interaction, S as SignatureAlgorithm, H as HashAlgorithm, N as NotificationSession, D as DeviceLinkSession, a as SessionResult, P as PersonBlock, b as RepresentationsResponse, A as AcspContext, F as FlowType } from './browser-aa_Judox.js';
2
- export { c as DEFAULT_SIGN_SESSION_TTL_MS, E as EndResult, d as NavigatorLike, O as OrgResult, e as Representation, f as SessionPresentation, g as SessionState, h as SignContext, i as SignatureAlgorithmParameters, j as SignatureProtocol, T as TokenCertSessionBlock, k as TokenCertStatus, l as isMobileUserAgent, p as parseExpiresAt, s as sessionExpiry, m as startExpiry } from './browser-aa_Judox.js';
3
- import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-CgJcEjrZ.js';
4
- export { a as AppTransactionTooLargeError, b as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, F as ForbiddenError, N as NetworkError, c as NoSigningCertificateError, d as ON_BEHALF_ERROR_CODES, P as PDF_REGISTER_ERROR_CODES, e as PdfRegisterErrorCode, Q as QrTokenInvalidError, f as RETRYABLE_ERROR_CODES, g as RequestInvalidError, h as ResponseTooLargeError, S as SessionFailedError, V as ValidationError, p as parseRetryAfter } from './errors-CgJcEjrZ.js';
1
+ import { R as RpCredentials, C as CertificateLevel, I as Interaction, S as SignatureAlgorithm, H as HashAlgorithm, N as NotificationSession, D as DeviceLinkSession, a as SessionResult, P as PersonBlock, b as RepresentationsResponse, A as AcspContext, F as FlowType } from './browser-BaDpcNNs.js';
2
+ export { c as DEFAULT_SIGN_SESSION_TTL_MS, E as EndResult, d as NavigatorLike, O as OrgResult, e as Representation, f as SessionPresentation, g as SessionState, h as SignContext, i as SignatureAlgorithmParameters, j as SignatureProtocol, T as TokenCertSessionBlock, k as TokenCertStatus, l as isMobileUserAgent, p as parseExpiresAt, s as sessionExpiry, m as startExpiry } from './browser-BaDpcNNs.js';
5
3
  import { X509Certificate, KeyObject } from 'node:crypto';
4
+ import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-BN0Fp3qd.js';
5
+ export { a as AppTransactionTooLargeError, b as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, F as ForbiddenError, N as NetworkError, c as NoSigningCertificateError, d as ON_BEHALF_ERROR_CODES, P as PDF_REGISTER_ERROR_CODES, e as PdfRegisterErrorCode, Q as QrTokenInvalidError, f as RETRYABLE_ERROR_CODES, g as RequestInvalidError, h as ResponseTooLargeError, S as SealApproverUnavailableError, i as SealCertificateRequestError, j as SealRequestNotFoundError, k as SealRequestOutcome, l as SessionFailedError, V as ValidationError, p as parseRetryAfter } from './errors-BN0Fp3qd.js';
6
6
 
7
7
  interface HttpConfig {
8
8
  /** RP-API-ийн бүтэн суурь URL. Ж: https://rp.eidmongolia.mn */
@@ -410,6 +410,115 @@ declare class OrganizationApi {
410
410
  getRepresentations(personEtsi: string): Promise<RepresentationsResponse>;
411
411
  }
412
412
 
413
+ /** `GET /seal/certificate/{orgEtsi}` (CA `dto.SealCertificateResponse`). */
414
+ interface SealCertificate {
415
+ orgEtsi: string;
416
+ /** DER. */
417
+ certificate: Uint8Array;
418
+ serialNumber: string;
419
+ subjectDn: string;
420
+ issuerDn: string;
421
+ /** RFC 3339. */
422
+ notBefore: string;
423
+ notAfter: string;
424
+ certificateLevel: CertificateLevel | string;
425
+ /** Серверийн түүхий JSON. */
426
+ raw: unknown;
427
+ }
428
+ /** Тамганы гэрчилгээний хүсэлтийн төлөв (CA `dto.SealCertificateRequestResponse.status`). */
429
+ type SealCertificateRequestStatus = "PENDING" | "APPROVED" | "ISSUED" | "REJECTED" | "EXPIRED" | "FAILED";
430
+ /**
431
+ * `POST /seal/certificate/{orgEtsi}` (202) ба `GET /seal/certificate/{orgEtsi}/requests/{requestId}` (CA
432
+ * `dto.SealCertificateRequestResponse`).
433
+ */
434
+ interface SealCertificateRequest {
435
+ requestId: string;
436
+ orgEtsi: string;
437
+ /** PENDING / APPROVED — хүлээнэ; ISSUED — `certificate` бөглөгдсөн; REJECTED / EXPIRED / FAILED — шинэ хүсэлт. */
438
+ status: SealCertificateRequestStatus | string;
439
+ /** RFC 3339. */
440
+ createdAt: string;
441
+ /** RFC 3339 — батлах хугацааны төгсгөл (дараа нь EXPIRED). */
442
+ expiresAt: string;
443
+ decidedAt?: string;
444
+ /** PIN2 push илгээсэн ADMIN-ийн тоо (шинэ/PENDING хариунд). */
445
+ approvers?: number;
446
+ /** FAILED/EXPIRED үеийн машин код: `EXPIRED` | `SEAL_ISSUANCE_FAILED` | `PUSH_FAILED`. */
447
+ failure?: string;
448
+ /** ISSUED үед — {@link SealApi.getCertificate}-тэй ижил хэлбэр. */
449
+ certificate?: SealCertificate;
450
+ raw: unknown;
451
+ }
452
+ /** {@link SealApi.waitForCertificate}-ийн сонголт. */
453
+ interface SealWaitOptions {
454
+ /** Нийт хүлээх дээд хугацаа (мс). Анхдагч {@link DEFAULT_SEAL_WAIT_TIMEOUT_MS}. */
455
+ timeoutMs?: number;
456
+ /** Poll хоорондын зай (мс). Анхдагч {@link DEFAULT_SEAL_POLL_INTERVAL_MS}; 429/503-ын Retry-After илүү бол түүнийг дагана. */
457
+ intervalMs?: number;
458
+ /** Цуцлах — тасармагц `signal.reason`-ыг шиднэ. */
459
+ signal?: AbortSignal;
460
+ }
461
+ /** `waitForCertificate`-ийн анхдагч хүлээх хугацаа — CA-ийн батлах цонх (sign session TTL + 2 мин)-оос урт. */
462
+ declare const DEFAULT_SEAL_WAIT_TIMEOUT_MS: number;
463
+ /** `waitForCertificate`-ийн анхдагч poll зай (CA зөвлөмж 2–5 с). */
464
+ declare const DEFAULT_SEAL_POLL_INTERVAL_MS = 3000;
465
+ /** `POST /seal/{orgEtsi}` (CA `dto.SealResponse`). */
466
+ interface SealResult {
467
+ orgEtsi: string;
468
+ /** digest дээрх ECDSA гарын үсэг (ASN.1 DER). */
469
+ signature: Uint8Array;
470
+ /** ж: `ecdsa-with-SHA256` (digest-ийн hash-аас). */
471
+ signatureAlgorithm: string;
472
+ /** Тамгалсан гэрчилгээ (DER). */
473
+ certificate: Uint8Array;
474
+ certificateLevel: CertificateLevel | string;
475
+ /** RFC 3339. */
476
+ sealedAt: string;
477
+ raw: unknown;
478
+ }
479
+ /**
480
+ * e-Seal профайл: KeyUsage-д nonRepudiation (contentCommitment) байгаа, digitalSignature байхгүй, EKU байхгүй, CA биш
481
+ * (CA/SDK шалгагчийн `usage: "seal"` ангилалтай ижил; Go `eid.IsSealCertificate`).
482
+ */
483
+ declare function isSealCertificate(cert: X509Certificate | Uint8Array): boolean;
484
+ declare class SealApi {
485
+ private readonly http;
486
+ constructor(http: Http);
487
+ /**
488
+ * `GET /seal/certificate/{orgEtsi}` — байгууллагын одоогийн (хамгийн сүүлд олгогдсон, идэвхтэй) тамганы гэрчилгээ
489
+ * (PAdES-ийн signerCert). Шинээр олгохгүй — олголт {@link requestCertificate}. Идэвхтэй cert алга / цуцлагдсан бол 409.
490
+ */
491
+ getCertificate(orgEtsi: string): Promise<SealCertificate>;
492
+ /**
493
+ * `POST /seal/certificate/{orgEtsi}` — тамганы гэрчилгээний ХҮСЭЛТ (202, `status: "PENDING"`). Байгууллагын ADMIN
494
+ * төлөөлөгч(ид) eID аппаараа PIN2-оор батална; {@link waitForCertificate} / {@link getCertificateRequest}-ээр асууна.
495
+ * Байгууллагад PENDING хүсэлт байвал CA түүнийг буцаана (шинэ push үгүй). Алдаа: 409 {@link
496
+ * SealApproverUnavailableError} (идэвхтэй төхөөрөмжтэй ADMIN алга), 409 `ApiError` (байгууллага ACTIVE биш), 403
497
+ * `ForbiddenError` (`SEAL:<orgEtsi>` эрхгүй), 404 (байгууллага олдсонгүй), 429 `RATE_LIMITED` (байгууллагад 5/цаг;
498
+ * `retryAfterMs`).
499
+ */
500
+ requestCertificate(orgEtsi: string): Promise<SealCertificateRequest>;
501
+ /**
502
+ * `GET /seal/certificate/{orgEtsi}/requests/{requestId}` — хүсэлтийн төлөв; ISSUED үед `certificate` бөглөгдөнө. Олдоогүй
503
+ * (эсвэл өөр байгууллагынх) → {@link SealRequestNotFoundError} 404.
504
+ */
505
+ getCertificateRequest(orgEtsi: string, requestId: string): Promise<SealCertificateRequest>;
506
+ /**
507
+ * Хүсэлт ISSUED болтол `intervalMs` тутамд асууж олгогдсон гэрчилгээг буцаана. REJECTED / EXPIRED / FAILED →
508
+ * {@link SealCertificateRequestError} (`outcome`, `failure`; шинэ хүсэлт хэрэгтэй); `timeoutMs` дуусвал `outcome:
509
+ * "TIMEOUT"` (хүсэлт серверт PENDING хэвээр — ижил `requestId`-аар дахин хүлээж болно). Түр алдаа (`ApiError.retryable`:
510
+ * 429/503 + Retry-After) — Retry-After-ийг хүлээгээд үргэлжилнэ; бусад алдаа шууд шидэгдэнэ.
511
+ */
512
+ waitForCertificate(orgEtsi: string, requestId: string, opts?: SealWaitOptions): Promise<SealCertificate>;
513
+ /**
514
+ * `POST /seal/{orgEtsi}` — digest-ийг байгууллагын тамгаар тамгална. `hashAlgorithm`: SHA-256 (анхдагч) | SHA-384 |
515
+ * SHA-512; digest-ийн урт таарахгүй бол сүлжээнд гарахгүй. Хариуны гарын үсгийг хариуны гэрчилгээгээр digest дээр
516
+ * шалгаж, гэрчилгээ e-Seal ({@link isSealCertificate}) эсэхийг тулгана — эс бөгөөс ValidationError. Гинж/цуцлалтыг
517
+ * `sealPdf` (OCSP/CRL) шалгана.
518
+ */
519
+ seal(orgEtsi: string, digest: Uint8Array, hashAlgorithm?: HashAlgorithm): Promise<SealResult>;
520
+ }
521
+
413
522
  /** Токенд холбогдсон байгууллага. */
414
523
  interface TokenOrganization {
415
524
  etsi: string;
@@ -1447,6 +1556,8 @@ declare class EidClient {
1447
1556
  readonly auth: AuthApi;
1448
1557
  readonly sign: SignApi;
1449
1558
  readonly organization: OrganizationApi;
1559
+ /** Байгууллагын цахим тамга (e-Seal) — `SEAL:<orgEtsi>` эрх. */
1560
+ readonly seal: SealApi;
1450
1561
  readonly person: PersonApi;
1451
1562
  readonly token: TokenApi;
1452
1563
  /** «Миний QR» (биечлэн шалгах): parse → start → result / check. */
@@ -1483,6 +1594,11 @@ declare const PDF_SIGNATURE_REGISTER_FIELDS: readonly ["docID", "revIndex", "med
1483
1594
  * 0329ef95, !371). CA үл мэдэгдэх талбарыг 400 REQUEST_INVALID-аар татгалздаг. Live discovery-ийн `endpoints.share`
1484
1595
  * тайлбартай гэрээний тест тулгана.
1485
1596
  */
1597
+ /**
1598
+ * `POST /seal/{orgEtsi}`-ийн биеийн талбарууд, SDK-ийн илгээдэг — CA `server/internal/dto/org_dtos.go` `SealRequest`-ийн
1599
+ * JSON tag (`relyingPartyUUID`/`relyingPartyName` нь CA-д заавал биш). CA `DisallowUnknownFields`.
1600
+ */
1601
+ declare const SEAL_REQUEST_FIELDS: readonly ["digest", "hashType"];
1486
1602
  declare const SHARE_FORM_FIELDS: readonly ["file", "filename", "to", "subject", "message", "lang"];
1487
1603
 
1488
1604
  interface OcspCheckerOptions {
@@ -1873,4 +1989,4 @@ declare function withReturnHint(callbackUrl: string, userAgent: string): string;
1873
1989
  */
1874
1990
  declare function createEidLogin(opts: EidLoginOptions): EidLogin;
1875
1991
 
1876
- export { APP_ATTESTATION_INVALID, AcspContext, type AcspV2Params, type ActivityCounts, type ActivityItem, type ActivityQuery, ApiError, AuthApi, type AuthDefaults, type AuthOptions, type BuildDeviceLinkInput, CITIZEN_INTERMEDIATES_PEM, CITIZEN_ISSUING_CA_SKI, CSR_KEY_REUSED, type CertChoiceOptions, type CertCounts, type CertSubject, CertificateLevel, type ClientConfig, type CompletedForRegistration, DEFAULT_BASE_URL, DEFAULT_MAX_WAIT_MS, DEFAULT_PDF_TIMEOUT_MS, DEFAULT_QR_ISSUER, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, EidError, type EidLogin, type EidLoginContext, type EidLoginEvent, type EidLoginEventKind, type EidLoginIdentity, type EidLoginMode, type EidLoginOptions, type EidLoginRateLimitFn, type EidLoginRateLimits, type EidLoginRateRule, type EidLoginRequest, type EidLoginResponse, type EidLoginStore, type EidLoginSuccess, type EidLoginTx, FlowType, HashAlgorithm, Http, type HttpConfig, HttpErrorInit, Interaction, KYC_INCOMPLETE, LoginStoreFullError, MAX_APP_TRANSACTION_BYTES, MEMORY_LOGIN_STORE_MAX, NATIONAL_ROOT_CA_PEM, NO_ACTIVE_DEVICE, NotificationSession, type OcspCheckerOptions, OnBehalfErrorCode, OrganizationApi, PDF_SIGNATURE_REGISTER_FIELDS, type ParsedQr, type PdfDigestInput, type PdfDigestSession, type PdfDigestSigner, type PersonActivity, PersonApi, PersonBlock, type PersonCertificate, type PersonCertificates, type PersonChild, type PersonChildren, type PersonDevice, type PersonDevices, type PersonSummary, type PriorSignature, QR_CLOCK_SKEW_SECONDS, QR_ERROR_CODES, QR_LIMITS, QR_MAX_AGE_SECONDS, QR_PREFIX, QrApi, type QrApiDeps, type QrCheck, type QrClaims, type QrConfig, type QrDeviceLinkTickerOptions, QrError, type QrErrorCode, type QrExpect, type QrPresentation, type QrSession, type QrSigner, type QrStartInput, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, RetryableErrorCode, type RevocationChecker, type RevocationOutcome, type RevocationStatus, RpCredentials, SHARE_ERROR_CODES, SHARE_FORM_FIELDS, SessionApi, SessionResult, type SessionTtl, ShareError, type ShareErrorCode, type ShareInfo, type ShareInput, type ShareNotSignedReason, type ShareResult, SignApi, type SignDefaults, type SignOptions, SignatureAlgorithm, type Signer, type SignerRef, TOKEN_CONFLICT_CODES, TOKEN_ERROR_CODES, TOKEN_ISSUANCE_PENDING, TokenApi, type TokenAuthChallenge, type TokenAuthResult, type TokenCertInfo, type TokenCertInput, type TokenCertItem, type TokenCertPreview, type TokenCertResult, type TokenCertStart, type TokenConflictCode, type TokenErrorCode, type TokenIdentity, type TokenLimit, type TokenOrganization, type TrustConfig, type ValidateAuthOptions, type ValidateSignOptions, type VerifiedIdentity, type VerifiedSignature, WAIT_GRACE_MS, acspV2Digest, buildAcspV2Payload, buildDeviceLink, buildRegisterBody, certificateLevelOf, createEidLogin, defaultRateLimit, deviceLinkInput, forwardedClientIp, interactionsToBase64, memoryLoginStore, ocspRevocationChecker, parseQr, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, qrStatement, randomChallenge, registrationFromCompleted, resolveBaseUrl, sessionSecretDigest, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyQrPresentation, verifySessionSecretDigest, verifyTokenCertificates, withReturnHint };
1992
+ export { APP_ATTESTATION_INVALID, AcspContext, type AcspV2Params, type ActivityCounts, type ActivityItem, type ActivityQuery, ApiError, AuthApi, type AuthDefaults, type AuthOptions, type BuildDeviceLinkInput, CITIZEN_INTERMEDIATES_PEM, CITIZEN_ISSUING_CA_SKI, CSR_KEY_REUSED, type CertChoiceOptions, type CertCounts, type CertSubject, CertificateLevel, type ClientConfig, type CompletedForRegistration, DEFAULT_BASE_URL, DEFAULT_MAX_WAIT_MS, DEFAULT_PDF_TIMEOUT_MS, DEFAULT_QR_ISSUER, DEFAULT_SEAL_POLL_INTERVAL_MS, DEFAULT_SEAL_WAIT_TIMEOUT_MS, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, EidError, type EidLogin, type EidLoginContext, type EidLoginEvent, type EidLoginEventKind, type EidLoginIdentity, type EidLoginMode, type EidLoginOptions, type EidLoginRateLimitFn, type EidLoginRateLimits, type EidLoginRateRule, type EidLoginRequest, type EidLoginResponse, type EidLoginStore, type EidLoginSuccess, type EidLoginTx, FlowType, HashAlgorithm, Http, type HttpConfig, HttpErrorInit, Interaction, KYC_INCOMPLETE, LoginStoreFullError, MAX_APP_TRANSACTION_BYTES, MEMORY_LOGIN_STORE_MAX, NATIONAL_ROOT_CA_PEM, NO_ACTIVE_DEVICE, NotificationSession, type OcspCheckerOptions, OnBehalfErrorCode, OrganizationApi, PDF_SIGNATURE_REGISTER_FIELDS, type ParsedQr, type PdfDigestInput, type PdfDigestSession, type PdfDigestSigner, type PersonActivity, PersonApi, PersonBlock, type PersonCertificate, type PersonCertificates, type PersonChild, type PersonChildren, type PersonDevice, type PersonDevices, type PersonSummary, type PriorSignature, QR_CLOCK_SKEW_SECONDS, QR_ERROR_CODES, QR_LIMITS, QR_MAX_AGE_SECONDS, QR_PREFIX, QrApi, type QrApiDeps, type QrCheck, type QrClaims, type QrConfig, type QrDeviceLinkTickerOptions, QrError, type QrErrorCode, type QrExpect, type QrPresentation, type QrSession, type QrSigner, type QrStartInput, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, RetryableErrorCode, type RevocationChecker, type RevocationOutcome, type RevocationStatus, RpCredentials, SEAL_REQUEST_FIELDS, SHARE_ERROR_CODES, SHARE_FORM_FIELDS, SealApi, type SealCertificate, type SealCertificateRequest, type SealCertificateRequestStatus, type SealResult, type SealWaitOptions, SessionApi, SessionResult, type SessionTtl, ShareError, type ShareErrorCode, type ShareInfo, type ShareInput, type ShareNotSignedReason, type ShareResult, SignApi, type SignDefaults, type SignOptions, SignatureAlgorithm, type Signer, type SignerRef, TOKEN_CONFLICT_CODES, TOKEN_ERROR_CODES, TOKEN_ISSUANCE_PENDING, TokenApi, type TokenAuthChallenge, type TokenAuthResult, type TokenCertInfo, type TokenCertInput, type TokenCertItem, type TokenCertPreview, type TokenCertResult, type TokenCertStart, type TokenConflictCode, type TokenErrorCode, type TokenIdentity, type TokenLimit, type TokenOrganization, type TrustConfig, type ValidateAuthOptions, type ValidateSignOptions, type VerifiedIdentity, type VerifiedSignature, WAIT_GRACE_MS, acspV2Digest, buildAcspV2Payload, buildDeviceLink, buildRegisterBody, certificateLevelOf, createEidLogin, defaultRateLimit, deviceLinkInput, forwardedClientIp, interactionsToBase64, isSealCertificate, memoryLoginStore, ocspRevocationChecker, parseQr, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, qrStatement, randomChallenge, registrationFromCompleted, resolveBaseUrl, sessionSecretDigest, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyQrPresentation, verifySessionSecretDigest, verifyTokenCertificates, withReturnHint };