@gerege-systems/eid-mongolia-sdk 0.30.0 → 0.30.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.
@@ -476,10 +476,12 @@ var Lexer = class {
476
476
  const out = [];
477
477
  for (; ; ) {
478
478
  let c = this.readByte();
479
- while (isSpace(c)) c = this.readByte();
479
+ while (isSpace(c) && !this.eof) c = this.readByte();
480
+ if (this.eof) throw new PdfError("unterminated hex string");
480
481
  if (c === 62) break;
481
482
  let c2 = this.readByte();
482
- while (isSpace(c2)) c2 = this.readByte();
483
+ while (isSpace(c2) && !this.eof) c2 = this.readByte();
484
+ if (this.eof) throw new PdfError("unterminated hex string");
483
485
  const x = unhex(c) << 4 | unhex(c2);
484
486
  if (unhex(c) < 0 || unhex(c2) < 0 || x < 0) throw new PdfError("malformed hex string");
485
487
  out.push(x);
@@ -491,6 +493,7 @@ var Lexer = class {
491
493
  let depth = 1;
492
494
  for (; ; ) {
493
495
  let c = this.readByte();
496
+ if (this.eof) throw new PdfError("unterminated literal string");
494
497
  if (c === 40) {
495
498
  depth++;
496
499
  out.push(c);
@@ -635,6 +638,7 @@ var Lexer = class {
635
638
  const tok = this.readToken();
636
639
  if (isKw(tok, "]")) break;
637
640
  if (tok === EOF_TOKEN) throw new PdfError("unterminated array");
641
+ if (isKw(tok, "endobj")) throw new PdfError("unterminated array");
638
642
  this.unreadToken(tok);
639
643
  x.push(asObj(this.readObject()));
640
644
  }
@@ -993,6 +997,7 @@ var Reader = class {
993
997
  for (let i = 0; i < n; i++) {
994
998
  const id = b.readToken();
995
999
  const off = b.readToken();
1000
+ if (id === EOF_TOKEN || off === EOF_TOKEN) break;
996
1001
  const idn = id instanceof PInt ? Number(BigInt.asUintN(32, id.v)) : 0;
997
1002
  if (idn === ptr.id) {
998
1003
  const o = off instanceof PInt ? Number(off.v) : 0;
package/dist/convert.js CHANGED
@@ -423,10 +423,12 @@ var Lexer = class {
423
423
  const out = [];
424
424
  for (; ; ) {
425
425
  let c = this.readByte();
426
- while (isSpace(c)) c = this.readByte();
426
+ while (isSpace(c) && !this.eof) c = this.readByte();
427
+ if (this.eof) throw new PdfError("unterminated hex string");
427
428
  if (c === 62) break;
428
429
  let c2 = this.readByte();
429
- while (isSpace(c2)) c2 = this.readByte();
430
+ while (isSpace(c2) && !this.eof) c2 = this.readByte();
431
+ if (this.eof) throw new PdfError("unterminated hex string");
430
432
  const x = unhex(c) << 4 | unhex(c2);
431
433
  if (unhex(c) < 0 || unhex(c2) < 0 || x < 0) throw new PdfError("malformed hex string");
432
434
  out.push(x);
@@ -438,6 +440,7 @@ var Lexer = class {
438
440
  let depth = 1;
439
441
  for (; ; ) {
440
442
  let c = this.readByte();
443
+ if (this.eof) throw new PdfError("unterminated literal string");
441
444
  if (c === 40) {
442
445
  depth++;
443
446
  out.push(c);
@@ -582,6 +585,7 @@ var Lexer = class {
582
585
  const tok = this.readToken();
583
586
  if (isKw(tok, "]")) break;
584
587
  if (tok === EOF_TOKEN) throw new PdfError("unterminated array");
588
+ if (isKw(tok, "endobj")) throw new PdfError("unterminated array");
585
589
  this.unreadToken(tok);
586
590
  x.push(asObj(this.readObject()));
587
591
  }
@@ -940,6 +944,7 @@ var Reader = class {
940
944
  for (let i = 0; i < n; i++) {
941
945
  const id = b.readToken();
942
946
  const off = b.readToken();
947
+ if (id === EOF_TOKEN || off === EOF_TOKEN) break;
943
948
  const idn = id instanceof PInt ? Number(BigInt.asUintN(32, id.v)) : 0;
944
949
  if (idn === ptr.id) {
945
950
  const o = off instanceof PInt ? Number(off.v) : 0;
package/dist/pades.cjs CHANGED
@@ -1732,10 +1732,12 @@ var Lexer = class {
1732
1732
  const out = [];
1733
1733
  for (; ; ) {
1734
1734
  let c = this.readByte();
1735
- while (isSpace(c)) c = this.readByte();
1735
+ while (isSpace(c) && !this.eof) c = this.readByte();
1736
+ if (this.eof) throw new PdfError("unterminated hex string");
1736
1737
  if (c === 62) break;
1737
1738
  let c2 = this.readByte();
1738
- while (isSpace(c2)) c2 = this.readByte();
1739
+ while (isSpace(c2) && !this.eof) c2 = this.readByte();
1740
+ if (this.eof) throw new PdfError("unterminated hex string");
1739
1741
  const x = unhex(c) << 4 | unhex(c2);
1740
1742
  if (unhex(c) < 0 || unhex(c2) < 0 || x < 0) throw new PdfError("malformed hex string");
1741
1743
  out.push(x);
@@ -1747,6 +1749,7 @@ var Lexer = class {
1747
1749
  let depth = 1;
1748
1750
  for (; ; ) {
1749
1751
  let c = this.readByte();
1752
+ if (this.eof) throw new PdfError("unterminated literal string");
1750
1753
  if (c === 40) {
1751
1754
  depth++;
1752
1755
  out.push(c);
@@ -1891,6 +1894,7 @@ var Lexer = class {
1891
1894
  const tok = this.readToken();
1892
1895
  if (isKw(tok, "]")) break;
1893
1896
  if (tok === EOF_TOKEN) throw new PdfError("unterminated array");
1897
+ if (isKw(tok, "endobj")) throw new PdfError("unterminated array");
1894
1898
  this.unreadToken(tok);
1895
1899
  x.push(asObj(this.readObject()));
1896
1900
  }
@@ -2249,6 +2253,7 @@ var Reader = class {
2249
2253
  for (let i = 0; i < n; i++) {
2250
2254
  const id = b.readToken();
2251
2255
  const off = b.readToken();
2256
+ if (id === EOF_TOKEN || off === EOF_TOKEN) break;
2252
2257
  const idn = id instanceof PInt ? Number(BigInt.asUintN(32, id.v)) : 0;
2253
2258
  if (idn === ptr.id) {
2254
2259
  const o = off instanceof PInt ? Number(off.v) : 0;
package/dist/pades.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  visibleRect,
24
24
  visibleWidget,
25
25
  zlibInflateStrict
26
- } from "./chunk-73HYZNOY.js";
26
+ } from "./chunk-MA4RMWBO.js";
27
27
  import {
28
28
  CLAIMED_ROLE_MAX_RUNES,
29
29
  CertificateRevokedError,
package/dist/validate.cjs CHANGED
@@ -2054,10 +2054,12 @@ var Lexer = class {
2054
2054
  const out = [];
2055
2055
  for (; ; ) {
2056
2056
  let c = this.readByte();
2057
- while (isSpace(c)) c = this.readByte();
2057
+ while (isSpace(c) && !this.eof) c = this.readByte();
2058
+ if (this.eof) throw new PdfError("unterminated hex string");
2058
2059
  if (c === 62) break;
2059
2060
  let c2 = this.readByte();
2060
- while (isSpace(c2)) c2 = this.readByte();
2061
+ while (isSpace(c2) && !this.eof) c2 = this.readByte();
2062
+ if (this.eof) throw new PdfError("unterminated hex string");
2061
2063
  const x = unhex(c) << 4 | unhex(c2);
2062
2064
  if (unhex(c) < 0 || unhex(c2) < 0 || x < 0) throw new PdfError("malformed hex string");
2063
2065
  out.push(x);
@@ -2069,6 +2071,7 @@ var Lexer = class {
2069
2071
  let depth = 1;
2070
2072
  for (; ; ) {
2071
2073
  let c = this.readByte();
2074
+ if (this.eof) throw new PdfError("unterminated literal string");
2072
2075
  if (c === 40) {
2073
2076
  depth++;
2074
2077
  out.push(c);
@@ -2213,6 +2216,7 @@ var Lexer = class {
2213
2216
  const tok = this.readToken();
2214
2217
  if (isKw(tok, "]")) break;
2215
2218
  if (tok === EOF_TOKEN) throw new PdfError("unterminated array");
2219
+ if (isKw(tok, "endobj")) throw new PdfError("unterminated array");
2216
2220
  this.unreadToken(tok);
2217
2221
  x.push(asObj(this.readObject()));
2218
2222
  }
@@ -2571,6 +2575,7 @@ var Reader = class {
2571
2575
  for (let i = 0; i < n; i++) {
2572
2576
  const id = b.readToken();
2573
2577
  const off = b.readToken();
2578
+ if (id === EOF_TOKEN || off === EOF_TOKEN) break;
2574
2579
  const idn = id instanceof PInt ? Number(BigInt.asUintN(32, id.v)) : 0;
2575
2580
  if (idn === ptr.id) {
2576
2581
  const o = off instanceof PInt ? Number(off.v) : 0;
package/dist/validate.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  isBrowser,
12
12
  round100,
13
13
  visibleWidget
14
- } from "./chunk-73HYZNOY.js";
14
+ } from "./chunk-MA4RMWBO.js";
15
15
  import {
16
16
  EID_ISSUERS,
17
17
  INTERMEDIATES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gerege-systems/eid-mongolia-sdk",
3
- "version": "0.30.0",
3
+ "version": "0.30.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/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/validate-fuzz.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/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/validate-fuzz.test.ts test/pades-lexer-loop.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",