@gerege-systems/eid-mongolia-sdk 0.46.0 → 0.46.1

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
@@ -747,6 +747,14 @@ TSA timestamp-аар өөрөө **2 удаа** дахин оролдоно (ни
747
747
  оролдохгүй (өмнө нь revoked OCSP-г алгасаад CRL-ээр DSS угсардаг байв). OCSP/CRL-д мөн CertID/олгогч/шинэлэг байдлын
748
748
  дүрэм (§ validate).
749
749
 
750
+ **OCSP/CRL-ийн дараалал (0.46.1).** `complete` нь гинжийн гэрчилгээ бүрийн цуцлалтын нотолгоог үүргээр нь авна:
751
+ гинжийн эхний гэрчилгээ (иргэн, TSA) — эхлээд OCSP (энгийн 10 с-ийн timeout, «timestamp-аас хожуу» дүрэм), дараа нь CRL
752
+ (хоёулаа хүчинтэй бол хоёулаа DSS-д); CA гэрчилгээ (бусад бүх) — эхлээд CRL, хүчинтэй CRL авсан бол тэр гэрчилгээний OCSP
753
+ responder-т хүсэлт **илгээхгүй**, хүчинтэй CRL алга бол л OCSP (10 с). Аль нь ч хүчингүй → `LTV_UNAVAILABLE` (fail-closed),
754
+ олгогчийн гарын үсэгтэй «revoked» (OCSP эсвэл CRL) → `CertificateRevokedError`. Өмнө нь CA гэрчилгээний холболт хүлээж
755
+ аваад хариулдаггүй OCSP responder гарын үсэг бүрийг ~20 с саатуулдаг байв. DSS-д CA гэрчилгээнд зөвхөн CRL орно.
756
+ `validatePdf`-ийн онлайн цуцлалт өөрчлөгдөөгүй (зөвхөн eID-ийн 04/05-ийн гэрчилгээнд, OCSP → CRL).
757
+
750
758
  `PadesError.code` (тогтвортой, бүх платформд ижил): `PDF_INVALID`, `PDF_ENCRYPTED`, `PDF_LOCKED` (DocMDP P=1),
751
759
  `PDF_TOO_LARGE`, `PDF_TOO_MANY_SIGNATURES`, `PDF_PRIOR_SIGNATURE_INVALID`, `PDF_FOREIGN_SIGNATURE`, `SIGNER_INVALID`,
752
760
  `REQUEST_INVALID`, `SIGNATURE_INVALID` (state хэвээр — дахин зуруулж болно), `TSA_UNAVAILABLE`, `LTV_UNAVAILABLE`
@@ -5,7 +5,7 @@ import {
5
5
  fromLatin1,
6
6
  latin1,
7
7
  toHex
8
- } from "./chunk-ISTWNY6N.js";
8
+ } from "./chunk-BTT7P7GB.js";
9
9
 
10
10
  // src/pades/fetch.ts
11
11
  var DEFAULT_TSA_URL = "https://tsa.timeserver.mn/";
