@gerege-systems/eid-mongolia-sdk 0.21.0 → 0.23.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 CHANGED
@@ -253,6 +253,12 @@ RP талд нэмэлт шалгалт хэрэггүй. Эх сурвалж: e
253
253
  порталын зан: тасалдлыг decoy-оор нуувал иргэн дуусахгүй spinner харна; эдгээр нь дугаараас хамаардаггүй тул oracle
254
254
  биш). Унтраах: `decoy: false`, `pushFloorMs: 0` — **⚠️** тэгвэл `/start` нь «энэ регистр eID-д бүртгэлтэй эсэх»-ийг
255
255
  нэвтрээгүй хэнд ч хэлнэ; зөвхөн дотоод/тестийн орчинд.
256
+ - **Хугацаа (`ttlMs`, анхдагч 120 000) CA-ийн session-оос урт байхгүй.** QR / Web2App: `expiresIn`, cookie `Max-Age`,
257
+ store = min(`ttlMs`, CA-ийн start хариуны `expiresAt` − одоо). Push (бодит ба decoy **ижил**): min(`ttlMs`, discovery
258
+ `sessionTtl.auth`) — decoy-д CA хариу байхгүй тул CA-ийн `expiresAt`-аас бус discovery-оос (`client.auth.sessionTtl()`,
259
+ 10 мин кэш, алдаа бол `onError` + 1 мин-ийн дараа дахин) — хугацааны зөрүү oracle болохгүй. Хуучин CA (discovery-д
260
+ `sessionTtl` алга): бодит push-ийн `expiresAt`-аас ажигласан утгыг дараагийн decoy авна (±1 с); анхны бодит push-ээс
261
+ өмнө `ttlMs`.
256
262
  - **Гэрчилгээний цуцлалт (OCSP, анхдагчаар асаалттай).** `validateAuth`-ийн дараа, `onSuccess`-ийн өмнө иргэний гэрчилгээг
257
263
  түүний AIA-д бичигдсэн OCSP responder-оос асууна (`revocation`, анхдагч `ocspRevocationChecker()`; хариу олгогч эсвэл
258
264
  түүний OCSPSigning responder-ийн гарын үсэгтэй, энэ serial-ийн, thisUpdate ≤ 48 цаг, good-ийг 5 мин кэшлэнэ). `revoked`,
