@gerege-systems/eid-mongolia-sdk 0.34.0 → 0.35.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 +2 -27
- package/dist/{types-Cf3GT4wh.d.cts → browser-CCP--VGv.d.ts} +17 -50
- package/dist/{types-Cf3GT4wh.d.ts → browser-w1Ca6FdZ.d.cts} +17 -50
- package/dist/browser.d.cts +2 -18
- package/dist/browser.d.ts +2 -18
- package/dist/browser.js +1 -1
- package/dist/{chunk-M4NS4UFP.js → chunk-MA4RMWBO.js} +13 -102
- package/dist/{chunk-TNXO4QLU.js → chunk-PWFTN52X.js} +0 -1
- package/dist/{errors-mcDbKiz_.d.cts → errors-CgJcEjrZ.d.cts} +2 -2
- package/dist/{errors-mcDbKiz_.d.ts → errors-CgJcEjrZ.d.ts} +2 -2
- package/dist/index.cjs +1 -24
- package/dist/index.d.cts +7 -29
- package/dist/index.d.ts +7 -29
- package/dist/index.js +2 -24
- package/dist/pades.cjs +20 -169
- package/dist/pades.d.cts +2 -44
- package/dist/pades.d.ts +2 -44
- package/dist/pades.js +9 -71
- package/dist/validate.cjs +15 -150
- package/dist/validate.d.cts +1 -1
- package/dist/validate.d.ts +1 -1
- package/dist/validate.js +5 -35
- package/package.json +1 -1
package/dist/validate.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Fetcher,
|
|
3
3
|
InflateError,
|
|
4
|
-
MAX_IMAGE_SIDE,
|
|
5
4
|
PRef,
|
|
6
5
|
Reader,
|
|
7
6
|
StructureError,
|
|
@@ -12,7 +11,7 @@ import {
|
|
|
12
11
|
isBrowser,
|
|
13
12
|
round100,
|
|
14
13
|
visibleWidget
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MA4RMWBO.js";
|
|
16
15
|
import {
|
|
17
16
|
EID_ISSUERS,
|
|
18
17
|
INTERMEDIATES,
|
|
@@ -66,7 +65,7 @@ import {
|
|
|
66
65
|
} from "./chunk-ISTWNY6N.js";
|
|
67
66
|
import {
|
|
68
67
|
EidError
|
|
69
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-PWFTN52X.js";
|
|
70
69
|
|
|
71
70
|
// src/pades/validate/evaluate.ts
|
|
72
71
|
var PROBLEMS = {
|
|
@@ -1409,7 +1408,7 @@ function ownVisible(c, d, widget) {
|
|
|
1409
1408
|
const m = ms.v;
|
|
1410
1409
|
if (!ownDate(m) || m.slice(16) !== "+08'00'") throw fail();
|
|
1411
1410
|
const date = `${m.slice(2, 6)}-${m.slice(6, 8)}-${m.slice(8, 10)} ${m.slice(10, 12)}:${m.slice(12, 14)} (+08)`;
|
|
1412
|
-
const
|
|
1411
|
+
const ids = apIDs(c, nr);
|
|
1413
1412
|
const form = c.fin.get(ids[0]);
|
|
1414
1413
|
if (!(form instanceof PStream)) throw fail();
|
|
1415
1414
|
let head = "";
|
|
@@ -1421,7 +1420,7 @@ function ownVisible(c, d, widget) {
|
|
|
1421
1420
|
for (const lang of ["mn", "en"]) {
|
|
1422
1421
|
let bodies;
|
|
1423
1422
|
try {
|
|
1424
|
-
bodies = appearanceObjects({ w, h, rotate: rot, name, role: meta.role, lang, date, url
|
|
1423
|
+
bodies = appearanceObjects({ w, h, rotate: rot, name, role: meta.role, lang, date, url }, ids);
|
|
1425
1424
|
} catch {
|
|
1426
1425
|
throw fail();
|
|
1427
1426
|
}
|
|
@@ -1469,21 +1468,6 @@ function apIDs(c, n) {
|
|
|
1469
1468
|
if (!(ff instanceof PRef2)) throw fail();
|
|
1470
1469
|
refs.push(t0, cid, fd, ff, tu);
|
|
1471
1470
|
}
|
|
1472
|
-
let sig;
|
|
1473
|
-
let stamp;
|
|
1474
|
-
if (isDict(res) && res.has("XObject")) {
|
|
1475
|
-
const xo = dget(res, "XObject");
|
|
1476
|
-
if (!isDict(xo)) throw fail();
|
|
1477
|
-
for (const key of ["Sig", "Stamp"]) {
|
|
1478
|
-
if (!xo.has(key)) continue;
|
|
1479
|
-
const br = dget(xo, key);
|
|
1480
|
-
if (!(br instanceof PRef2)) throw fail();
|
|
1481
|
-
const { im, mr } = apImage(c, br);
|
|
1482
|
-
refs.push(br, mr);
|
|
1483
|
-
if (key === "Sig") sig = im;
|
|
1484
|
-
else stamp = im;
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
1471
|
const seen = /* @__PURE__ */ new Set();
|
|
1488
1472
|
const ids = [];
|
|
1489
1473
|
for (const r of refs) {
|
|
@@ -1491,21 +1475,7 @@ function apIDs(c, n) {
|
|
|
1491
1475
|
seen.add(r.num);
|
|
1492
1476
|
ids.push(r.num);
|
|
1493
1477
|
}
|
|
1494
|
-
return
|
|
1495
|
-
}
|
|
1496
|
-
function apImage(c, br) {
|
|
1497
|
-
const fail = errNotSignatureOnly;
|
|
1498
|
-
const base = c.fin.deref(br);
|
|
1499
|
-
if (!(base instanceof PStream) || base.data.length !== 3) throw fail();
|
|
1500
|
-
const mr = dget(base.dict, "SMask");
|
|
1501
|
-
if (!(mr instanceof PRef2)) throw fail();
|
|
1502
|
-
const mask = c.fin.deref(mr);
|
|
1503
|
-
if (!(mask instanceof PStream)) throw fail();
|
|
1504
|
-
const w = dget(mask.dict, "Width");
|
|
1505
|
-
const h = dget(mask.dict, "Height");
|
|
1506
|
-
const side = BigInt(MAX_IMAGE_SIDE);
|
|
1507
|
-
if (!isInt(w) || !isInt(h) || w < 1n || h < 1n || w > side || h > side) throw fail();
|
|
1508
|
-
return { im: { w: Number(w), h: Number(h), color: [base.data[0], base.data[1], base.data[2]], alpha: mask.data }, mr };
|
|
1478
|
+
return ids;
|
|
1509
1479
|
}
|
|
1510
1480
|
var isSpaceByte = (x) => x === 9 || x === 10 || x === 11 || x === 12 || x === 13 || x === 32;
|
|
1511
1481
|
function sameObject(c, num, body) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gerege-systems/eid-mongolia-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "e-ID Mongolia Relying Party SDK — иргэнээр утсаар нь нэвтрэлт ба хууль ёсны цахим гарын үсэг (RP-API v3, Smart-ID нийцтэй).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|