@@ -1397,28 +1397,34 @@ async function collectLTV(f, now, fresh, roots, chains) {
1397
1397
  let ok = false;
1398
1398
  let freshErr;
1399
1399
  const fr = i === 0 ? fresh : void 0;
1400
- for (const u of c.ocspServers) {
1401
- try {
1402
- const [der, resp] = await fetchOCSP(f, u, c, issuer, now, fr);
1403
- addTo(d.ocsps, der);
1404
- if (resp.certificate && !equal(resp.certificate.raw, issuer.raw)) addTo(d.certs, resp.certificate.raw);
1405
- ok = true;
1406
- break;
1407
- } catch (e) {
1408
- if (e instanceof CertificateRevokedError) throw e;
1409
- if (e instanceof NotFresh) freshErr = e;
1410
- }
1411
- }
1412
- for (const u of c.crlDPs) {
1413
- let der;
1414
- try {
1415
- der = await f.do("GET", u, "");
1416
- } catch {
1400
+ for (const step of i === 0 ? ["ocsp", "crl"] : ["crl", "ocsp"]) {
1401
+ if (step === "ocsp") {
1402
+ if (i !== 0 && ok) continue;
1403
+ for (const u of c.ocspServers) {
1404
+ try {
1405
+ const [der, resp] = await fetchOCSP(f, u, c, issuer, now, fr);
1406
+ addTo(d.ocsps, der);
1407
+ if (resp.certificate && !equal(resp.certificate.raw, issuer.raw)) addTo(d.certs, resp.certificate.raw);
1408
+ ok = true;
1409
+ break;
1410
+ } catch (e) {
1411
+ if (e instanceof CertificateRevokedError) throw e;
1412
+ if (e instanceof NotFresh) freshErr = e;
1413
+ }
1414
+ }
1417
1415
  continue;
1418
1416
  }
1419
- if (await crlCovers(der, c, issuer, now)) {
1420
- addTo(d.crls, der);
1421
- ok = true;
1417
+ for (const u of c.crlDPs) {
1418
+ let der;
1419
+ try {
1420
+ der = await f.do("GET", u, "");
1421
+ } catch {
1422
+ continue;
1423
+ }
1424
+ if (await crlCovers(der, c, issuer, now)) {
1425
+ addTo(d.crls, der);
1426
+ ok = true;
1427
+ }
1422
1428
  }
1423
1429
  }
1424
1430
  if (!ok) {
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  parseCertificate,
11
11
  parseOCSPFrom,
12
12
  sameCertKey
13
- } from "./chunk-ISTWNY6N.js";
13
+ } from "./chunk-BTT7P7GB.js";
14
14
  import {
15
15
  ApiError,
16
16
  AppTransactionTooLargeError,
package/dist/pades.cjs CHANGED
@@ -1265,28 +1265,34 @@ async function collectLTV(f, now, fresh, roots, chains) {
1265
1265
  let ok = false;
1266
1266
  let freshErr;
1267
1267
  const fr = i === 0 ? fresh : void 0;
1268
- for (const u of c.ocspServers) {
1269
- try {
1270
- const [der2, resp] = await fetchOCSP(f, u, c, issuer, now, fr);
1271
- addTo(d.ocsps, der2);
1272
- if (resp.certificate && !equal(resp.certificate.raw, issuer.raw)) addTo(d.certs, resp.certificate.raw);
1273
- ok = true;
1274
- break;
1275
- } catch (e) {
1276
- if (e instanceof CertificateRevokedError) throw e;
1277
- if (e instanceof NotFresh) freshErr = e;
1278
- }
1279
- }
1280
- for (const u of c.crlDPs) {
1281
- let der2;
1282
- try {
1283
- der2 = await f.do("GET", u, "");
1284
- } catch {
1268
+ for (const step of i === 0 ? ["ocsp", "crl"] : ["crl", "ocsp"]) {
1269
+ if (step === "ocsp") {
1270
+ if (i !== 0 && ok) continue;
1271
+ for (const u of c.ocspServers) {
1272
+ try {
1273
+ const [der2, resp] = await fetchOCSP(f, u, c, issuer, now, fr);
1274
+ addTo(d.ocsps, der2);
1275
+ if (resp.certificate && !equal(resp.certificate.raw, issuer.raw)) addTo(d.certs, resp.certificate.raw);
1276
+ ok = true;
1277
+ break;
1278
+ } catch (e) {
1279
+ if (e instanceof CertificateRevokedError) throw e;
1280
+ if (e instanceof NotFresh) freshErr = e;
1281
+ }
1282
+ }
1285
1283
  continue;
1286
1284
  }
1287
- if (await crlCovers(der2, c, issuer, now)) {
1288
- addTo(d.crls, der2);
1289
- ok = true;
1285
+ for (const u of c.crlDPs) {
1286
+ let der2;
1287
+ try {
1288
+ der2 = await f.do("GET", u, "");
1289
+ } catch {
1290
+ continue;
1291
+ }
1292
+ if (await crlCovers(der2, c, issuer, now)) {
1293
+ addTo(d.crls, der2);
1294
+ ok = true;
1295
+ }
1290
1296
  }
1291
1297
  }
1292
1298
  if (!ok) {
package/dist/pades.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  visibleRect,
24
24
  visibleWidget,
25
25
  zlibInflateStrict
26
- } from "./chunk-4JAA4RON.js";
26
+ } from "./chunk-6H6KBQV4.js";
27
27
  import {
28
28
  CLAIMED_ROLE_MAX_RUNES,
29
29
  CertificateRevokedError,
@@ -56,7 +56,7 @@ import {
56
56
  toHex,
57
57
  verifyCitizen,
58
58
  verifySignedData
59
- } from "./chunk-ISTWNY6N.js";
59
+ } from "./chunk-BTT7P7GB.js";
60
60
  import {
61
61
  EidError
62
62
  } from "./chunk-6AGWRTZG.js";
package/dist/validate.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  isBrowser,
12
12
  round100,
13
13
  visibleWidget
14
- } from "./chunk-4JAA4RON.js";
14
+ } from "./chunk-6H6KBQV4.js";
15
15
  import {
16
16
  EID_ISSUERS,
17
17
  INTERMEDIATES,
@@ -62,7 +62,7 @@ import {
62
62
  subtle,
63
63
  toHex,
64
64
  verifySignature
65
- } from "./chunk-ISTWNY6N.js";
65
+ } from "./chunk-BTT7P7GB.js";
66
66
  import {
67
67
  EidError
68
68
  } from "./chunk-6AGWRTZG.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gerege-systems/eid-mongolia-sdk",
3
- "version": "0.46.0",
3
+ "version": "0.46.1",
4
4
  "description": "e-ID Mongolia Relying Party SDK — иргэнээр утсаар нь нэвтрэлт ба хууль ёсны цахим гарын үсэг (RP-API v3, Smart-ID нийцтэй).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsup src/index.ts src/browser.ts src/pades.ts src/validate.ts --format esm,cjs --dts --clean && tsup src/button.ts --format esm,cjs --dts --tsconfig tsconfig.button.json && tsup src/convert.ts --format esm --dts --tsconfig tsconfig.button.json",
52
- "test": "npm run build && node --test --experimental-strip-types test/sdk.test.ts test/portal-gaps.test.ts test/chain.test.ts test/qr.test.ts test/myqr.test.ts test/login.test.ts test/button.test.ts test/sign-gaps.test.ts test/session-start.test.ts test/pades-session.test.ts test/pades-golden.test.ts test/pades-placement.test.ts test/pades-unit.test.ts test/convert.test.ts test/share.test.ts test/validate-golden.test.ts test/validate-revisions.test.ts test/validate-env.test.ts test/pades-revocation.test.ts test/pades-encrypt.test.ts test/pades-objstm.test.ts test/pades-objstm-encrypt.test.ts test/validate-fuzz.test.ts test/pades-lexer-loop.test.ts test/seal.test.ts",
52
+ "test": "npm run build && node --test --experimental-strip-types test/sdk.test.ts test/portal-gaps.test.ts test/chain.test.ts test/qr.test.ts test/myqr.test.ts test/login.test.ts test/button.test.ts test/sign-gaps.test.ts test/session-start.test.ts test/pades-session.test.ts test/pades-golden.test.ts test/pades-placement.test.ts test/pades-unit.test.ts test/convert.test.ts test/share.test.ts test/validate-golden.test.ts test/validate-revisions.test.ts test/validate-env.test.ts test/pades-revocation.test.ts test/pades-ltv-order.test.ts test/pades-encrypt.test.ts test/pades-objstm.test.ts test/pades-objstm-encrypt.test.ts test/validate-fuzz.test.ts test/pades-lexer-loop.test.ts test/seal.test.ts",
53
53
  "test:contract": "npm run build && node --experimental-strip-types test/contract.test.ts",
54
54
  "lint": "tsc --noEmit && tsc --noEmit -p tsconfig.button.json",
55
55
  "golden:check": "node scripts/sync-pades-golden.mjs --check",