@@ -381,7 +387,8 @@ RAW_DIGEST_SIGNATURE-д `flowType` гарын үсэгт ордоггүй (зө
381
387
  **`expiresAt`** (ms epoch) — session дуусах мөч: CA-ийн session start хариуны `expiresAt` (RFC 3339; auth / sign /
382
388
  certificate-choice бүгдэд, 2026-10-14-өөс). Хуучин CA (талбаргүй) үед sign / certificate-choice-д SDK тооцоолно — CA-ийн
383
389
  анхдагч 600с (`DEFAULT_SIGN_SESSION_TTL_MS`; CA админ 60–1800с болгож болно → `signSessionTtlMs`), auth-д undefined.
384
- Эцсийн үнэн нь `GET /session` (`TIMEOUT`).
390
+ Эцсийн үнэн нь `GET /session` (`TIMEOUT`). CA-ийн тохиргооны амьд утга: `client.auth.sessionTtl()` — discovery
391
+ `sessionTtl` (`{ authMs, signMs }`; хуучин CA-д 0).
385
392
 
386
393
  **Session эхлэх алдаа** (`ApiError`-ийн дэд анги, `.code`-той): `NoSigningCertificateError` — 409
387
394
  `NO_SIGNING_CERTIFICATE` (sign / certificate-choice start: иргэнд идэвхтэй төхөөрөмж / хүчинтэй
@@ -465,18 +472,31 @@ Session-ий `onBehalfOf` блок (`role`/`roleLabel`/`rightType`/`rightTypeLab
465
472
  нэр: `keyCompromise`, `superseded`, `cessationOfOperation` …). `status` өөрчлөгдөхгүй: сунгалт/дахин бүртгэлээр
466
473
  солигдсон мөр `SUSPENDED` + `revocationReason: "superseded"`, `revokedAt`-гүй.
467
474
 
475
+ `keyMedium: "TOKEN"` мөрөнд `organization?` (байгууллагын токен) ба `tokenSerial?` — гэрчилгээ олгогдсон USB токены
476
+ серийн дугаар. Нэг токены AUTH + SIGN-ийг байгууллага/огноогоор таамаглахгүй, `tokenSerial`-аар бүлэглэ (сунгалтаар
477
+ солигдсон мөр ч өөрийн токены дугаартай). MOBILE/HSM мөрөнд болон хуучин CA-д талбар байхгүй.
478
+
479
+ ```ts
480
+ const { certificates } = await eid.person.certificates(etsi);
481
+ const byToken = Map.groupBy(certificates.filter((c) => c.tokenSerial), (c) => c.tokenSerial!);
482
+ ```
483
+
468
484
  ## 3c. USB токен
469
485
 
470
486
  ```ts
471
487
  import { verifyTokenCertificates, tokenAuthDigest, tokenLimitOf } from "@gerege-systems/eid-mongolia-sdk";
472
488
 
473
489
  // гэрчилгээ олголт (TOKEN_ISSUE эрх) — иргэн утсаараа PIN2-оор батална
474
- const st = await eid.token.issueCertificate({ signerEtsi, csrAuth, csrSign, tokenSerial: "EP2003-0042A1" }); // onBehalfOf алга = хувийн
490
+ const input = { signerEtsi, csrAuth, csrSign, tokenSerial: "EP2003-0042A1" }; // onBehalfOf алга = хувийн
491
+ // push-ээс ӨМНӨ: ижил оролтоор dryRun — session/push үүсэхгүй, алдааны код бодиттой ижил
492
+ const pv = await eid.token.previewCertificate(input); // pv.supersedes байвал иргэнд анхааруулж зөвшөөрүүлээд ↓
493
+ const st = await eid.token.issueCertificate(input);
475
494
  // … eid.session.poll(st.sessionId) → result.tokenCertificate?.status === "ISSUED"
476
495
  const res = await eid.token.certificateResult(st.sessionId);
477
496
  verifyTokenCertificates(res, csrAuth, csrSign); // гэрчилгээ бүр CSR-ийн түлхүүртэй
478
497
  // 409 TOKEN_LIMIT_REACHED → tokenLimitOf(err): { kind, limit, organization? }
479
498
  // 409 TOKEN_IN_USE — serial өөр иргэнд; 409 TOKEN_SCOPE_CHANGE — сунгалт scope солих гэсэн (доор)
499
+ // 400 APP_ATTESTATION_INVALID — appTransaction ирсэн боловч хүчингүй (доор)
480
500
 
481
501
  // токеноор нэвтрэх (AUTH эрх)
482
502
  const ch = await eid.token.authChallenge();
@@ -496,6 +516,29 @@ const who = await eid.token.authVerify(ch, authCertDer, rs);
496
516
  байхгүй. Scope солих = иргэн eID апп-аас токеноо цуцлаад (`/v3/mobile/tokens/{tokenSerial}/revoke`) шинээр олгуулна;
497
517
  хэрэглэгчид: «Токены төрлийг (хувийн/байгууллага) солихын тулд eID апп-аас токеныг цуцлаад шинээр олгуулна уу».
498
518
 
519
+ **Хувийн токены автомат солилт** (CA 2026-10-19, discovery `tokenCertificate.personalAutoSupersede: true`): хувийн
520
+ хязгаар хүрсэн үед өөр `tokenSerial`-тай шинэ хувийн токен 409 биш — `st.supersedes` (`{ tokenSerial }[]`) ирнэ; хувийн
521
+ токенд шинэ олголт амжилттай болбол (PIN2 + гэрчилгээ) өмнөх хувийн токены AUTH + SIGN superseded (4)-оор цуцлагдана.
522
+ Татгалзсан / хугацаа дууссан олголт өмнөхийг хөндөхгүй. PIN2-оос өмнө: «Таны өмнөх USB токен (EP2003-…)-ийн гэрчилгээ
523
+ хүчингүй болно». 409 `TOKEN_LIMIT_REACHED` `kind: "PERSONAL"` зөвхөн `limit: 0` (хувийн олголт хаалттай) үед;
524
+ байгууллагын токен хатуу хязгаар хэвээр.
525
+
526
+ **dryRun — push-ээс өмнөх шалгалт** (CA 2026-10-19, discovery `tokenCertificate.dryRun: true` —
527
+ `certificateInfo().dryRun`): `issueCertificate`-ийн хариунд `supersedes` ирэх үед утас руу PIN2 push явсан байдаг —
528
+ desktop дээр цуцалсан ч иргэн утсаараа баталбал хуучин токен солигдоно. Тиймээс урсгал: CSR →
529
+ `eid.token.previewCertificate(input)` (бие нь ижил + `"dryRun": true`; бүх шалгалт, ижил алдааны код — өөр CSR хостой
530
+ хүлээгдэж буй олголт `409 TOKEN_ISSUANCE_PENDING` ч; session / push / state үүсэхгүй) → `supersedes` байвал анхааруулга,
531
+ иргэн зөвшөөрөх → `issueCertificate(input)`. Хурдны хязгаар (RP, иргэн) 20/мин ба RP нийт 120/10 мин — push-ийн 3/цагийг
532
+ зарцуулахгүй. Хариунд `dryRun: true` ирээгүй бол `ValidationError` (хуучин CA танихгүй талбарт 400 буцаана).
533
+
534
+ **Апп баталгаа (`appTransaction`, заавал биш)** (CA 2026-10-19, discovery `tokenCertificate.appTransaction:
535
+ "optional"` — `eid.token.certificateInfo().appTransaction`): macOS App Store build нь StoreKit 2 `AppTransaction`-ийн
536
+ JWS (compact) мөрийг desktop-оос дамжуулна — `issueCertificate({ …, appTransaction: jws })`. CA Apple-ийн сервер рүү
537
+ дуудахгүй, offline шалгана; ирсэн бол заавал хүчинтэй, эс бөгөөс 400 `APP_ATTESTATION_INVALID` (SDK-ийн
538
+ тогтмол; аль алхам унасныг хэлэхгүй, утас руу push явахгүй). Хоосон/алга (Windows) = баталгаагүй олголт.
539
+ `MAX_APP_TRANSACTION_BYTES` (16 KiB)-аас их бол SDK илгээхгүй, `AppTransactionTooLargeError` шиднэ. Хуучин CA-д талбар
540
+ илгээвэл 400.
541
+
499
542
  `/token/auth/*` нь `/.well-known/eid`-ийн `endpoints.token.auth_challenge` / `auth_verify`-д жагсаагдсан (AUTH эрх) —
500
543
  гэрээний тест бусад route-ийн адил шалгана.
501
544
 
@@ -1,4 +1,4 @@
1
- import './errors-xTmsGXyo.js';
1
+ import './errors-BM8D3VEw.js';
2
2
 
3
3
  /** isMobileUserAgent-ийн уншдаг navigator-ийн хэсэг (тестэд орлуулна). */
4
4
  interface NavigatorLike {
@@ -1,4 +1,4 @@
1
- import './errors-xTmsGXyo.cjs';
1
+ import './errors-BM8D3VEw.cjs';
2
2
 
3
3
  /** isMobileUserAgent-ийн уншдаг navigator-ийн хэсэг (тестэд орлуулна). */
4
4
  interface NavigatorLike {
@@ -1,2 +1,2 @@
1
- export { D as DeviceLinkSession, d as NavigatorLike, k as isMobileUserAgent } from './browser-2PTCiFt_.cjs';
2
- export { D as DeviceLinkError, E as EidError } from './errors-xTmsGXyo.cjs';
1
+ export { D as DeviceLinkSession, d as NavigatorLike, k as isMobileUserAgent } from './browser-Df4wTfZx.cjs';
2
+ export { D as DeviceLinkError, E as EidError } from './errors-BM8D3VEw.cjs';
package/dist/browser.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { D as DeviceLinkSession, d as NavigatorLike, k as isMobileUserAgent } from './browser-DBR6ziM5.js';
2
- export { D as DeviceLinkError, E as EidError } from './errors-xTmsGXyo.js';
1
+ export { D as DeviceLinkSession, d as NavigatorLike, k as isMobileUserAgent } from './browser-BYY0cP2D.js';
2
+ export { D as DeviceLinkError, E as EidError } from './errors-BM8D3VEw.js';
package/dist/browser.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  DeviceLinkError,
6
6
  EidError
7
- } from "./chunk-ZB7LEWA5.js";
7
+ } from "./chunk-H7JOACAZ.js";
8
8
  export {
9
9
  DeviceLinkError,
10
10
  EidError,
@@ -144,6 +144,8 @@ var SessionFailedError = class extends EidError {
144
144
  };
145
145
  var ValidationError = class extends EidError {
146
146
  };
147
+ var AppTransactionTooLargeError = class extends EidError {
148
+ };
147
149
  var DeviceLinkError = class extends EidError {
148
150
  };
149
151
 
@@ -164,5 +166,6 @@ export {
164
166
  maskPath,
165
167
  SessionFailedError,
166
168
  ValidationError,
169
+ AppTransactionTooLargeError,
167
170
  DeviceLinkError
168
171
  };
@@ -150,6 +150,12 @@ declare class SessionFailedError extends EidError {
150
150
  */
151
151
  declare class ValidationError extends EidError {
152
152
  }
153
+ /**
154
+ * `token.issueCertificate`-ийн `appTransaction` `MAX_APP_TRANSACTION_BYTES` (16 KiB)-аас их — SDK CA руу
155
+ * илгээхгүй. Програмын/клиентийн алдаа.
156
+ */
157
+ declare class AppTransactionTooLargeError extends EidError {
158
+ }
153
159
  /**
154
160
  * Device-link (App2App/Web2App) холбоос угсрах боломжгүй — хариунд `deviceLinkBase` байхгүй,
155
161
  * эсвэл sessionId/vc/суурь URL хэлбэр буруу. Session-ийг дахин эхлүүлнэ; холбоосыг таахгүй.
@@ -157,4 +163,4 @@ declare class ValidationError extends EidError {
157
163
  declare class DeviceLinkError extends EidError {
158
164
  }
159
165
 
160
- export { ApiError as A, CertChoiceInvalidError as C, DeviceLinkError as D, EidError as E, ForbiddenError as F, type HttpErrorInit as H, NetworkError as N, ON_BEHALF_ERROR_CODES as O, PDF_REGISTER_ERROR_CODES as P, RETRYABLE_ERROR_CODES as R, SessionFailedError as S, ValidationError as V, AuthenticationError as a, NoSigningCertificateError as b, type OnBehalfErrorCode as c, type PdfRegisterErrorCode as d, RequestInvalidError as e, ResponseTooLargeError as f, type RetryableErrorCode as g, parseRetryAfter as p };
166
+ export { ApiError as A, CertChoiceInvalidError as C, DeviceLinkError as D, EidError as E, ForbiddenError as F, type HttpErrorInit as H, NetworkError as N, ON_BEHALF_ERROR_CODES as O, PDF_REGISTER_ERROR_CODES as P, RETRYABLE_ERROR_CODES as R, SessionFailedError as S, ValidationError as V, AppTransactionTooLargeError as a, AuthenticationError as b, NoSigningCertificateError as c, type OnBehalfErrorCode as d, type PdfRegisterErrorCode as e, RequestInvalidError as f, ResponseTooLargeError as g, type RetryableErrorCode as h, parseRetryAfter as p };
@@ -150,6 +150,12 @@ declare class SessionFailedError extends EidError {
150
150
  */
151
151
  declare class ValidationError extends EidError {
152
152
  }
153
+ /**
154
+ * `token.issueCertificate`-ийн `appTransaction` `MAX_APP_TRANSACTION_BYTES` (16 KiB)-аас их — SDK CA руу
155
+ * илгээхгүй. Програмын/клиентийн алдаа.
156
+ */
157
+ declare class AppTransactionTooLargeError extends EidError {
158
+ }
153
159
  /**
154
160
  * Device-link (App2App/Web2App) холбоос угсрах боломжгүй — хариунд `deviceLinkBase` байхгүй,
155
161
  * эсвэл sessionId/vc/суурь URL хэлбэр буруу. Session-ийг дахин эхлүүлнэ; холбоосыг таахгүй.
@@ -157,4 +163,4 @@ declare class ValidationError extends EidError {
157
163
  declare class DeviceLinkError extends EidError {
158
164
  }
159
165
 
160
- export { ApiError as A, CertChoiceInvalidError as C, DeviceLinkError as D, EidError as E, ForbiddenError as F, type HttpErrorInit as H, NetworkError as N, ON_BEHALF_ERROR_CODES as O, PDF_REGISTER_ERROR_CODES as P, RETRYABLE_ERROR_CODES as R, SessionFailedError as S, ValidationError as V, AuthenticationError as a, NoSigningCertificateError as b, type OnBehalfErrorCode as c, type PdfRegisterErrorCode as d, RequestInvalidError as e, ResponseTooLargeError as f, type RetryableErrorCode as g, parseRetryAfter as p };
166
+ export { ApiError as A, CertChoiceInvalidError as C, DeviceLinkError as D, EidError as E, ForbiddenError as F, type HttpErrorInit as H, NetworkError as N, ON_BEHALF_ERROR_CODES as O, PDF_REGISTER_ERROR_CODES as P, RETRYABLE_ERROR_CODES as R, SessionFailedError as S, ValidationError as V, AppTransactionTooLargeError as a, AuthenticationError as b, NoSigningCertificateError as c, type OnBehalfErrorCode as d, type PdfRegisterErrorCode as e, RequestInvalidError as f, ResponseTooLargeError as g, type RetryableErrorCode as h, parseRetryAfter as p };
package/dist/index.cjs CHANGED
@@ -20,7 +20,9 @@ var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: tr
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ APP_ATTESTATION_INVALID: () => APP_ATTESTATION_INVALID,
23
24
  ApiError: () => ApiError,
25
+ AppTransactionTooLargeError: () => AppTransactionTooLargeError,
24
26
  AuthApi: () => AuthApi,
25
27
  AuthenticationError: () => AuthenticationError,
26
28
  CITIZEN_INTERMEDIATES_PEM: () => CITIZEN_INTERMEDIATES_PEM,
@@ -36,6 +38,7 @@ __export(index_exports, {
36
38
  ForbiddenError: () => ForbiddenError,
37
39
  Http: () => Http,
38
40
  LoginStoreFullError: () => LoginStoreFullError,
41
+ MAX_APP_TRANSACTION_BYTES: () => MAX_APP_TRANSACTION_BYTES,
39
42
  MEMORY_LOGIN_STORE_MAX: () => MEMORY_LOGIN_STORE_MAX,
40
43
  NATIONAL_ROOT_CA_PEM: () => NATIONAL_ROOT_CA_PEM,
41
44
  NetworkError: () => NetworkError,
@@ -239,6 +242,8 @@ var SessionFailedError = class extends EidError {
239
242
  };
240
243
  var ValidationError = class extends EidError {
241
244
  };
245
+ var AppTransactionTooLargeError = class extends EidError {
246
+ };
242
247
  var DeviceLinkError = class extends EidError {
243
248
  };
244
249
 
@@ -537,6 +542,15 @@ var AuthApi = class {
537
542
  ...expiresAt !== void 0 ? { expiresAt } : {}
538
543
  };
539
544
  }
545
+ /**
546
+ * Discovery (`/.well-known/eid`)-ийн `sessionTtl` — CA-ийн нэвтрэлт / гарын үсгийн session-ий хугацаа (мс; CA-ийн
547
+ * «Системийн тохиргоо»-оос амьд). Хуучин CA-д (талбар алга) 0.
548
+ */
549
+ async sessionTtl() {
550
+ const t = rec(rec(await this.http.get("/.well-known/eid")).sessionTtl);
551
+ const ms2 = (v) => typeof v === "number" && Number.isFinite(v) && v > 0 ? Math.floor(v) * 1e3 : 0;
552
+ return { authMs: ms2(t.auth), signMs: ms2(t.sign) };
553
+ }
540
554
  /** Push — РД/иргэний дугаар/ETSI-ээр (сервер төрлийг таьна). Иргэний утас руу мэдэгдэл очно. */
541
555
  async notificationByEtsi(id, interactions, opts) {
542
556
  const { body, acsp } = this.baseBody(randomChallenge(), interactions, ["Notification"], opts);
@@ -1897,6 +1911,8 @@ function basicConstraintsPathLen(cert) {
1897
1911
  }
1898
1912
 
1899
1913
  // src/token.ts
1914
+ var MAX_APP_TRANSACTION_BYTES = 16 * 1024;
1915
+ var APP_ATTESTATION_INVALID = "APP_ATTESTATION_INVALID";
1900
1916
  function rec4(v) {
1901
1917
  return v && typeof v === "object" ? v : {};
1902
1918
  }
@@ -1905,6 +1921,9 @@ function hexSha256Equal(hex, data) {
1905
1921
  return (0, import_node_crypto4.timingSafeEqual)((0, import_node_crypto4.createHash)("sha256").update(data).digest(), Buffer.from(hex, "hex"));
1906
1922
  }
1907
1923
  var TOKEN_CONFLICT_CODES = ["TOKEN_LIMIT_REACHED", "TOKEN_IN_USE", "TOKEN_SCOPE_CHANGE", "ACCOUNT_DELETE_PENDING"];
1924
+ function supersedesOf(v) {
1925
+ return Array.isArray(v) ? { supersedes: v.map((x) => ({ tokenSerial: String(rec4(x).tokenSerial ?? "") })) } : {};
1926
+ }
1908
1927
  var DISCOVERY_PATH = "/.well-known/eid";
1909
1928
  var TOKEN_RESULT_TIMEOUT_MS = 3e4;
1910
1929
  var TokenApi = class {
@@ -1924,11 +1943,44 @@ var TokenApi = class {
1924
1943
  * байгууллагын токен зөвхөн тэр байгууллагаар (`onBehalfOf` ижил), хувийн токен зөвхөн хувиараа. Өөр scope бол
1925
1944
  * 409 `TOKEN_SCOPE_CHANGE` (override үгүй); scope солих = иргэн eID апп-аас токеноо цуцлаад шинээр олгуулна.
1926
1945
  * Бусад 409: `TOKEN_LIMIT_REACHED` ({@link tokenLimitOf}), `TOKEN_IN_USE` ({@link TokenConflictCode}).
1946
+ * 400 {@link APP_ATTESTATION_INVALID} — `appTransaction` хүчингүй; {@link MAX_APP_TRANSACTION_BYTES}-аас их бол
1947
+ * {@link AppTransactionTooLargeError} (илгээхгүй).
1927
1948
  */
1928
1949
  async issueCertificate(input) {
1950
+ const r = rec4(await this.http.post(routePath(RP_ROUTES.tokenCertificate), this.certBody(input)));
1951
+ if (!hexSha256Equal(r.csrAuthSha256, input.csrAuth) || !hexSha256Equal(r.csrSignSha256, input.csrSign)) {
1952
+ throw new ValidationError("token: CA-\u0438\u0439\u043D csrAuthSha256/csrSignSha256 \u0438\u043B\u0433\u044D\u044D\u0441\u044D\u043D CSR-\u0442\u044D\u0439 \u0442\u0430\u0430\u0440\u0441\u0430\u043D\u0433\u04AF\u0439");
1953
+ }
1954
+ const vc = rec4(r.vc).value ?? (typeof r.vc === "string" ? r.vc : void 0);
1955
+ return {
1956
+ sessionId: String(r.sessionID ?? ""),
1957
+ vc: vc != null ? String(vc) : null,
1958
+ csrAuthSha256: String(r.csrAuthSha256).toLowerCase(),
1959
+ csrSignSha256: String(r.csrSignSha256).toLowerCase(),
1960
+ ...typeof r.expiresAt === "string" ? { expiresAt: r.expiresAt } : {},
1961
+ ...supersedesOf(r.supersedes)
1962
+ };
1963
+ }
1964
+ /**
1965
+ * POST /token/certificate `{"dryRun": true}` (CA 2026-10-19, discovery `tokenCertificate.dryRun`): {@link issueCertificate}-ийн
1966
+ * бүх шалгалт ижил алдааны кодтой, гэхдээ session / утас руу push үүсэхгүй. Урсгал: CSR → previewCertificate →
1967
+ * `supersedes` байвал иргэнд анхааруулж зөвшөөрүүлэх → issueCertificate (ижил оролт). Хурдны хязгаар (RP, иргэн) 20/мин
1968
+ * (push-ийн 3/цагийг зарцуулахгүй). Хариунд `dryRun: true` алга бол ValidationError. Хуучин CA-д 400 (танихгүй талбар).
1969
+ */
1970
+ async previewCertificate(input) {
1971
+ const r = rec4(await this.http.post(routePath(RP_ROUTES.tokenCertificate), { ...this.certBody(input), dryRun: true }));
1972
+ if (r.dryRun !== true) throw new ValidationError("token: dryRun \u0445\u0430\u0440\u0438\u0443 \u0431\u0438\u0448 (CA dryRun-\u0438\u0439\u0433 \u0434\u044D\u043C\u0436\u0438\u0445\u0433\u04AF\u0439)");
1973
+ return { ...supersedesOf(r.supersedes) };
1974
+ }
1975
+ /** Оролтыг шалгаж POST /token/certificate-ийн биеийг угсарна. CA DisallowUnknownFields — яг эдгээр талбар. */
1976
+ certBody(input) {
1929
1977
  if (!input.signerEtsi?.trim() || !input.csrAuth?.length || !input.csrSign?.length || !input.tokenSerial?.trim()) {
1930
1978
  throw new Error("token: signerEtsi, csrAuth, csrSign, tokenSerial \u0448\u0430\u0430\u0440\u0434\u043B\u0430\u0433\u0430\u0442\u0430\u0439");
1931
1979
  }
1980
+ const appTransaction = input.appTransaction?.trim() ?? "";
1981
+ if (Buffer.byteLength(input.appTransaction ?? "", "utf8") > MAX_APP_TRANSACTION_BYTES) {
1982
+ throw new AppTransactionTooLargeError("token: appTransaction 16 KiB-\u0430\u0430\u0441 \u0438\u0445");
1983
+ }
1932
1984
  const body = {
1933
1985
  relyingPartyUUID: this.creds.rpUUID,
1934
1986
  relyingPartyName: this.creds.rpName,
@@ -1940,18 +1992,8 @@ var TokenApi = class {
1940
1992
  flow: "notification"
1941
1993
  };
1942
1994
  if (input.tokenLabel) body.tokenLabel = input.tokenLabel;
1943
- const r = rec4(await this.http.post(routePath(RP_ROUTES.tokenCertificate), body));
1944
- if (!hexSha256Equal(r.csrAuthSha256, input.csrAuth) || !hexSha256Equal(r.csrSignSha256, input.csrSign)) {
1945
- throw new ValidationError("token: CA-\u0438\u0439\u043D csrAuthSha256/csrSignSha256 \u0438\u043B\u0433\u044D\u044D\u0441\u044D\u043D CSR-\u0442\u044D\u0439 \u0442\u0430\u0430\u0440\u0441\u0430\u043D\u0433\u04AF\u0439");
1946
- }
1947
- const vc = rec4(r.vc).value ?? (typeof r.vc === "string" ? r.vc : void 0);
1948
- return {
1949
- sessionId: String(r.sessionID ?? ""),
1950
- vc: vc != null ? String(vc) : null,
1951
- csrAuthSha256: String(r.csrAuthSha256).toLowerCase(),
1952
- csrSignSha256: String(r.csrSignSha256).toLowerCase(),
1953
- ...typeof r.expiresAt === "string" ? { expiresAt: r.expiresAt } : {}
1954
- };
1995
+ if (appTransaction) body.appTransaction = appTransaction;
1996
+ return body;
1955
1997
  }
1956
1998
  /** Discovery-ийн `tokenCertificate` блок. Блок байхгүй (хуучин CA) бол `enabled: false`. */
1957
1999
  async certificateInfo() {
@@ -1966,6 +2008,9 @@ var TokenApi = class {
1966
2008
  keyAlgorithm: String(t.keyAlgorithm ?? ""),
1967
2009
  onBehalfOf: String(t.onBehalfOf ?? ""),
1968
2010
  scopeLockedOnRenewal: t.scopeLockedOnRenewal === true,
2011
+ appTransaction: String(t.appTransaction ?? ""),
2012
+ personalAutoSupersede: t.personalAutoSupersede === true,
2013
+ dryRun: t.dryRun === true,
1969
2014
  raw: d.tokenCertificate
1970
2015
  };
1971
2016
  }
@@ -3332,6 +3377,38 @@ function createEidLogin(opts) {
3332
3377
  const revocation = opts.revocation === false ? void 0 : opts.revocation ?? ocspRevocationChecker();
3333
3378
  const revocationMode = opts.revocationMode ?? "soft-fail";
3334
3379
  const auditKey = opts.auditKey ?? (0, import_node_crypto7.randomBytes)(32);
3380
+ let caTtl = 0;
3381
+ let caTtlNext = 0;
3382
+ let caTtlInflight;
3383
+ function authTtl(ctx2) {
3384
+ if (Date.now() < caTtlNext) return Promise.resolve(caTtl);
3385
+ caTtlInflight ??= (async () => {
3386
+ caTtlNext = Date.now() + 6e4;
3387
+ let timer;
3388
+ try {
3389
+ const t = await Promise.race([
3390
+ client.auth.sessionTtl(),
3391
+ new Promise((_, rej) => {
3392
+ timer = setTimeout(() => rej(new Error("discovery timeout")), 2e3);
3393
+ })
3394
+ ]);
3395
+ caTtlNext = Date.now() + 6e5;
3396
+ if (t.authMs > 0) caTtl = t.authMs;
3397
+ } catch (e) {
3398
+ onError(new Error(`eid-login: discovery sessionTtl: ${e instanceof Error ? e.message : e}`), ctx2);
3399
+ } finally {
3400
+ clearTimeout(timer);
3401
+ caTtlInflight = void 0;
3402
+ }
3403
+ return caTtl;
3404
+ })();
3405
+ return caTtlInflight;
3406
+ }
3407
+ function observeAuthTtl(sent, expiresAt) {
3408
+ if (expiresAt === void 0 || caTtl > 0) return;
3409
+ const d = Math.round((expiresAt - sent) / 1e3) * 1e3;
3410
+ if (d > 0) caTtl = d;
3411
+ }
3335
3412
  const pushKey = (idCode) => (0, import_node_crypto7.createHmac)("sha256", auditKey).update(`eid-push-audit:${idCode}`).digest("hex").slice(0, 32);
3336
3413
  async function emit(kind, sessionId, meta, ctx2) {
3337
3414
  if (!opts.onEvent) return;
@@ -3406,17 +3483,20 @@ function createEidLogin(opts) {
3406
3483
  interactions: tx.acsp.interactions
3407
3484
  });
3408
3485
  }
3409
- async function begin(req, mode, idCode, lang) {
3486
+ async function begin(req, mode, idCode, lang, ttlMs) {
3487
+ const sent = Date.now();
3410
3488
  const level = opts.certificateLevel ? { certificateLevel: opts.certificateLevel } : {};
3411
3489
  let tx;
3412
3490
  let appLink;
3413
3491
  if (mode === "push") {
3414
3492
  const s = await client.auth.notificationByEtsi(idCode, interactions, level);
3415
3493
  tx = { sessionId: s.sessionId, mode, vc: s.vc, acsp: s.acsp };
3494
+ observeAuthTtl(sent, s.expiresAt);
3416
3495
  } else {
3417
3496
  const callbackUrl = mode === "web2app" ? withReturnHint(opts.callbackUrl, header(req.headers, "user-agent")) : void 0;
3418
3497
  const s = await client.auth.deviceLinkAnonymous(interactions, { ...level, callbackUrl });
3419
3498
  if (!s.deviceLinkBase || !s.sessionToken || !s.sessionSecret || !s.acsp) throw new Error("eID \u0445\u0430\u0440\u0438\u0443\u043D\u0434 device link \u0442\u0430\u043B\u0431\u0430\u0440 \u0434\u0443\u0442\u0443\u0443");
3499
+ if (s.expiresAt !== void 0) ttlMs = Math.min(ttlMs, Math.floor((s.expiresAt - Date.now()) / 1e3) * 1e3);
3420
3500
  tx = {
3421
3501
  sessionId: s.sessionId,
3422
3502
  mode,
@@ -3439,18 +3519,20 @@ function createEidLogin(opts) {
3439
3519
  });
3440
3520
  }
3441
3521
  }
3442
- return { ...await save(tx), appLink };
3522
+ if (ttlMs < 1e3) throw new Error("eID session-\u0438\u0439 \u0445\u0443\u0433\u0430\u0446\u0430\u0430 \u0434\u0443\u0443\u0441\u0441\u0430\u043D (expiresAt)");
3523
+ return { ...await save(tx, ttlMs), appLink };
3443
3524
  }
3444
- async function save(tx) {
3525
+ async function save(tx, ttlMs) {
3445
3526
  const binding = (0, import_node_crypto7.randomBytes)(32).toString("base64url");
3446
- const full = { ...tx, bindingHash: sha256hex(binding), expiresAt: Date.now() + ttl };
3447
- await store.set(full.sessionId, full, ttl);
3448
- const setCookie = `${cookieName}=${full.sessionId}.${binding}; ${cookieAttrs(Math.ceil(ttl / 1e3))}`;
3449
- return { tx: full, setCookie, appLink: void 0 };
3527
+ const full = { ...tx, bindingHash: sha256hex(binding), expiresAt: Date.now() + ttlMs };
3528
+ await store.set(full.sessionId, full, ttlMs);
3529
+ const expiresIn = Math.ceil(ttlMs / 1e3);
3530
+ const setCookie = `${cookieName}=${full.sessionId}.${binding}; ${cookieAttrs(expiresIn)}`;
3531
+ return { tx: full, setCookie, expiresIn, appLink: void 0 };
3450
3532
  }
3451
- function startDecoy() {
3533
+ function startDecoy(ttlMs) {
3452
3534
  const acsp = void 0;
3453
- return save({ sessionId: (0, import_node_crypto7.randomUUID)(), mode: "push", vc: String((0, import_node_crypto7.randomInt)(1e5)).padStart(5, "0"), acsp, decoy: true });
3535
+ return save({ sessionId: (0, import_node_crypto7.randomUUID)(), mode: "push", vc: String((0, import_node_crypto7.randomInt)(1e5)).padStart(5, "0"), acsp, decoy: true }, ttlMs);
3454
3536
  }
3455
3537
  async function start(req) {
3456
3538
  const url = new URL(req.url, "http://x");
@@ -3488,11 +3570,16 @@ function createEidLogin(opts) {
3488
3570
  if (ip && !await rateLimit(`start:${ip}`)) return limited();
3489
3571
  if (mode === "push" && !await rateLimit(`push:${idCode}`)) return limited();
3490
3572
  const began = Date.now();
3573
+ let ttlMs = ttl;
3574
+ if (mode === "push") {
3575
+ const ca = await authTtl(ctx2);
3576
+ if (ca > 0) ttlMs = Math.min(ttlMs, ca);
3577
+ }
3491
3578
  let r;
3492
3579
  let err;
3493
3580
  let decoy = false;
3494
3581
  try {
3495
- r = await begin(req, mode, idCode, lang);
3582
+ r = await begin(req, mode, idCode, lang, ttlMs);
3496
3583
  } catch (e) {
3497
3584
  err = e;
3498
3585
  }
@@ -3501,7 +3588,7 @@ function createEidLogin(opts) {
3501
3588
  onError(new Error(`eid-login: eID push-\u0438\u0439\u0433 \u0442\u0430\u0442\u0433\u0430\u043B\u0437\u0430\u0432 (${ae.status}${ae.code ? ` ${ae.code}` : ""}); decoy session-\u043E\u043E\u0440 \u0445\u0430\u0440\u0438\u0443\u043B\u0430\u0432`), ctx2);
3502
3589
  err = void 0;
3503
3590
  try {
3504
- r = await startDecoy();
3591
+ r = await startDecoy(ttlMs);
3505
3592
  decoy = true;
3506
3593
  } catch (e) {
3507
3594
  err = e;
@@ -3520,7 +3607,7 @@ function createEidLogin(opts) {
3520
3607
  }
3521
3608
  return json(
3522
3609
  200,
3523
- { mode, vc: r.tx.vc, ...mode === "qr" ? { qr: qrLink(r.tx) } : {}, expiresIn: Math.ceil(ttl / 1e3) },
3610
+ { mode, vc: r.tx.vc, ...mode === "qr" ? { qr: qrLink(r.tx) } : {}, expiresIn: r.expiresIn },
3524
3611
  { "Set-Cookie": r.setCookie }
3525
3612
  );
3526
3613
  }
@@ -3657,7 +3744,9 @@ function createEidLogin(opts) {
3657
3744
  }
3658
3745
  // Annotate the CommonJS export names for ESM import in node:
3659
3746
  0 && (module.exports = {
3747
+ APP_ATTESTATION_INVALID,
3660
3748
  ApiError,
3749
+ AppTransactionTooLargeError,
3661
3750
  AuthApi,
3662
3751
  AuthenticationError,
3663
3752
  CITIZEN_INTERMEDIATES_PEM,
@@ -3673,6 +3762,7 @@ function createEidLogin(opts) {
3673
3762
  ForbiddenError,
3674
3763
  Http,
3675
3764
  LoginStoreFullError,
3765
+ MAX_APP_TRANSACTION_BYTES,
3676
3766
  MEMORY_LOGIN_STORE_MAX,
3677
3767
  NATIONAL_ROOT_CA_PEM,
3678
3768
  NetworkError,
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-2PTCiFt_.cjs';
2
- export { c as DEFAULT_SIGN_SESSION_TTL_MS, E as EndResult, d as NavigatorLike, O as OrgResult, e as Representation, f as SessionState, g as SignContext, h as SignatureAlgorithmParameters, i as SignatureProtocol, T as TokenCertSessionBlock, j as TokenCertStatus, k as isMobileUserAgent, p as parseExpiresAt, s as sessionExpiry, l as startExpiry } from './browser-2PTCiFt_.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-Df4wTfZx.cjs';
2
+ export { c as DEFAULT_SIGN_SESSION_TTL_MS, E as EndResult, d as NavigatorLike, O as OrgResult, e as Representation, f as SessionState, g as SignContext, h as SignatureAlgorithmParameters, i as SignatureProtocol, T as TokenCertSessionBlock, j as TokenCertStatus, k as isMobileUserAgent, p as parseExpiresAt, s as sessionExpiry, l as startExpiry } from './browser-Df4wTfZx.cjs';
3
3
  import { X509Certificate, KeyObject } from 'node:crypto';
4
- import { A as ApiError, H as HttpErrorInit } from './errors-xTmsGXyo.cjs';
5
- export { a as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, E as EidError, F as ForbiddenError, N as NetworkError, b as NoSigningCertificateError, O as ON_BEHALF_ERROR_CODES, c as OnBehalfErrorCode, P as PDF_REGISTER_ERROR_CODES, d as PdfRegisterErrorCode, R as RETRYABLE_ERROR_CODES, e as RequestInvalidError, f as ResponseTooLargeError, g as RetryableErrorCode, S as SessionFailedError, V as ValidationError, p as parseRetryAfter } from './errors-xTmsGXyo.cjs';
4
+ import { A as ApiError, H as HttpErrorInit } from './errors-BM8D3VEw.cjs';
5
+ export { a as AppTransactionTooLargeError, b as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, E as EidError, F as ForbiddenError, N as NetworkError, c as NoSigningCertificateError, O as ON_BEHALF_ERROR_CODES, d as OnBehalfErrorCode, P as PDF_REGISTER_ERROR_CODES, e as PdfRegisterErrorCode, R as RETRYABLE_ERROR_CODES, f as RequestInvalidError, g as ResponseTooLargeError, h as RetryableErrorCode, S as SessionFailedError, V as ValidationError, p as parseRetryAfter } from './errors-BM8D3VEw.cjs';
6
6
 
7
7
  interface HttpConfig {
8
8
  /** RP-API-ийн бүтэн суурь URL. Ж: https://rp.eidmongolia.mn */
@@ -67,6 +67,11 @@ interface AuthOptions {
67
67
  /** ACSP_V2 payload-ийн hash (default SHA-512 — Smart-ID v3 жишээтэй ижил). */
68
68
  hashAlgorithm?: HashAlgorithm;
69
69
  }
70
+ /** Discovery-ийн `sessionTtl` (мс). 0 = хуучин CA. */
71
+ interface SessionTtl {
72
+ authMs: number;
73
+ signMs: number;
74
+ }
70
75
  declare class AuthApi {
71
76
  private readonly http;
72
77
  private readonly creds;
@@ -76,6 +81,11 @@ declare class AuthApi {
76
81
  private baseBody;
77
82
  private parseNotification;
78
83
  private parseDeviceLink;
84
+ /**
85
+ * Discovery (`/.well-known/eid`)-ийн `sessionTtl` — CA-ийн нэвтрэлт / гарын үсгийн session-ий хугацаа (мс; CA-ийн
86
+ * «Системийн тохиргоо»-оос амьд). Хуучин CA-д (талбар алга) 0.
87
+ */
88
+ sessionTtl(): Promise<SessionTtl>;
79
89
  /** Push — РД/иргэний дугаар/ETSI-ээр (сервер төрлийг таьна). Иргэний утас руу мэдэгдэл очно. */
80
90
  notificationByEtsi(id: string, interactions: Interaction[], opts?: AuthOptions): Promise<NotificationSession>;
81
91
  /** Push — баримтын дугаараар (тодорхой төхөөрөмж рүү). */
@@ -408,6 +418,12 @@ interface PersonCertificate {
408
418
  certValue?: string;
409
419
  /** TOKEN мөрөнд токенд холбогдсон байгууллага; хувийн токенд алга. */
410
420
  organization?: TokenOrganization;
421
+ /**
422
+ * TOKEN мөрөнд: гэрчилгээ олгогдсон USB токены серийн дугаар (`/mobile/tokens`-ийн `tokenSerial`-тай ижил). Нэг
423
+ * токены AUTH + SIGN-ийг үүгээр бүлэглэ; сунгалтаар солигдсон (SUSPENDED) мөр ч өөрийн токены дугаартай. MOBILE/HSM
424
+ * мөрөнд болон хуучин CA-д алга.
425
+ */
426
+ tokenSerial?: string;
411
427
  }
412
428
  interface CertCounts {
413
429
  valid: number;
@@ -852,7 +868,20 @@ interface TokenCertInput {
852
868
  tokenLabel?: string;
853
869
  /** Байгууллагын токен (NTRMN-…); хоосон/алга = хувийн токен. */
854
870
  onBehalfOf?: string;
871
+ /**
872
+ * Заавал биш: macOS App Store build-ийн StoreKit 2 AppTransaction JWS (compact, ≤ {@link MAX_APP_TRANSACTION_BYTES}).
873
+ * Хоосон/алга бол илгээхгүй (Windows — баталгаагүй олголт). Ирсэн бол CA offline шалгана; хүчингүй бол 400
874
+ * {@link APP_ATTESTATION_INVALID}, утас руу push явахгүй (CA docs/TOKEN_CERT.md §App Store баталгаа).
875
+ */
876
+ appTransaction?: string;
855
877
  }
878
+ /** `appTransaction`-ий дээд хэмжээ (UTF-8 байт; CA-ийн хязгаар, 16 KiB). */
879
+ declare const MAX_APP_TRANSACTION_BYTES: number;
880
+ /**
881
+ * 400 `APP_ATTESTATION_INVALID` (`ApiError.code`) — `appTransaction` ирсэн боловч хүчингүй (гинж Apple Root CA - G3
882
+ * биш, гарын үсэг, bundleId, орчин Xcode, signedDate > 30 хоног …); аль алхам унасныг CA хэлэхгүй. Утас руу push явахгүй.
883
+ */
884
+ declare const APP_ATTESTATION_INVALID = "APP_ATTESTATION_INVALID";
856
885
  interface TokenCertStart {
857
886
  sessionId: string;
858
887
  /** Иргэнд ХАРУУЛАХ баталгаажуулах код (ПИН биш). */
@@ -861,6 +890,14 @@ interface TokenCertStart {
861
890
  csrAuthSha256: string;
862
891
  csrSignSha256: string;
863
892
  expiresAt?: string;
893
+ /**
894
+ * Хувийн олголтод, иргэний хувийн токены хязгаар хүрсэн үед: олголт амжилттай болоход AUTH + SIGN нь superseded (4)-оор
895
+ * автоматаар цуцлагдах өөр serial-тай хувийн токенууд (CA 2026-10-19). Бусад үед алга. Эхлэлийн мөчийнх — PIN2-оос өмнө
896
+ * иргэнд анхааруул («Таны өмнөх USB токен (…)-ийн гэрчилгээ хүчингүй болно»).
897
+ */
898
+ supersedes?: {
899
+ tokenSerial: string;
900
+ }[];
864
901
  }
865
902
  interface TokenCertItem {
866
903
  /** base64 DER. */
@@ -924,6 +961,12 @@ interface TokenLimit {
924
961
  type TokenConflictCode = "TOKEN_LIMIT_REACHED" | "TOKEN_IN_USE" | "TOKEN_SCOPE_CHANGE" | "ACCOUNT_DELETE_PENDING";
925
962
  /** {@link TokenConflictCode}-ийн бүх утга (runtime шалгалтад). */
926
963
  declare const TOKEN_CONFLICT_CODES: readonly TokenConflictCode[];
964
+ /** {@link TokenApi.previewCertificate}-ийн хариу. `supersedes` — бодит олголт амжилттай болоход солигдох хувийн токенууд. */
965
+ interface TokenCertPreview {
966
+ supersedes?: {
967
+ tokenSerial: string;
968
+ }[];
969
+ }
927
970
  /** Discovery (`/.well-known/eid`)-ийн `tokenCertificate` блок. */
928
971
  interface TokenCertInfo {
929
972
  enabled: boolean;
@@ -942,6 +985,15 @@ interface TokenCertInfo {
942
985
  * `TOKEN_SCOPE_CHANGE`. Хуучин CA-д талбар алга → false.
943
986
  */
944
987
  scopeLockedOnRenewal: boolean;
988
+ /** `"optional"` — `appTransaction`-ийг CA хүлээн авна. Хуучин CA-д "" (талбар илгээвэл 400). */
989
+ appTransaction: string;
990
+ /**
991
+ * true — хувийн хязгаар хүрсэн үед өөр serial-тай шинэ хувийн токен 409 биш: `supersedes` ирж, олголт амжилттай болоход
992
+ * өмнөх хувийн токен солигдоно; 409 `TOKEN_LIMIT_REACHED` kind=PERSONAL зөвхөн limit=0 үед. Хуучин CA-д false.
993
+ */
994
+ personalAutoSupersede: boolean;
995
+ /** true — {@link TokenApi.previewCertificate} (`dryRun`) дэмжигдэнэ. Хуучин CA-д false. */
996
+ dryRun: boolean;
945
997
  raw: unknown;
946
998
  }
947
999
  declare class TokenApi {
@@ -960,8 +1012,19 @@ declare class TokenApi {
960
1012
  * байгууллагын токен зөвхөн тэр байгууллагаар (`onBehalfOf` ижил), хувийн токен зөвхөн хувиараа. Өөр scope бол
961
1013
  * 409 `TOKEN_SCOPE_CHANGE` (override үгүй); scope солих = иргэн eID апп-аас токеноо цуцлаад шинээр олгуулна.
962
1014
  * Бусад 409: `TOKEN_LIMIT_REACHED` ({@link tokenLimitOf}), `TOKEN_IN_USE` ({@link TokenConflictCode}).
1015
+ * 400 {@link APP_ATTESTATION_INVALID} — `appTransaction` хүчингүй; {@link MAX_APP_TRANSACTION_BYTES}-аас их бол
1016
+ * {@link AppTransactionTooLargeError} (илгээхгүй).
963
1017
  */
964
1018
  issueCertificate(input: TokenCertInput): Promise<TokenCertStart>;
1019
+ /**
1020
+ * POST /token/certificate `{"dryRun": true}` (CA 2026-10-19, discovery `tokenCertificate.dryRun`): {@link issueCertificate}-ийн
1021
+ * бүх шалгалт ижил алдааны кодтой, гэхдээ session / утас руу push үүсэхгүй. Урсгал: CSR → previewCertificate →
1022
+ * `supersedes` байвал иргэнд анхааруулж зөвшөөрүүлэх → issueCertificate (ижил оролт). Хурдны хязгаар (RP, иргэн) 20/мин
1023
+ * (push-ийн 3/цагийг зарцуулахгүй). Хариунд `dryRun: true` алга бол ValidationError. Хуучин CA-д 400 (танихгүй талбар).
1024
+ */
1025
+ previewCertificate(input: TokenCertInput): Promise<TokenCertPreview>;
1026
+ /** Оролтыг шалгаж POST /token/certificate-ийн биеийг угсарна. CA DisallowUnknownFields — яг эдгээр талбар. */
1027
+ private certBody;
965
1028
  /** Discovery-ийн `tokenCertificate` блок. Блок байхгүй (хуучин CA) бол `enabled: false`. */
966
1029
  certificateInfo(): Promise<TokenCertInfo>;
967
1030
  /**
@@ -1435,7 +1498,11 @@ interface EidLoginOptions {
1435
1498
  /** Утсанд харагдах текст (≤60). Анхдагч «<rpName>-д нэвтрэх». */
1436
1499
  displayText?: string;
1437
1500
  certificateLevel?: CertificateLevel;
1438
- /** Нэвтрэлтийн хугацаа (мс). Анхдагч 120 000. */
1501
+ /**
1502
+ * Нэвтрэлтийн хугацаа (мс). Анхдагч 120 000. CA-ийн session-оос урт байхгүй: QR/web2app-д min(ttlMs, CA-ийн
1503
+ * `expiresAt` − одоо); push-д (бодит ба decoy ижил) min(ttlMs, discovery `sessionTtl.auth`) — decoy-д CA хариу
1504
+ * байхгүй тул хугацааны зөрүү бүртгэлтэй эсэхийн oracle болохгүй.
1505
+ */
1439
1506
  ttlMs?: number;
1440
1507
  /** Status-ийн нэг дуудлагад eID-ийг хүлээх (мс). Анхдагч 1000. */
1441
1508
  pollMs?: number;
@@ -1544,4 +1611,4 @@ declare function withReturnHint(callbackUrl: string, userAgent: string): string;
1544
1611
  */
1545
1612
  declare function createEidLogin(opts: EidLoginOptions): EidLogin;
1546
1613
 
1547
- export { AcspContext, type AcspV2Params, type ActivityCounts, type ActivityItem, type ActivityQuery, ApiError, AuthApi, type AuthDefaults, type AuthOptions, type BuildDeviceLinkInput, CITIZEN_INTERMEDIATES_PEM, CITIZEN_ISSUING_CA_SKI, type CertChoiceOptions, type CertCounts, type CertSubject, CertificateLevel, type ClientConfig, type CompletedForRegistration, DEFAULT_BASE_URL, DEFAULT_PDF_TIMEOUT_MS, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, 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, LoginStoreFullError, MEMORY_LOGIN_STORE_MAX, NATIONAL_ROOT_CA_PEM, NotificationSession, type OcspCheckerOptions, OrganizationApi, PDF_SIGNATURE_REGISTER_FIELDS, 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, type QrDeviceLinkTickerOptions, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, type RevocationChecker, type RevocationOutcome, type RevocationStatus, RpCredentials, SHARE_ERROR_CODES, SHARE_FORM_FIELDS, SessionApi, SessionResult, ShareError, type ShareErrorCode, type ShareInfo, type ShareInput, type ShareNotSignedReason, type ShareResult, SignApi, type SignDefaults, type SignOptions, SignatureAlgorithm, type Signer, type SignerRef, TOKEN_CONFLICT_CODES, TokenApi, type TokenAuthChallenge, type TokenAuthResult, type TokenCertInfo, type TokenCertInput, type TokenCertItem, type TokenCertResult, type TokenCertStart, type TokenConflictCode, type TokenIdentity, type TokenLimit, type TokenOrganization, type TrustConfig, type ValidateAuthOptions, type ValidateSignOptions, type VerifiedIdentity, type VerifiedSignature, acspV2Digest, buildAcspV2Payload, buildDeviceLink, buildRegisterBody, certificateLevelOf, createEidLogin, defaultRateLimit, deviceLinkInput, forwardedClientIp, interactionsToBase64, memoryLoginStore, ocspRevocationChecker, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, randomChallenge, registrationFromCompleted, resolveBaseUrl, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyTokenCertificates, withReturnHint };
1614
+ 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, type CertChoiceOptions, type CertCounts, type CertSubject, CertificateLevel, type ClientConfig, type CompletedForRegistration, DEFAULT_BASE_URL, DEFAULT_PDF_TIMEOUT_MS, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, 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, LoginStoreFullError, MAX_APP_TRANSACTION_BYTES, MEMORY_LOGIN_STORE_MAX, NATIONAL_ROOT_CA_PEM, NotificationSession, type OcspCheckerOptions, OrganizationApi, PDF_SIGNATURE_REGISTER_FIELDS, 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, type QrDeviceLinkTickerOptions, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, 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, TokenApi, type TokenAuthChallenge, type TokenAuthResult, type TokenCertInfo, type TokenCertInput, type TokenCertItem, type TokenCertPreview, type TokenCertResult, type TokenCertStart, type TokenConflictCode, type TokenIdentity, type TokenLimit, type TokenOrganization, type TrustConfig, type ValidateAuthOptions, type ValidateSignOptions, type VerifiedIdentity, type VerifiedSignature, acspV2Digest, buildAcspV2Payload, buildDeviceLink, buildRegisterBody, certificateLevelOf, createEidLogin, defaultRateLimit, deviceLinkInput, forwardedClientIp, interactionsToBase64, memoryLoginStore, ocspRevocationChecker, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, randomChallenge, registrationFromCompleted, resolveBaseUrl, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, 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-DBR6ziM5.js';
2
- export { c as DEFAULT_SIGN_SESSION_TTL_MS, E as EndResult, d as NavigatorLike, O as OrgResult, e as Representation, f as SessionState, g as SignContext, h as SignatureAlgorithmParameters, i as SignatureProtocol, T as TokenCertSessionBlock, j as TokenCertStatus, k as isMobileUserAgent, p as parseExpiresAt, s as sessionExpiry, l as startExpiry } from './browser-DBR6ziM5.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-BYY0cP2D.js';
2
+ export { c as DEFAULT_SIGN_SESSION_TTL_MS, E as EndResult, d as NavigatorLike, O as OrgResult, e as Representation, f as SessionState, g as SignContext, h as SignatureAlgorithmParameters, i as SignatureProtocol, T as TokenCertSessionBlock, j as TokenCertStatus, k as isMobileUserAgent, p as parseExpiresAt, s as sessionExpiry, l as startExpiry } from './browser-BYY0cP2D.js';
3
3
  import { X509Certificate, KeyObject } from 'node:crypto';
4
- import { A as ApiError, H as HttpErrorInit } from './errors-xTmsGXyo.js';
5
- export { a as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, E as EidError, F as ForbiddenError, N as NetworkError, b as NoSigningCertificateError, O as ON_BEHALF_ERROR_CODES, c as OnBehalfErrorCode, P as PDF_REGISTER_ERROR_CODES, d as PdfRegisterErrorCode, R as RETRYABLE_ERROR_CODES, e as RequestInvalidError, f as ResponseTooLargeError, g as RetryableErrorCode, S as SessionFailedError, V as ValidationError, p as parseRetryAfter } from './errors-xTmsGXyo.js';
4
+ import { A as ApiError, H as HttpErrorInit } from './errors-BM8D3VEw.js';
5
+ export { a as AppTransactionTooLargeError, b as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, E as EidError, F as ForbiddenError, N as NetworkError, c as NoSigningCertificateError, O as ON_BEHALF_ERROR_CODES, d as OnBehalfErrorCode, P as PDF_REGISTER_ERROR_CODES, e as PdfRegisterErrorCode, R as RETRYABLE_ERROR_CODES, f as RequestInvalidError, g as ResponseTooLargeError, h as RetryableErrorCode, S as SessionFailedError, V as ValidationError, p as parseRetryAfter } from './errors-BM8D3VEw.js';
6
6
 
7
7
  interface HttpConfig {
8
8
  /** RP-API-ийн бүтэн суурь URL. Ж: https://rp.eidmongolia.mn */
@@ -67,6 +67,11 @@ interface AuthOptions {
67
67
  /** ACSP_V2 payload-ийн hash (default SHA-512 — Smart-ID v3 жишээтэй ижил). */
68
68
  hashAlgorithm?: HashAlgorithm;
69
69
  }
70
+ /** Discovery-ийн `sessionTtl` (мс). 0 = хуучин CA. */
71
+ interface SessionTtl {
72
+ authMs: number;
73
+ signMs: number;
74
+ }
70
75
  declare class AuthApi {
71
76
  private readonly http;
72
77
  private readonly creds;
@@ -76,6 +81,11 @@ declare class AuthApi {
76
81
  private baseBody;
77
82
  private parseNotification;
78
83
  private parseDeviceLink;
84
+ /**
85
+ * Discovery (`/.well-known/eid`)-ийн `sessionTtl` — CA-ийн нэвтрэлт / гарын үсгийн session-ий хугацаа (мс; CA-ийн
86
+ * «Системийн тохиргоо»-оос амьд). Хуучин CA-д (талбар алга) 0.
87
+ */
88
+ sessionTtl(): Promise<SessionTtl>;
79
89
  /** Push — РД/иргэний дугаар/ETSI-ээр (сервер төрлийг таьна). Иргэний утас руу мэдэгдэл очно. */
80
90
  notificationByEtsi(id: string, interactions: Interaction[], opts?: AuthOptions): Promise<NotificationSession>;
81
91
  /** Push — баримтын дугаараар (тодорхой төхөөрөмж рүү). */
@@ -408,6 +418,12 @@ interface PersonCertificate {
408
418
  certValue?: string;
409
419
  /** TOKEN мөрөнд токенд холбогдсон байгууллага; хувийн токенд алга. */
410
420
  organization?: TokenOrganization;
421
+ /**
422
+ * TOKEN мөрөнд: гэрчилгээ олгогдсон USB токены серийн дугаар (`/mobile/tokens`-ийн `tokenSerial`-тай ижил). Нэг
423
+ * токены AUTH + SIGN-ийг үүгээр бүлэглэ; сунгалтаар солигдсон (SUSPENDED) мөр ч өөрийн токены дугаартай. MOBILE/HSM
424
+ * мөрөнд болон хуучин CA-д алга.
425
+ */
426
+ tokenSerial?: string;
411
427
  }
412
428
  interface CertCounts {
413
429
  valid: number;
@@ -852,7 +868,20 @@ interface TokenCertInput {
852
868
  tokenLabel?: string;
853
869
  /** Байгууллагын токен (NTRMN-…); хоосон/алга = хувийн токен. */
854
870
  onBehalfOf?: string;
871
+ /**
872
+ * Заавал биш: macOS App Store build-ийн StoreKit 2 AppTransaction JWS (compact, ≤ {@link MAX_APP_TRANSACTION_BYTES}).
873
+ * Хоосон/алга бол илгээхгүй (Windows — баталгаагүй олголт). Ирсэн бол CA offline шалгана; хүчингүй бол 400
874
+ * {@link APP_ATTESTATION_INVALID}, утас руу push явахгүй (CA docs/TOKEN_CERT.md §App Store баталгаа).
875
+ */
876
+ appTransaction?: string;
855
877
  }
878
+ /** `appTransaction`-ий дээд хэмжээ (UTF-8 байт; CA-ийн хязгаар, 16 KiB). */
879
+ declare const MAX_APP_TRANSACTION_BYTES: number;
880
+ /**
881
+ * 400 `APP_ATTESTATION_INVALID` (`ApiError.code`) — `appTransaction` ирсэн боловч хүчингүй (гинж Apple Root CA - G3
882
+ * биш, гарын үсэг, bundleId, орчин Xcode, signedDate > 30 хоног …); аль алхам унасныг CA хэлэхгүй. Утас руу push явахгүй.
883
+ */
884
+ declare const APP_ATTESTATION_INVALID = "APP_ATTESTATION_INVALID";
856
885
  interface TokenCertStart {
857
886
  sessionId: string;
858
887
  /** Иргэнд ХАРУУЛАХ баталгаажуулах код (ПИН биш). */
@@ -861,6 +890,14 @@ interface TokenCertStart {
861
890
  csrAuthSha256: string;
862
891
  csrSignSha256: string;
863
892
  expiresAt?: string;
893
+ /**
894
+ * Хувийн олголтод, иргэний хувийн токены хязгаар хүрсэн үед: олголт амжилттай болоход AUTH + SIGN нь superseded (4)-оор
895
+ * автоматаар цуцлагдах өөр serial-тай хувийн токенууд (CA 2026-10-19). Бусад үед алга. Эхлэлийн мөчийнх — PIN2-оос өмнө
896
+ * иргэнд анхааруул («Таны өмнөх USB токен (…)-ийн гэрчилгээ хүчингүй болно»).
897
+ */
898
+ supersedes?: {
899
+ tokenSerial: string;
900
+ }[];
864
901
  }
865
902
  interface TokenCertItem {
866
903
  /** base64 DER. */
@@ -924,6 +961,12 @@ interface TokenLimit {
924
961
  type TokenConflictCode = "TOKEN_LIMIT_REACHED" | "TOKEN_IN_USE" | "TOKEN_SCOPE_CHANGE" | "ACCOUNT_DELETE_PENDING";
925
962
  /** {@link TokenConflictCode}-ийн бүх утга (runtime шалгалтад). */
926
963
  declare const TOKEN_CONFLICT_CODES: readonly TokenConflictCode[];
964
+ /** {@link TokenApi.previewCertificate}-ийн хариу. `supersedes` — бодит олголт амжилттай болоход солигдох хувийн токенууд. */
965
+ interface TokenCertPreview {
966
+ supersedes?: {
967
+ tokenSerial: string;
968
+ }[];
969
+ }
927
970
  /** Discovery (`/.well-known/eid`)-ийн `tokenCertificate` блок. */
928
971
  interface TokenCertInfo {
929
972
  enabled: boolean;
@@ -942,6 +985,15 @@ interface TokenCertInfo {
942
985
  * `TOKEN_SCOPE_CHANGE`. Хуучин CA-д талбар алга → false.
943
986
  */
944
987
  scopeLockedOnRenewal: boolean;
988
+ /** `"optional"` — `appTransaction`-ийг CA хүлээн авна. Хуучин CA-д "" (талбар илгээвэл 400). */
989
+ appTransaction: string;
990
+ /**
991
+ * true — хувийн хязгаар хүрсэн үед өөр serial-тай шинэ хувийн токен 409 биш: `supersedes` ирж, олголт амжилттай болоход
992
+ * өмнөх хувийн токен солигдоно; 409 `TOKEN_LIMIT_REACHED` kind=PERSONAL зөвхөн limit=0 үед. Хуучин CA-д false.
993
+ */
994
+ personalAutoSupersede: boolean;
995
+ /** true — {@link TokenApi.previewCertificate} (`dryRun`) дэмжигдэнэ. Хуучин CA-д false. */
996
+ dryRun: boolean;
945
997
  raw: unknown;
946
998
  }
947
999
  declare class TokenApi {
@@ -960,8 +1012,19 @@ declare class TokenApi {
960
1012
  * байгууллагын токен зөвхөн тэр байгууллагаар (`onBehalfOf` ижил), хувийн токен зөвхөн хувиараа. Өөр scope бол
961
1013
  * 409 `TOKEN_SCOPE_CHANGE` (override үгүй); scope солих = иргэн eID апп-аас токеноо цуцлаад шинээр олгуулна.
962
1014
  * Бусад 409: `TOKEN_LIMIT_REACHED` ({@link tokenLimitOf}), `TOKEN_IN_USE` ({@link TokenConflictCode}).
1015
+ * 400 {@link APP_ATTESTATION_INVALID} — `appTransaction` хүчингүй; {@link MAX_APP_TRANSACTION_BYTES}-аас их бол
1016
+ * {@link AppTransactionTooLargeError} (илгээхгүй).
963
1017
  */
964
1018
  issueCertificate(input: TokenCertInput): Promise<TokenCertStart>;
1019
+ /**
1020
+ * POST /token/certificate `{"dryRun": true}` (CA 2026-10-19, discovery `tokenCertificate.dryRun`): {@link issueCertificate}-ийн
1021
+ * бүх шалгалт ижил алдааны кодтой, гэхдээ session / утас руу push үүсэхгүй. Урсгал: CSR → previewCertificate →
1022
+ * `supersedes` байвал иргэнд анхааруулж зөвшөөрүүлэх → issueCertificate (ижил оролт). Хурдны хязгаар (RP, иргэн) 20/мин
1023
+ * (push-ийн 3/цагийг зарцуулахгүй). Хариунд `dryRun: true` алга бол ValidationError. Хуучин CA-д 400 (танихгүй талбар).
1024
+ */
1025
+ previewCertificate(input: TokenCertInput): Promise<TokenCertPreview>;
1026
+ /** Оролтыг шалгаж POST /token/certificate-ийн биеийг угсарна. CA DisallowUnknownFields — яг эдгээр талбар. */
1027
+ private certBody;
965
1028
  /** Discovery-ийн `tokenCertificate` блок. Блок байхгүй (хуучин CA) бол `enabled: false`. */
966
1029
  certificateInfo(): Promise<TokenCertInfo>;
967
1030
  /**
@@ -1435,7 +1498,11 @@ interface EidLoginOptions {
1435
1498
  /** Утсанд харагдах текст (≤60). Анхдагч «<rpName>-д нэвтрэх». */
1436
1499
  displayText?: string;
1437
1500
  certificateLevel?: CertificateLevel;
1438
- /** Нэвтрэлтийн хугацаа (мс). Анхдагч 120 000. */
1501
+ /**
1502
+ * Нэвтрэлтийн хугацаа (мс). Анхдагч 120 000. CA-ийн session-оос урт байхгүй: QR/web2app-д min(ttlMs, CA-ийн
1503
+ * `expiresAt` − одоо); push-д (бодит ба decoy ижил) min(ttlMs, discovery `sessionTtl.auth`) — decoy-д CA хариу
1504
+ * байхгүй тул хугацааны зөрүү бүртгэлтэй эсэхийн oracle болохгүй.
1505
+ */
1439
1506
  ttlMs?: number;
1440
1507
  /** Status-ийн нэг дуудлагад eID-ийг хүлээх (мс). Анхдагч 1000. */
1441
1508
  pollMs?: number;
@@ -1544,4 +1611,4 @@ declare function withReturnHint(callbackUrl: string, userAgent: string): string;
1544
1611
  */
1545
1612
  declare function createEidLogin(opts: EidLoginOptions): EidLogin;
1546
1613
 
1547
- export { AcspContext, type AcspV2Params, type ActivityCounts, type ActivityItem, type ActivityQuery, ApiError, AuthApi, type AuthDefaults, type AuthOptions, type BuildDeviceLinkInput, CITIZEN_INTERMEDIATES_PEM, CITIZEN_ISSUING_CA_SKI, type CertChoiceOptions, type CertCounts, type CertSubject, CertificateLevel, type ClientConfig, type CompletedForRegistration, DEFAULT_BASE_URL, DEFAULT_PDF_TIMEOUT_MS, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, 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, LoginStoreFullError, MEMORY_LOGIN_STORE_MAX, NATIONAL_ROOT_CA_PEM, NotificationSession, type OcspCheckerOptions, OrganizationApi, PDF_SIGNATURE_REGISTER_FIELDS, 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, type QrDeviceLinkTickerOptions, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, type RevocationChecker, type RevocationOutcome, type RevocationStatus, RpCredentials, SHARE_ERROR_CODES, SHARE_FORM_FIELDS, SessionApi, SessionResult, ShareError, type ShareErrorCode, type ShareInfo, type ShareInput, type ShareNotSignedReason, type ShareResult, SignApi, type SignDefaults, type SignOptions, SignatureAlgorithm, type Signer, type SignerRef, TOKEN_CONFLICT_CODES, TokenApi, type TokenAuthChallenge, type TokenAuthResult, type TokenCertInfo, type TokenCertInput, type TokenCertItem, type TokenCertResult, type TokenCertStart, type TokenConflictCode, type TokenIdentity, type TokenLimit, type TokenOrganization, type TrustConfig, type ValidateAuthOptions, type ValidateSignOptions, type VerifiedIdentity, type VerifiedSignature, acspV2Digest, buildAcspV2Payload, buildDeviceLink, buildRegisterBody, certificateLevelOf, createEidLogin, defaultRateLimit, deviceLinkInput, forwardedClientIp, interactionsToBase64, memoryLoginStore, ocspRevocationChecker, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, randomChallenge, registrationFromCompleted, resolveBaseUrl, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyTokenCertificates, withReturnHint };
1614
+ 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, type CertChoiceOptions, type CertCounts, type CertSubject, CertificateLevel, type ClientConfig, type CompletedForRegistration, DEFAULT_BASE_URL, DEFAULT_PDF_TIMEOUT_MS, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, 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, LoginStoreFullError, MAX_APP_TRANSACTION_BYTES, MEMORY_LOGIN_STORE_MAX, NATIONAL_ROOT_CA_PEM, NotificationSession, type OcspCheckerOptions, OrganizationApi, PDF_SIGNATURE_REGISTER_FIELDS, 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, type QrDeviceLinkTickerOptions, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, 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, TokenApi, type TokenAuthChallenge, type TokenAuthResult, type TokenCertInfo, type TokenCertInput, type TokenCertItem, type TokenCertPreview, type TokenCertResult, type TokenCertStart, type TokenConflictCode, type TokenIdentity, type TokenLimit, type TokenOrganization, type TrustConfig, type ValidateAuthOptions, type ValidateSignOptions, type VerifiedIdentity, type VerifiedSignature, acspV2Digest, buildAcspV2Payload, buildDeviceLink, buildRegisterBody, certificateLevelOf, createEidLogin, defaultRateLimit, deviceLinkInput, forwardedClientIp, interactionsToBase64, memoryLoginStore, ocspRevocationChecker, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, randomChallenge, registrationFromCompleted, resolveBaseUrl, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyTokenCertificates, withReturnHint };
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  } from "./chunk-ISTWNY6N.js";
14
14
  import {
15
15
  ApiError,
16
+ AppTransactionTooLargeError,
16
17
  AuthenticationError,
17
18
  CertChoiceInvalidError,
18
19
  DeviceLinkError,
@@ -29,7 +30,7 @@ import {
29
30
  ValidationError,
30
31
  maskPath,
31
32
  parseRetryAfter
32
- } from "./chunk-ZB7LEWA5.js";
33
+ } from "./chunk-H7JOACAZ.js";
33
34
 
34
35
  // src/http.ts
35
36
  var DEFAULT_TIMEOUT_MS = 15e3;
@@ -326,6 +327,15 @@ var AuthApi = class {
326
327
  ...expiresAt !== void 0 ? { expiresAt } : {}
327
328
  };
328
329
  }
330
+ /**
331
+ * Discovery (`/.well-known/eid`)-ийн `sessionTtl` — CA-ийн нэвтрэлт / гарын үсгийн session-ий хугацаа (мс; CA-ийн
332
+ * «Системийн тохиргоо»-оос амьд). Хуучин CA-д (талбар алга) 0.
333
+ */
334
+ async sessionTtl() {
335
+ const t = rec(rec(await this.http.get("/.well-known/eid")).sessionTtl);
336
+ const ms2 = (v) => typeof v === "number" && Number.isFinite(v) && v > 0 ? Math.floor(v) * 1e3 : 0;
337
+ return { authMs: ms2(t.auth), signMs: ms2(t.sign) };
338
+ }
329
339
  /** Push — РД/иргэний дугаар/ETSI-ээр (сервер төрлийг таьна). Иргэний утас руу мэдэгдэл очно. */
330
340
  async notificationByEtsi(id, interactions, opts) {
331
341
  const { body, acsp } = this.baseBody(randomChallenge(), interactions, ["Notification"], opts);
@@ -1668,6 +1678,8 @@ function basicConstraintsPathLen(cert) {
1668
1678
  }
1669
1679
 
1670
1680
  // src/token.ts
1681
+ var MAX_APP_TRANSACTION_BYTES = 16 * 1024;
1682
+ var APP_ATTESTATION_INVALID = "APP_ATTESTATION_INVALID";
1671
1683
  function rec4(v) {
1672
1684
  return v && typeof v === "object" ? v : {};
1673
1685
  }
@@ -1676,6 +1688,9 @@ function hexSha256Equal(hex, data) {
1676
1688
  return timingSafeEqual(createHash3("sha256").update(data).digest(), Buffer.from(hex, "hex"));
1677
1689
  }
1678
1690
  var TOKEN_CONFLICT_CODES = ["TOKEN_LIMIT_REACHED", "TOKEN_IN_USE", "TOKEN_SCOPE_CHANGE", "ACCOUNT_DELETE_PENDING"];
1691
+ function supersedesOf(v) {
1692
+ return Array.isArray(v) ? { supersedes: v.map((x) => ({ tokenSerial: String(rec4(x).tokenSerial ?? "") })) } : {};
1693
+ }
1679
1694
  var DISCOVERY_PATH = "/.well-known/eid";
1680
1695
  var TOKEN_RESULT_TIMEOUT_MS = 3e4;
1681
1696
  var TokenApi = class {
@@ -1695,11 +1710,44 @@ var TokenApi = class {
1695
1710
  * байгууллагын токен зөвхөн тэр байгууллагаар (`onBehalfOf` ижил), хувийн токен зөвхөн хувиараа. Өөр scope бол
1696
1711
  * 409 `TOKEN_SCOPE_CHANGE` (override үгүй); scope солих = иргэн eID апп-аас токеноо цуцлаад шинээр олгуулна.
1697
1712
  * Бусад 409: `TOKEN_LIMIT_REACHED` ({@link tokenLimitOf}), `TOKEN_IN_USE` ({@link TokenConflictCode}).
1713
+ * 400 {@link APP_ATTESTATION_INVALID} — `appTransaction` хүчингүй; {@link MAX_APP_TRANSACTION_BYTES}-аас их бол
1714
+ * {@link AppTransactionTooLargeError} (илгээхгүй).
1698
1715
  */
1699
1716
  async issueCertificate(input) {
1717
+ const r = rec4(await this.http.post(routePath(RP_ROUTES.tokenCertificate), this.certBody(input)));
1718
+ if (!hexSha256Equal(r.csrAuthSha256, input.csrAuth) || !hexSha256Equal(r.csrSignSha256, input.csrSign)) {
1719
+ throw new ValidationError("token: CA-\u0438\u0439\u043D csrAuthSha256/csrSignSha256 \u0438\u043B\u0433\u044D\u044D\u0441\u044D\u043D CSR-\u0442\u044D\u0439 \u0442\u0430\u0430\u0440\u0441\u0430\u043D\u0433\u04AF\u0439");
1720
+ }
1721
+ const vc = rec4(r.vc).value ?? (typeof r.vc === "string" ? r.vc : void 0);
1722
+ return {
1723
+ sessionId: String(r.sessionID ?? ""),
1724
+ vc: vc != null ? String(vc) : null,
1725
+ csrAuthSha256: String(r.csrAuthSha256).toLowerCase(),
1726
+ csrSignSha256: String(r.csrSignSha256).toLowerCase(),
1727
+ ...typeof r.expiresAt === "string" ? { expiresAt: r.expiresAt } : {},
1728
+ ...supersedesOf(r.supersedes)
1729
+ };
1730
+ }
1731
+ /**
1732
+ * POST /token/certificate `{"dryRun": true}` (CA 2026-10-19, discovery `tokenCertificate.dryRun`): {@link issueCertificate}-ийн
1733
+ * бүх шалгалт ижил алдааны кодтой, гэхдээ session / утас руу push үүсэхгүй. Урсгал: CSR → previewCertificate →
1734
+ * `supersedes` байвал иргэнд анхааруулж зөвшөөрүүлэх → issueCertificate (ижил оролт). Хурдны хязгаар (RP, иргэн) 20/мин
1735
+ * (push-ийн 3/цагийг зарцуулахгүй). Хариунд `dryRun: true` алга бол ValidationError. Хуучин CA-д 400 (танихгүй талбар).
1736
+ */
1737
+ async previewCertificate(input) {
1738
+ const r = rec4(await this.http.post(routePath(RP_ROUTES.tokenCertificate), { ...this.certBody(input), dryRun: true }));
1739
+ if (r.dryRun !== true) throw new ValidationError("token: dryRun \u0445\u0430\u0440\u0438\u0443 \u0431\u0438\u0448 (CA dryRun-\u0438\u0439\u0433 \u0434\u044D\u043C\u0436\u0438\u0445\u0433\u04AF\u0439)");
1740
+ return { ...supersedesOf(r.supersedes) };
1741
+ }
1742
+ /** Оролтыг шалгаж POST /token/certificate-ийн биеийг угсарна. CA DisallowUnknownFields — яг эдгээр талбар. */
1743
+ certBody(input) {
1700
1744
  if (!input.signerEtsi?.trim() || !input.csrAuth?.length || !input.csrSign?.length || !input.tokenSerial?.trim()) {
1701
1745
  throw new Error("token: signerEtsi, csrAuth, csrSign, tokenSerial \u0448\u0430\u0430\u0440\u0434\u043B\u0430\u0433\u0430\u0442\u0430\u0439");
1702
1746
  }
1747
+ const appTransaction = input.appTransaction?.trim() ?? "";
1748
+ if (Buffer.byteLength(input.appTransaction ?? "", "utf8") > MAX_APP_TRANSACTION_BYTES) {
1749
+ throw new AppTransactionTooLargeError("token: appTransaction 16 KiB-\u0430\u0430\u0441 \u0438\u0445");
1750
+ }
1703
1751
  const body = {
1704
1752
  relyingPartyUUID: this.creds.rpUUID,
1705
1753
  relyingPartyName: this.creds.rpName,
@@ -1711,18 +1759,8 @@ var TokenApi = class {
1711
1759
  flow: "notification"
1712
1760
  };
1713
1761
  if (input.tokenLabel) body.tokenLabel = input.tokenLabel;
1714
- const r = rec4(await this.http.post(routePath(RP_ROUTES.tokenCertificate), body));
1715
- if (!hexSha256Equal(r.csrAuthSha256, input.csrAuth) || !hexSha256Equal(r.csrSignSha256, input.csrSign)) {
1716
- throw new ValidationError("token: CA-\u0438\u0439\u043D csrAuthSha256/csrSignSha256 \u0438\u043B\u0433\u044D\u044D\u0441\u044D\u043D CSR-\u0442\u044D\u0439 \u0442\u0430\u0430\u0440\u0441\u0430\u043D\u0433\u04AF\u0439");
1717
- }
1718
- const vc = rec4(r.vc).value ?? (typeof r.vc === "string" ? r.vc : void 0);
1719
- return {
1720
- sessionId: String(r.sessionID ?? ""),
1721
- vc: vc != null ? String(vc) : null,
1722
- csrAuthSha256: String(r.csrAuthSha256).toLowerCase(),
1723
- csrSignSha256: String(r.csrSignSha256).toLowerCase(),
1724
- ...typeof r.expiresAt === "string" ? { expiresAt: r.expiresAt } : {}
1725
- };
1762
+ if (appTransaction) body.appTransaction = appTransaction;
1763
+ return body;
1726
1764
  }
1727
1765
  /** Discovery-ийн `tokenCertificate` блок. Блок байхгүй (хуучин CA) бол `enabled: false`. */
1728
1766
  async certificateInfo() {
@@ -1737,6 +1775,9 @@ var TokenApi = class {
1737
1775
  keyAlgorithm: String(t.keyAlgorithm ?? ""),
1738
1776
  onBehalfOf: String(t.onBehalfOf ?? ""),
1739
1777
  scopeLockedOnRenewal: t.scopeLockedOnRenewal === true,
1778
+ appTransaction: String(t.appTransaction ?? ""),
1779
+ personalAutoSupersede: t.personalAutoSupersede === true,
1780
+ dryRun: t.dryRun === true,
1740
1781
  raw: d.tokenCertificate
1741
1782
  };
1742
1783
  }
@@ -2472,6 +2513,38 @@ function createEidLogin(opts) {
2472
2513
  const revocation = opts.revocation === false ? void 0 : opts.revocation ?? ocspRevocationChecker();
2473
2514
  const revocationMode = opts.revocationMode ?? "soft-fail";
2474
2515
  const auditKey = opts.auditKey ?? randomBytes2(32);
2516
+ let caTtl = 0;
2517
+ let caTtlNext = 0;
2518
+ let caTtlInflight;
2519
+ function authTtl(ctx) {
2520
+ if (Date.now() < caTtlNext) return Promise.resolve(caTtl);
2521
+ caTtlInflight ??= (async () => {
2522
+ caTtlNext = Date.now() + 6e4;
2523
+ let timer;
2524
+ try {
2525
+ const t = await Promise.race([
2526
+ client.auth.sessionTtl(),
2527
+ new Promise((_, rej) => {
2528
+ timer = setTimeout(() => rej(new Error("discovery timeout")), 2e3);
2529
+ })
2530
+ ]);
2531
+ caTtlNext = Date.now() + 6e5;
2532
+ if (t.authMs > 0) caTtl = t.authMs;
2533
+ } catch (e) {
2534
+ onError(new Error(`eid-login: discovery sessionTtl: ${e instanceof Error ? e.message : e}`), ctx);
2535
+ } finally {
2536
+ clearTimeout(timer);
2537
+ caTtlInflight = void 0;
2538
+ }
2539
+ return caTtl;
2540
+ })();
2541
+ return caTtlInflight;
2542
+ }
2543
+ function observeAuthTtl(sent, expiresAt) {
2544
+ if (expiresAt === void 0 || caTtl > 0) return;
2545
+ const d = Math.round((expiresAt - sent) / 1e3) * 1e3;
2546
+ if (d > 0) caTtl = d;
2547
+ }
2475
2548
  const pushKey = (idCode) => createHmac2("sha256", auditKey).update(`eid-push-audit:${idCode}`).digest("hex").slice(0, 32);
2476
2549
  async function emit(kind, sessionId, meta, ctx) {
2477
2550
  if (!opts.onEvent) return;
@@ -2546,17 +2619,20 @@ function createEidLogin(opts) {
2546
2619
  interactions: tx.acsp.interactions
2547
2620
  });
2548
2621
  }
2549
- async function begin(req, mode, idCode, lang) {
2622
+ async function begin(req, mode, idCode, lang, ttlMs) {
2623
+ const sent = Date.now();
2550
2624
  const level = opts.certificateLevel ? { certificateLevel: opts.certificateLevel } : {};
2551
2625
  let tx;
2552
2626
  let appLink;
2553
2627
  if (mode === "push") {
2554
2628
  const s = await client.auth.notificationByEtsi(idCode, interactions, level);
2555
2629
  tx = { sessionId: s.sessionId, mode, vc: s.vc, acsp: s.acsp };
2630
+ observeAuthTtl(sent, s.expiresAt);
2556
2631
  } else {
2557
2632
  const callbackUrl = mode === "web2app" ? withReturnHint(opts.callbackUrl, header(req.headers, "user-agent")) : void 0;
2558
2633
  const s = await client.auth.deviceLinkAnonymous(interactions, { ...level, callbackUrl });
2559
2634
  if (!s.deviceLinkBase || !s.sessionToken || !s.sessionSecret || !s.acsp) throw new Error("eID \u0445\u0430\u0440\u0438\u0443\u043D\u0434 device link \u0442\u0430\u043B\u0431\u0430\u0440 \u0434\u0443\u0442\u0443\u0443");
2635
+ if (s.expiresAt !== void 0) ttlMs = Math.min(ttlMs, Math.floor((s.expiresAt - Date.now()) / 1e3) * 1e3);
2560
2636
  tx = {
2561
2637
  sessionId: s.sessionId,
2562
2638
  mode,
@@ -2579,18 +2655,20 @@ function createEidLogin(opts) {
2579
2655
  });
2580
2656
  }
2581
2657
  }
2582
- return { ...await save(tx), appLink };
2658
+ if (ttlMs < 1e3) throw new Error("eID session-\u0438\u0439 \u0445\u0443\u0433\u0430\u0446\u0430\u0430 \u0434\u0443\u0443\u0441\u0441\u0430\u043D (expiresAt)");
2659
+ return { ...await save(tx, ttlMs), appLink };
2583
2660
  }
2584
- async function save(tx) {
2661
+ async function save(tx, ttlMs) {
2585
2662
  const binding = randomBytes2(32).toString("base64url");
2586
- const full = { ...tx, bindingHash: sha256hex(binding), expiresAt: Date.now() + ttl };
2587
- await store.set(full.sessionId, full, ttl);
2588
- const setCookie = `${cookieName}=${full.sessionId}.${binding}; ${cookieAttrs(Math.ceil(ttl / 1e3))}`;
2589
- return { tx: full, setCookie, appLink: void 0 };
2663
+ const full = { ...tx, bindingHash: sha256hex(binding), expiresAt: Date.now() + ttlMs };
2664
+ await store.set(full.sessionId, full, ttlMs);
2665
+ const expiresIn = Math.ceil(ttlMs / 1e3);
2666
+ const setCookie = `${cookieName}=${full.sessionId}.${binding}; ${cookieAttrs(expiresIn)}`;
2667
+ return { tx: full, setCookie, expiresIn, appLink: void 0 };
2590
2668
  }
2591
- function startDecoy() {
2669
+ function startDecoy(ttlMs) {
2592
2670
  const acsp = void 0;
2593
- return save({ sessionId: randomUUID(), mode: "push", vc: String(randomInt(1e5)).padStart(5, "0"), acsp, decoy: true });
2671
+ return save({ sessionId: randomUUID(), mode: "push", vc: String(randomInt(1e5)).padStart(5, "0"), acsp, decoy: true }, ttlMs);
2594
2672
  }
2595
2673
  async function start(req) {
2596
2674
  const url = new URL(req.url, "http://x");
@@ -2628,11 +2706,16 @@ function createEidLogin(opts) {
2628
2706
  if (ip && !await rateLimit(`start:${ip}`)) return limited();
2629
2707
  if (mode === "push" && !await rateLimit(`push:${idCode}`)) return limited();
2630
2708
  const began = Date.now();
2709
+ let ttlMs = ttl;
2710
+ if (mode === "push") {
2711
+ const ca = await authTtl(ctx);
2712
+ if (ca > 0) ttlMs = Math.min(ttlMs, ca);
2713
+ }
2631
2714
  let r;
2632
2715
  let err;
2633
2716
  let decoy = false;
2634
2717
  try {
2635
- r = await begin(req, mode, idCode, lang);
2718
+ r = await begin(req, mode, idCode, lang, ttlMs);
2636
2719
  } catch (e) {
2637
2720
  err = e;
2638
2721
  }
@@ -2641,7 +2724,7 @@ function createEidLogin(opts) {
2641
2724
  onError(new Error(`eid-login: eID push-\u0438\u0439\u0433 \u0442\u0430\u0442\u0433\u0430\u043B\u0437\u0430\u0432 (${ae.status}${ae.code ? ` ${ae.code}` : ""}); decoy session-\u043E\u043E\u0440 \u0445\u0430\u0440\u0438\u0443\u043B\u0430\u0432`), ctx);
2642
2725
  err = void 0;
2643
2726
  try {
2644
- r = await startDecoy();
2727
+ r = await startDecoy(ttlMs);
2645
2728
  decoy = true;
2646
2729
  } catch (e) {
2647
2730
  err = e;
@@ -2660,7 +2743,7 @@ function createEidLogin(opts) {
2660
2743
  }
2661
2744
  return json(
2662
2745
  200,
2663
- { mode, vc: r.tx.vc, ...mode === "qr" ? { qr: qrLink(r.tx) } : {}, expiresIn: Math.ceil(ttl / 1e3) },
2746
+ { mode, vc: r.tx.vc, ...mode === "qr" ? { qr: qrLink(r.tx) } : {}, expiresIn: r.expiresIn },
2664
2747
  { "Set-Cookie": r.setCookie }
2665
2748
  );
2666
2749
  }
@@ -2796,7 +2879,9 @@ function createEidLogin(opts) {
2796
2879
  return { handleRequest, handle };
2797
2880
  }
2798
2881
  export {
2882
+ APP_ATTESTATION_INVALID,
2799
2883
  ApiError,
2884
+ AppTransactionTooLargeError,
2800
2885
  AuthApi,
2801
2886
  AuthenticationError,
2802
2887
  CITIZEN_INTERMEDIATES_PEM,
@@ -2812,6 +2897,7 @@ export {
2812
2897
  ForbiddenError,
2813
2898
  Http,
2814
2899
  LoginStoreFullError,
2900
+ MAX_APP_TRANSACTION_BYTES,
2815
2901
  MEMORY_LOGIN_STORE_MAX,
2816
2902
  NATIONAL_ROOT_CA_PEM,
2817
2903
  NetworkError,
package/dist/pades.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { E as EidError } from './errors-xTmsGXyo.cjs';
1
+ import { E as EidError } from './errors-BM8D3VEw.cjs';
2
2
  import { F as FetchFn } from './fetch-BjfH46q9.cjs';
3
3
 
4
4
  /** Олгогчийн гарын үсэгтэй «revoked» хариу (OCSP эсвэл CRL) — complete-д дахин оролдохгүй хатуу алдаа (Go ErrCertificateRevoked). */
package/dist/pades.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { E as EidError } from './errors-xTmsGXyo.js';
1
+ import { E as EidError } from './errors-BM8D3VEw.js';
2
2
  import { F as FetchFn } from './fetch-BjfH46q9.js';
3
3
 
4
4
  /** Олгогчийн гарын үсэгтэй «revoked» хариу (OCSP эсвэл CRL) — complete-д дахин оролдохгүй хатуу алдаа (Go ErrCertificateRevoked). */
package/dist/pades.js CHANGED
@@ -55,7 +55,7 @@ import {
55
55
  } from "./chunk-ISTWNY6N.js";
56
56
  import {
57
57
  EidError
58
- } from "./chunk-ZB7LEWA5.js";
58
+ } from "./chunk-H7JOACAZ.js";
59
59
 
60
60
  // src/pades/limits.ts
61
61
  var MAX_INPUT_BYTES = (10 << 20) - (256 << 10);
@@ -1,4 +1,4 @@
1
- import { E as EidError } from './errors-xTmsGXyo.cjs';
1
+ import { E as EidError } from './errors-BM8D3VEw.cjs';
2
2
  import { F as FetchFn } from './fetch-BjfH46q9.cjs';
3
3
 
4
4
  type Indication = "valid" | "invalid" | "indeterminate";
@@ -1,4 +1,4 @@
1
- import { E as EidError } from './errors-xTmsGXyo.js';
1
+ import { E as EidError } from './errors-BM8D3VEw.js';
2
2
  import { F as FetchFn } from './fetch-BjfH46q9.js';
3
3
 
4
4
  type Indication = "valid" | "invalid" | "indeterminate";
package/dist/validate.js CHANGED
@@ -64,7 +64,7 @@ import {
64
64
  } from "./chunk-ISTWNY6N.js";
65
65
  import {
66
66
  EidError
67
- } from "./chunk-ZB7LEWA5.js";
67
+ } from "./chunk-H7JOACAZ.js";
68
68
 
69
69
  // src/pades/validate/evaluate.ts
70
70
  var PROBLEMS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gerege-systems/eid-mongolia-sdk",
3
- "version": "0.21.0",
3
+ "version": "0.23.0",
4
4
  "description": "e-ID Mongolia Relying Party SDK — иргэнээр утсаар нь нэвтрэлт ба хууль ёсны цахим гарын үсэг (RP-API v3, Smart-ID нийцтэй).",
5
5
  "license": "MIT",
6
6
  "type": "module",