@gerege-systems/eid-mongolia-sdk 0.28.0 → 0.29.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 +24 -2
- package/dist/button.cjs +23 -3
- package/dist/button.d.cts +2 -0
- package/dist/button.d.ts +2 -0
- package/dist/button.js +23 -3
- package/dist/{chunk-YRL4CWWI.js → chunk-P65FCDR5.js} +15 -8
- package/dist/pades.cjs +120 -29
- package/dist/pades.d.cts +57 -4
- package/dist/pades.d.ts +57 -4
- package/dist/pades.js +109 -22
- package/dist/validate.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -558,6 +558,7 @@ DSS-д), Adobe / EU DSS-д «LTV enabled», баталгаажуулах (QR) х
|
|
|
558
558
|
| Функц | Хаана | Тайлбар |
|
|
559
559
|
|---|---|---|
|
|
560
560
|
| `prepare(pdf, { signerCert, claimedRole?, verifyPage?, fileName?, lang?, docId?, appearance?, … })` | браузер / Node | `{ dtbs, digest, docId, state, placement? }` — сүлжээгүй |
|
|
561
|
+
| `suggestPlacement(pdf, appearance)` | браузер / Node | гарын үсэггүйгээр тэмдгийн байршил + хуудасны хэмжээ (урьдчилан харах, 0.29.0+) — сүлжээгүй |
|
|
561
562
|
| `eid.signPdfDigest({ dtbs, fileName, signer, flow?, onBehalfOf? })` | RP backend | DTBS-д гарын үсгийн session (push эсвэл device-link) |
|
|
562
563
|
| `complete(state, signature)` | браузер / Node | TSA + OCSP/CRL → `{ pdf, cms, docId, outSha256, inSha256, hasPage, pageSha256, … }` |
|
|
563
564
|
| `eid.registerSignature(registrationFromCompleted(done, { fileName, sessionID, onBehalfOf? }))` | RP backend | `POST /pdf/signatures` — `/verify/{docID}` бүртгэл. `medium` алга бол `sessionID`-аас (phone ⇔ sessionID); зөрчил эсвэл `claimedRole`-той гарын үсэгт `onBehalfOf` алга бол `ValidationError` |
|
|
@@ -631,7 +632,7 @@ reply({ verifyUrl: reg.verifyUrl });
|
|
|
631
632
|
`SESSION_FAILED` / `CLAIMED_ROLE_MISMATCH` / `DOC_ID_CONFLICT` / `REGISTRY_CONFLICT` / `PRIOR_MISMATCH`; 413
|
|
632
633
|
`REQUEST_TOO_LARGE`; 429 `RATE_LIMITED`, 503 `STATE_UNAVAILABLE` (`retryable`).
|
|
633
634
|
|
|
634
|
-
**Харагдах гарын үсэг (сонголттой).** `appearance: { page?, x, y, width, height, lang? }` өгвөл гарын үсэг хуудсан дээр
|
|
635
|
+
**Харагдах гарын үсэг (сонголттой).** `appearance: { page?, x, y, width, height, lang?, exact? }` өгвөл гарын үсэг хуудсан дээр
|
|
635
636
|
харагдана (QR + нэр, `claimedRole`, «eID Mongolia-аар зурсан», огноо `YYYY-MM-DD HH:MM (+08)`); байхгүй бол үл харагдах
|
|
636
637
|
(өмнөхтэй байт-ижил). Координат pt-ээр, хуудасны CropBox-ийн `/Rotate`-ийн дараах (дэлгэцэнд харагдах) зүүн доод булангаас;
|
|
637
638
|
`page` 1-ээс (байхгүй/0 = оролтын eID verify хуудас БИШ сүүлийн хуудас — энэ prepare-ийн нэмэх ба өмнөх гарын үсгүүдийн
|
|
@@ -653,6 +654,26 @@ const p = await prepare(pdfBytes, { signerCert, verifyPage: true, fileName: "Г
|
|
|
653
654
|
if (p.placement?.status === "overlap") notice("Гарын үсэг хуудасны агуулга дээр давхцаж байрлана");
|
|
654
655
|
```
|
|
655
656
|
|
|
657
|
+
**Иргэн байршлыг өөрөө сонгох (0.29.0+).** `suggestPlacement(pdf, appearance)` нь `prepare`-ийн байршлын алгоритмыг
|
|
658
|
+
(page 0 шийдэл, хуудас уншилт, чөлөөт зай хайлт) гэрчилгээ, гарын үсэг, сүлжээгүйгээр ажиллуулна:
|
|
659
|
+
`{ page, x, y, width, height, status, pageWidth, pageHeight, pageCount, pages: [{ width, height }] }` (pt; `pages[i]` —
|
|
660
|
+
хуудас бүрийн харагдах хэмжээ, геометр нь уншигдахгүй хуудас `{0, 0}`). `page, x, y, width, height, status` нь ижил PDF +
|
|
661
|
+
appearance-ийн `prepare().placement`-тэй ижил (гарын үсэггүй баримт дээр page 0 нь юуг ч алгасахгүй — сүүлийн хуудас).
|
|
662
|
+
UI хуудсыг `s` px/pt-ээр, зүүн дээд эхтэй зурвал: `left = x·s`, `top = (pageHeight − y − height)·s`; буцаахдаа
|
|
663
|
+
`x = left/s`, `y = pageHeight − top/s − height`, тэгээд `appearance.exact: true` — тэмдэг яг тэнд зурагдана, хэзээ ч
|
|
664
|
+
шилжихгүй (хуудаснаас гарвал `REQUEST_INVALID`, тайрахгүй). Хуудсыг уншсаар байгаа тул `status`: `requested` (чөлөөтэй) |
|
|
665
|
+
`overlap` (агуулга дээр) | `unscanned`; `moved` хэзээ ч биш. `exact` байхгүй/false бол өмнөхтэй байт-ижил. Шалгах дараалал:
|
|
666
|
+
`PDF_TOO_LARGE` → `PDF_INVALID` (толгой/бүтэц) → `REQUEST_INVALID` (appearance утга) → `PDF_ENCRYPTED` → `PDF_INVALID`
|
|
667
|
+
(гарын үсгийн уншилт) → `REQUEST_INVALID` (хуудасны тоо, хайрцаг, хуудаснаас гарах). Өмнөх гарын үсгийн шалгалт,
|
|
668
|
+
signer, нэр багтах эсэхийг шалгахгүй (`prepare` шалгана). Дүрэм: `PLACEMENT_SPEC.md` §6a/§6b.
|
|
669
|
+
|
|
670
|
+
```ts
|
|
671
|
+
const s = await suggestPlacement(pdfBytes, { x: 340, y: 36, width: 220, height: 64 }); // анхдагч байрлал
|
|
672
|
+
// … иргэн тэмдгийг preview дээр чирнэ → { page, x, y } (pt, зүүн доод эх) …
|
|
673
|
+
const p = await prepare(pdfBytes, { signerCert, verifyPage: true, fileName: "Гэрээ №12.pdf",
|
|
674
|
+
appearance: { page, x, y, width: s.width, height: s.height, exact: true } });
|
|
675
|
+
```
|
|
676
|
+
|
|
656
677
|
### Зөвхөн Node (backend бүгдийг хийнэ)
|
|
657
678
|
|
|
658
679
|
```ts
|
|
@@ -1057,7 +1078,8 @@ npm run test:convert-e2e # /convert жинхэнэ LibreOffice Chromium-д (BR
|
|
|
1057
1078
|
|
|
1058
1079
|
`/pades`-ийн conformance fixture (golden: оролт, тестийн PKI-ийн гэрчилгээ, TSA/OCSP/CRL-ийн тогтмол хариу, хүлээгдэх
|
|
1059
1080
|
sha256) ба фонт/гинжийн asset-ийг Go reference-ээс `node scripts/sync-pades-golden.mjs` хуулна (`GO_SDK_COMMIT` —
|
|
1060
|
-
tag `pades-golden-vN`, одоо
|
|
1081
|
+
tag `pades-golden-vN`, одоо v7 — `placement/` scanner vectors-той, page 0 verify хуудас алгасна, `exact` +
|
|
1082
|
+
`expect.suggestion`); CI `--check`-ээр бэхэлсэн commit-тэй тулгана. Профайл:
|
|
1061
1083
|
Go репогийн `pades/PROFILE.md`, `PAGE_SPEC.md`, `PRECHECKS.md`, `WIRE.md`, `APPEARANCE_SPEC.md`, `PLACEMENT_SPEC.md`.
|
|
1062
1084
|
|
|
1063
1085
|
### Гэрээний шалгалт
|
package/dist/button.cjs
CHANGED
|
@@ -395,6 +395,8 @@ var T = {
|
|
|
395
395
|
mn: {
|
|
396
396
|
button: "eID-\u044D\u044D\u0440 \u043D\u044D\u0432\u0442\u0440\u044D\u0445",
|
|
397
397
|
title: "eID-\u044D\u044D\u0440 \u043D\u044D\u0432\u0442\u0440\u044D\u0445",
|
|
398
|
+
// Лого «e-ID» гэж бичигддэг тул логотой үед «eID»-г давтахгүй: [лого]-ээр нэвтрэх.
|
|
399
|
+
withLogo: ["", "-\u044D\u044D\u0440 \u043D\u044D\u0432\u0442\u0440\u044D\u0445"],
|
|
398
400
|
close: "\u0425\u0430\u0430\u0445",
|
|
399
401
|
loading: "\u0410\u0447\u0430\u0430\u043B\u0436 \u0431\u0430\u0439\u043D\u0430",
|
|
400
402
|
qrAlt: "\u041D\u044D\u0432\u0442\u0440\u044D\u0445 QR \u043A\u043E\u0434 \u2014 \u0443\u0442\u0441\u0430\u043D \u0434\u044D\u044D\u0440\u0445 eID Mongolia \u0430\u043F\u043F\u0430\u0430\u0440 \u0443\u043D\u0448\u0443\u0443\u043B\u043D\u0430",
|
|
@@ -434,6 +436,7 @@ var T = {
|
|
|
434
436
|
en: {
|
|
435
437
|
button: "Log in with eID",
|
|
436
438
|
title: "Log in with eID",
|
|
439
|
+
withLogo: ["Log in with ", ""],
|
|
437
440
|
close: "Close",
|
|
438
441
|
loading: "Loading",
|
|
439
442
|
qrAlt: "Login QR code \u2014 scan it with the eID Mongolia app on your phone",
|
|
@@ -533,6 +536,8 @@ h2, p, ol { margin: 0; }
|
|
|
533
536
|
.btn-outline:hover { background: var(--_eid-bg-muted); }
|
|
534
537
|
.btn-sm { width: auto; min-height: 36px; padding: 0 14px; font-size: 0.8125rem; }
|
|
535
538
|
.trigger { width: auto; }
|
|
539
|
+
.brand { display: inline-flex; align-items: center; gap: 6px; }
|
|
540
|
+
.brand.tight { gap: 2px; }
|
|
536
541
|
.logo { display: block; flex: none; height: 16px; width: auto; aspect-ratio: 3840 / 1372; fill: var(--_eid-logo); }
|
|
537
542
|
.trigger.icon-only .logo { height: 12px; }
|
|
538
543
|
.trigger.icon-only { width: 44px; height: 44px; padding: 0; }
|
|
@@ -707,15 +712,28 @@ var EidLoginButton = class extends Base {
|
|
|
707
712
|
console.warn('<eid-login-button>: icon="none" \u0431\u0430 \u0442\u0435\u043A\u0441\u0442\u0433\u04AF\u0439 (variant="icon" \u044D\u0441\u0432\u044D\u043B label="") \u2014 \u0430\u043D\u0445\u0434\u0430\u0433\u0447 \u0442\u0435\u043A\u0441\u0442\u0438\u0439\u0433 \u0445\u0430\u0440\u0443\u0443\u043B\u0430\u0432.');
|
|
708
713
|
}
|
|
709
714
|
}
|
|
715
|
+
const brand = hasIcon && !iconOnly && !label;
|
|
710
716
|
const nodes = [];
|
|
711
|
-
if (
|
|
712
|
-
|
|
717
|
+
if (brand) nodes.push(this.brand({ part: "icon" }, { part: "label" }));
|
|
718
|
+
else {
|
|
719
|
+
if (hasIcon) nodes.push(logo({ part: "icon" }));
|
|
720
|
+
if (!iconOnly) nodes.push(el("span", { part: "label" }, text));
|
|
721
|
+
}
|
|
713
722
|
this.trigger.replaceChildren(...nodes);
|
|
714
723
|
this.trigger.classList.toggle("icon-only", iconOnly);
|
|
715
724
|
const aria = this.getAttribute("aria-label") || (iconOnly ? text : null);
|
|
716
725
|
if (aria) this.trigger.setAttribute("aria-label", aria);
|
|
717
726
|
else this.trigger.removeAttribute("aria-label");
|
|
718
727
|
}
|
|
728
|
+
/** Лого + i18n-ийн өмнөх/дараах текст. Лого aria-hidden тул уншигчид sr-only «eID» — нэр нь бүтэн «eID-ээр нэвтрэх». */
|
|
729
|
+
brand(logoAttrs = {}, textAttrs = {}) {
|
|
730
|
+
const [pre, post] = this.t.withLogo;
|
|
731
|
+
const box = el("span", { class: post && !pre ? "brand tight" : "brand" });
|
|
732
|
+
if (pre) box.append(el("span", textAttrs, pre));
|
|
733
|
+
box.append(logo(logoAttrs), el("span", { class: "sr-only" }, "eID"));
|
|
734
|
+
if (post) box.append(el("span", textAttrs, post));
|
|
735
|
+
return box;
|
|
736
|
+
}
|
|
719
737
|
disconnectedCallback() {
|
|
720
738
|
this.close();
|
|
721
739
|
this.themeObs?.disconnect();
|
|
@@ -763,7 +781,9 @@ var EidLoginButton = class extends Base {
|
|
|
763
781
|
const head = el("div", { class: "head" });
|
|
764
782
|
const x = el("button", { type: "button", class: "x", "aria-label": this.t.close }, "\xD7");
|
|
765
783
|
x.addEventListener("click", () => this.close());
|
|
766
|
-
|
|
784
|
+
const h2 = el("h2", { id: "eid-title" });
|
|
785
|
+
h2.append(this.brand());
|
|
786
|
+
head.append(h2, x);
|
|
767
787
|
this.body = el("div");
|
|
768
788
|
this.live = el("p", { class: "sr-only", "aria-live": "polite" });
|
|
769
789
|
dlg.append(head, this.body, this.live);
|
package/dist/button.d.cts
CHANGED
|
@@ -75,6 +75,8 @@ declare class EidLoginButton extends Base {
|
|
|
75
75
|
attributeChangedCallback(name: string): void;
|
|
76
76
|
/** Trigger-ийн агуулга: label / icon / variant / aria-label-аас. Хоосон товч хэзээ ч үүсгэхгүй. */
|
|
77
77
|
private renderTrigger;
|
|
78
|
+
/** Лого + i18n-ийн өмнөх/дараах текст. Лого aria-hidden тул уншигчид sr-only «eID» — нэр нь бүтэн «eID-ээр нэвтрэх». */
|
|
79
|
+
private brand;
|
|
78
80
|
disconnectedCallback(): void;
|
|
79
81
|
/** Одоогийн бодит схем (`theme` + auto үед хуудас/OS). */
|
|
80
82
|
get scheme(): Scheme;
|
package/dist/button.d.ts
CHANGED
|
@@ -75,6 +75,8 @@ declare class EidLoginButton extends Base {
|
|
|
75
75
|
attributeChangedCallback(name: string): void;
|
|
76
76
|
/** Trigger-ийн агуулга: label / icon / variant / aria-label-аас. Хоосон товч хэзээ ч үүсгэхгүй. */
|
|
77
77
|
private renderTrigger;
|
|
78
|
+
/** Лого + i18n-ийн өмнөх/дараах текст. Лого aria-hidden тул уншигчид sr-only «eID» — нэр нь бүтэн «eID-ээр нэвтрэх». */
|
|
79
|
+
private brand;
|
|
78
80
|
disconnectedCallback(): void;
|
|
79
81
|
/** Одоогийн бодит схем (`theme` + auto үед хуудас/OS). */
|
|
80
82
|
get scheme(): Scheme;
|
package/dist/button.js
CHANGED
|
@@ -366,6 +366,8 @@ var T = {
|
|
|
366
366
|
mn: {
|
|
367
367
|
button: "eID-\u044D\u044D\u0440 \u043D\u044D\u0432\u0442\u0440\u044D\u0445",
|
|
368
368
|
title: "eID-\u044D\u044D\u0440 \u043D\u044D\u0432\u0442\u0440\u044D\u0445",
|
|
369
|
+
// Лого «e-ID» гэж бичигддэг тул логотой үед «eID»-г давтахгүй: [лого]-ээр нэвтрэх.
|
|
370
|
+
withLogo: ["", "-\u044D\u044D\u0440 \u043D\u044D\u0432\u0442\u0440\u044D\u0445"],
|
|
369
371
|
close: "\u0425\u0430\u0430\u0445",
|
|
370
372
|
loading: "\u0410\u0447\u0430\u0430\u043B\u0436 \u0431\u0430\u0439\u043D\u0430",
|
|
371
373
|
qrAlt: "\u041D\u044D\u0432\u0442\u0440\u044D\u0445 QR \u043A\u043E\u0434 \u2014 \u0443\u0442\u0441\u0430\u043D \u0434\u044D\u044D\u0440\u0445 eID Mongolia \u0430\u043F\u043F\u0430\u0430\u0440 \u0443\u043D\u0448\u0443\u0443\u043B\u043D\u0430",
|
|
@@ -405,6 +407,7 @@ var T = {
|
|
|
405
407
|
en: {
|
|
406
408
|
button: "Log in with eID",
|
|
407
409
|
title: "Log in with eID",
|
|
410
|
+
withLogo: ["Log in with ", ""],
|
|
408
411
|
close: "Close",
|
|
409
412
|
loading: "Loading",
|
|
410
413
|
qrAlt: "Login QR code \u2014 scan it with the eID Mongolia app on your phone",
|
|
@@ -504,6 +507,8 @@ h2, p, ol { margin: 0; }
|
|
|
504
507
|
.btn-outline:hover { background: var(--_eid-bg-muted); }
|
|
505
508
|
.btn-sm { width: auto; min-height: 36px; padding: 0 14px; font-size: 0.8125rem; }
|
|
506
509
|
.trigger { width: auto; }
|
|
510
|
+
.brand { display: inline-flex; align-items: center; gap: 6px; }
|
|
511
|
+
.brand.tight { gap: 2px; }
|
|
507
512
|
.logo { display: block; flex: none; height: 16px; width: auto; aspect-ratio: 3840 / 1372; fill: var(--_eid-logo); }
|
|
508
513
|
.trigger.icon-only .logo { height: 12px; }
|
|
509
514
|
.trigger.icon-only { width: 44px; height: 44px; padding: 0; }
|
|
@@ -678,15 +683,28 @@ var EidLoginButton = class extends Base {
|
|
|
678
683
|
console.warn('<eid-login-button>: icon="none" \u0431\u0430 \u0442\u0435\u043A\u0441\u0442\u0433\u04AF\u0439 (variant="icon" \u044D\u0441\u0432\u044D\u043B label="") \u2014 \u0430\u043D\u0445\u0434\u0430\u0433\u0447 \u0442\u0435\u043A\u0441\u0442\u0438\u0439\u0433 \u0445\u0430\u0440\u0443\u0443\u043B\u0430\u0432.');
|
|
679
684
|
}
|
|
680
685
|
}
|
|
686
|
+
const brand = hasIcon && !iconOnly && !label;
|
|
681
687
|
const nodes = [];
|
|
682
|
-
if (
|
|
683
|
-
|
|
688
|
+
if (brand) nodes.push(this.brand({ part: "icon" }, { part: "label" }));
|
|
689
|
+
else {
|
|
690
|
+
if (hasIcon) nodes.push(logo({ part: "icon" }));
|
|
691
|
+
if (!iconOnly) nodes.push(el("span", { part: "label" }, text));
|
|
692
|
+
}
|
|
684
693
|
this.trigger.replaceChildren(...nodes);
|
|
685
694
|
this.trigger.classList.toggle("icon-only", iconOnly);
|
|
686
695
|
const aria = this.getAttribute("aria-label") || (iconOnly ? text : null);
|
|
687
696
|
if (aria) this.trigger.setAttribute("aria-label", aria);
|
|
688
697
|
else this.trigger.removeAttribute("aria-label");
|
|
689
698
|
}
|
|
699
|
+
/** Лого + i18n-ийн өмнөх/дараах текст. Лого aria-hidden тул уншигчид sr-only «eID» — нэр нь бүтэн «eID-ээр нэвтрэх». */
|
|
700
|
+
brand(logoAttrs = {}, textAttrs = {}) {
|
|
701
|
+
const [pre, post] = this.t.withLogo;
|
|
702
|
+
const box = el("span", { class: post && !pre ? "brand tight" : "brand" });
|
|
703
|
+
if (pre) box.append(el("span", textAttrs, pre));
|
|
704
|
+
box.append(logo(logoAttrs), el("span", { class: "sr-only" }, "eID"));
|
|
705
|
+
if (post) box.append(el("span", textAttrs, post));
|
|
706
|
+
return box;
|
|
707
|
+
}
|
|
690
708
|
disconnectedCallback() {
|
|
691
709
|
this.close();
|
|
692
710
|
this.themeObs?.disconnect();
|
|
@@ -734,7 +752,9 @@ var EidLoginButton = class extends Base {
|
|
|
734
752
|
const head = el("div", { class: "head" });
|
|
735
753
|
const x = el("button", { type: "button", class: "x", "aria-label": this.t.close }, "\xD7");
|
|
736
754
|
x.addEventListener("click", () => this.close());
|
|
737
|
-
|
|
755
|
+
const h2 = el("h2", { id: "eid-title" });
|
|
756
|
+
h2.append(this.brand());
|
|
757
|
+
head.append(h2, x);
|
|
738
758
|
this.body = el("div");
|
|
739
759
|
this.live = el("p", { class: "sr-only", "aria-live": "polite" });
|
|
740
760
|
dlg.append(head, this.body, this.live);
|
|
@@ -2287,7 +2287,16 @@ function nthPage(root, n) {
|
|
|
2287
2287
|
}
|
|
2288
2288
|
var MAX_VERIFY_ANNOTS = 1e4;
|
|
2289
2289
|
function defaultStampPage(doc, verifyUri) {
|
|
2290
|
-
const
|
|
2290
|
+
const pages = pageList(new Incremental(doc).root().key("Pages"));
|
|
2291
|
+
return { page: lastNonVerifyPage(pages, verifyUri), n: pages.length };
|
|
2292
|
+
}
|
|
2293
|
+
function lastNonVerifyPage(pages, verifyUri) {
|
|
2294
|
+
for (let i = pages.length - 1; verifyUri !== "" && i >= 0; i--) {
|
|
2295
|
+
if (!isVerifyPage(pages[i], verifyUri)) return i + 1;
|
|
2296
|
+
}
|
|
2297
|
+
return pages.length;
|
|
2298
|
+
}
|
|
2299
|
+
function pageList(root) {
|
|
2291
2300
|
const pages = [];
|
|
2292
2301
|
const walk = (v, depth) => {
|
|
2293
2302
|
if (depth > MAX_DEPTH2 || pages.length > 1 << 16) return;
|
|
@@ -2301,12 +2310,8 @@ function defaultStampPage(doc, verifyUri) {
|
|
|
2301
2310
|
}
|
|
2302
2311
|
}
|
|
2303
2312
|
};
|
|
2304
|
-
walk(
|
|
2305
|
-
|
|
2306
|
-
for (let i = n - 1; i >= 0; i--) {
|
|
2307
|
-
if (!isVerifyPage(pages[i], verifyUri)) return { page: i + 1, n };
|
|
2308
|
-
}
|
|
2309
|
-
return { page: n, n };
|
|
2313
|
+
walk(root, 0);
|
|
2314
|
+
return pages;
|
|
2310
2315
|
}
|
|
2311
2316
|
function isVerifyPage(page, verifyUri) {
|
|
2312
2317
|
try {
|
|
@@ -2355,5 +2360,7 @@ export {
|
|
|
2355
2360
|
visibleRect,
|
|
2356
2361
|
pageGeometry,
|
|
2357
2362
|
nthPage,
|
|
2358
|
-
defaultStampPage
|
|
2363
|
+
defaultStampPage,
|
|
2364
|
+
lastNonVerifyPage,
|
|
2365
|
+
pageList
|
|
2359
2366
|
};
|
package/dist/pades.cjs
CHANGED
|
@@ -26,7 +26,8 @@ __export(pades_exports, {
|
|
|
26
26
|
PadesError: () => PadesError,
|
|
27
27
|
complete: () => complete2,
|
|
28
28
|
prepare: () => prepare,
|
|
29
|
-
profileVersion: () => profileVersion
|
|
29
|
+
profileVersion: () => profileVersion,
|
|
30
|
+
suggestPlacement: () => suggestPlacement
|
|
30
31
|
});
|
|
31
32
|
module.exports = __toCommonJS(pades_exports);
|
|
32
33
|
|
|
@@ -3545,7 +3546,16 @@ function nthPage(root, n) {
|
|
|
3545
3546
|
}
|
|
3546
3547
|
var MAX_VERIFY_ANNOTS = 1e4;
|
|
3547
3548
|
function defaultStampPage(doc, verifyUri) {
|
|
3548
|
-
const
|
|
3549
|
+
const pages = pageList(new Incremental(doc).root().key("Pages"));
|
|
3550
|
+
return { page: lastNonVerifyPage(pages, verifyUri), n: pages.length };
|
|
3551
|
+
}
|
|
3552
|
+
function lastNonVerifyPage(pages, verifyUri) {
|
|
3553
|
+
for (let i = pages.length - 1; verifyUri !== "" && i >= 0; i--) {
|
|
3554
|
+
if (!isVerifyPage(pages[i], verifyUri)) return i + 1;
|
|
3555
|
+
}
|
|
3556
|
+
return pages.length;
|
|
3557
|
+
}
|
|
3558
|
+
function pageList(root) {
|
|
3549
3559
|
const pages = [];
|
|
3550
3560
|
const walk = (v, depth) => {
|
|
3551
3561
|
if (depth > MAX_DEPTH2 || pages.length > 1 << 16) return;
|
|
@@ -3559,12 +3569,8 @@ function defaultStampPage(doc, verifyUri) {
|
|
|
3559
3569
|
}
|
|
3560
3570
|
}
|
|
3561
3571
|
};
|
|
3562
|
-
walk(
|
|
3563
|
-
|
|
3564
|
-
for (let i = n - 1; i >= 0; i--) {
|
|
3565
|
-
if (!isVerifyPage(pages[i], verifyUri)) return { page: i + 1, n };
|
|
3566
|
-
}
|
|
3567
|
-
return { page: n, n };
|
|
3572
|
+
walk(root, 0);
|
|
3573
|
+
return pages;
|
|
3568
3574
|
}
|
|
3569
3575
|
function isVerifyPage(page, verifyUri) {
|
|
3570
3576
|
try {
|
|
@@ -4566,14 +4572,38 @@ function placeVisible(box, rot, x, y, w, h, occ) {
|
|
|
4566
4572
|
} catch {
|
|
4567
4573
|
continue;
|
|
4568
4574
|
}
|
|
4569
|
-
|
|
4570
|
-
const e1 = r[1] - PLACE_PAD;
|
|
4571
|
-
const e2 = r[2] + PLACE_PAD;
|
|
4572
|
-
const e3 = r[3] + PLACE_PAD;
|
|
4573
|
-
if (!occ.some((b) => b[0] < e2 && e0 < b[2] && b[1] < e3 && e1 < b[3])) return [cx, cy];
|
|
4575
|
+
if (placeFree(r, occ)) return [cx, cy];
|
|
4574
4576
|
}
|
|
4575
4577
|
return void 0;
|
|
4576
4578
|
}
|
|
4579
|
+
function placeFree(r, occ) {
|
|
4580
|
+
const e0 = r[0] - PLACE_PAD;
|
|
4581
|
+
const e1 = r[1] - PLACE_PAD;
|
|
4582
|
+
const e2 = r[2] + PLACE_PAD;
|
|
4583
|
+
const e3 = r[3] + PLACE_PAD;
|
|
4584
|
+
return !occ.some((b) => b[0] < e2 && e0 < b[2] && b[1] < e3 && e1 < b[3]);
|
|
4585
|
+
}
|
|
4586
|
+
function placeOnPage(page, box, rot, x, y, w, h, exact) {
|
|
4587
|
+
let occ;
|
|
4588
|
+
try {
|
|
4589
|
+
occ = occupancy(page, box);
|
|
4590
|
+
} catch {
|
|
4591
|
+
return { x, y, status: "unscanned" };
|
|
4592
|
+
}
|
|
4593
|
+
if (exact) {
|
|
4594
|
+
let r;
|
|
4595
|
+
try {
|
|
4596
|
+
r = visibleRect(box, rot, x, y, w, h);
|
|
4597
|
+
} catch {
|
|
4598
|
+
return { x, y, status: "overlap" };
|
|
4599
|
+
}
|
|
4600
|
+
return { x, y, status: placeFree(r, occ) ? "requested" : "overlap" };
|
|
4601
|
+
}
|
|
4602
|
+
const at = placeVisible(box, rot, x, y, w, h, occ);
|
|
4603
|
+
if (!at) return { x, y, status: "overlap" };
|
|
4604
|
+
if (at[0] !== x || at[1] !== y) return { x: at[0], y: at[1], status: "moved" };
|
|
4605
|
+
return { x, y, status: "requested" };
|
|
4606
|
+
}
|
|
4577
4607
|
|
|
4578
4608
|
// src/pades/pdf/signature.ts
|
|
4579
4609
|
var MEASURED_MAX_CMS = 14 << 10;
|
|
@@ -4646,20 +4676,8 @@ async function prepareSignature(base, signingTime, signerName, reason, vis) {
|
|
|
4646
4676
|
let rect = visibleRect(box, rot, vis.x, vis.y, vis.w, vis.h);
|
|
4647
4677
|
placement = { x: vis.x, y: vis.y, status: "requested" };
|
|
4648
4678
|
if (vis.avoid) {
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
occ = occupancy(page, box);
|
|
4652
|
-
} catch {
|
|
4653
|
-
placement.status = "unscanned";
|
|
4654
|
-
}
|
|
4655
|
-
if (occ) {
|
|
4656
|
-
const at = placeVisible(box, rot, vis.x, vis.y, vis.w, vis.h, occ);
|
|
4657
|
-
if (!at) placement.status = "overlap";
|
|
4658
|
-
else if (at[0] !== vis.x || at[1] !== vis.y) {
|
|
4659
|
-
placement = { x: at[0], y: at[1], status: "moved" };
|
|
4660
|
-
rect = visibleRect(box, rot, at[0], at[1], vis.w, vis.h);
|
|
4661
|
-
}
|
|
4662
|
-
}
|
|
4679
|
+
placement = placeOnPage(page, box, rot, vis.x, vis.y, vis.w, vis.h, vis.exact === true);
|
|
4680
|
+
if (placement.x !== vis.x || placement.y !== vis.y) rect = visibleRect(box, rot, placement.x, placement.y, vis.w, vis.h);
|
|
4663
4681
|
}
|
|
4664
4682
|
const bodies = appearanceObjects({ w: vis.w, h: vis.h, rotate: rot, name: vis.name, role: vis.role, lang: vis.lang, date: vis.date, url: vis.url }, apIDs);
|
|
4665
4683
|
inc.writeObject(fieldID, visibleWidget(fieldName, rect, page.ptr.id, page.ptr.gen, sigID, apIDs[0]));
|
|
@@ -4968,6 +4986,29 @@ function signatureCMSList(doc) {
|
|
|
4968
4986
|
return out;
|
|
4969
4987
|
}
|
|
4970
4988
|
|
|
4989
|
+
// src/pades/page/suggest.ts
|
|
4990
|
+
function suggestVisible(doc, verifyUri, page, x, y, w, h, exact) {
|
|
4991
|
+
const pages = pageList(new Incremental(doc).root().key("Pages"));
|
|
4992
|
+
const n = pages.length;
|
|
4993
|
+
if (page === 0) page = lastNonVerifyPage(pages, verifyUri);
|
|
4994
|
+
if (page < 1 || page > n) throw new AppearanceError(`page ${page} > \u0445\u0443\u0443\u0434\u0430\u0441\u043D\u044B \u0442\u043E\u043E ${n}`);
|
|
4995
|
+
const sizes = pages.map((p) => {
|
|
4996
|
+
try {
|
|
4997
|
+
const { box: box2, rot: rot2 } = pageGeometry(p);
|
|
4998
|
+
const vw = box2[2] - box2[0];
|
|
4999
|
+
const vh = box2[3] - box2[1];
|
|
5000
|
+
return rot2 === 90 || rot2 === 270 ? { w: vh, h: vw } : { w: vw, h: vh };
|
|
5001
|
+
} catch (e) {
|
|
5002
|
+
if (e instanceof AppearanceError) return void 0;
|
|
5003
|
+
throw e;
|
|
5004
|
+
}
|
|
5005
|
+
});
|
|
5006
|
+
const target = pages[page - 1];
|
|
5007
|
+
const { box, rot } = pageGeometry(target);
|
|
5008
|
+
visibleRect(box, rot, x, y, w, h);
|
|
5009
|
+
return { page, placement: placeOnPage(target, box, rot, x, y, w, h, exact), pages: sizes };
|
|
5010
|
+
}
|
|
5011
|
+
|
|
4971
5012
|
// src/pades/state.ts
|
|
4972
5013
|
var MAGIC = enc.encode("EIDPADES1");
|
|
4973
5014
|
function encodeState(s) {
|
|
@@ -5238,6 +5279,7 @@ function checkAppearance(o) {
|
|
|
5238
5279
|
const page = a.page ?? 0;
|
|
5239
5280
|
if (!Number.isInteger(page) || page < 0) throw bad("page \u2265 0");
|
|
5240
5281
|
if (a.lang !== void 0 && a.lang !== "" && a.lang !== "mn" && a.lang !== "en") throw bad("lang: mn | en");
|
|
5282
|
+
if (a.exact !== void 0 && typeof a.exact !== "boolean") throw bad("exact: boolean");
|
|
5241
5283
|
const role = o.claimedRole ?? "";
|
|
5242
5284
|
if (role !== "" && /[\p{Cc}\p{Cf}\p{Cs}]/u.test(role)) throw bad("claimedRole-\u0434 \u0443\u0434\u0438\u0440\u0434\u0430\u0445 \u0442\u044D\u043C\u0434\u044D\u0433\u0442");
|
|
5243
5285
|
}
|
|
@@ -5265,7 +5307,55 @@ function visibleSpec(doc, o, name, now, docId, revIndex) {
|
|
|
5265
5307
|
lang: a.lang || o.lang || "mn",
|
|
5266
5308
|
date: `${String(z.getUTCFullYear()).padStart(4, "0")}-${p2(z.getUTCMonth() + 1)}-${p2(z.getUTCDate())} ${p2(z.getUTCHours())}:${p2(z.getUTCMinutes())} (+08)`,
|
|
5267
5309
|
url: `${VERIFY_URL_PREFIX}${docId}/${revIndex}`,
|
|
5268
|
-
avoid: true
|
|
5310
|
+
avoid: true,
|
|
5311
|
+
exact: a.exact === true
|
|
5312
|
+
};
|
|
5313
|
+
}
|
|
5314
|
+
async function suggestPlacement(pdf, appearance) {
|
|
5315
|
+
const doc = u8(pdf, "pdf");
|
|
5316
|
+
if (doc.length > MAX_INPUT_BYTES) throw new PadesError("PDF_TOO_LARGE", "PDF 9.75 MB-\u0430\u0430\u0441 \u0438\u0445 \u0431\u0430\u0439\u043D\u0430");
|
|
5317
|
+
if (doc.length < 5 || String.fromCharCode(...doc.subarray(0, 5)) !== "%PDF-") throw new PadesError("PDF_INVALID", "PDF \u0431\u0438\u0448 \u044D\u0441\u0432\u044D\u043B \u044D\u0432\u0434\u044D\u0440\u0441\u044D\u043D");
|
|
5318
|
+
try {
|
|
5319
|
+
checkStructure(doc);
|
|
5320
|
+
} catch (e) {
|
|
5321
|
+
throw new PadesError("PDF_INVALID", "PDF-\u0438\u0439\u043D \u0431\u04AF\u0442\u044D\u0446 \u0445\u044D\u0442 \u0433\u04AF\u043D \u044D\u0441\u0432\u044D\u043B \u0442\u04E9\u0432\u04E9\u0433\u0442\u044D\u0439", { cause: e });
|
|
5322
|
+
}
|
|
5323
|
+
if (appearance === null || typeof appearance !== "object") throw new PadesError("REQUEST_INVALID", "appearance \u0437\u0430\u0430\u0432\u0430\u043B");
|
|
5324
|
+
checkAppearance({ appearance });
|
|
5325
|
+
if (encrypted(doc)) throw new PadesError("PDF_ENCRYPTED", "\u0448\u0438\u0444\u0440\u043B\u044D\u0433\u0434\u0441\u044D\u043D PDF \u0434\u044D\u043C\u0436\u0438\u0433\u0434\u044D\u0445\u0433\u04AF\u0439");
|
|
5326
|
+
let signed;
|
|
5327
|
+
try {
|
|
5328
|
+
signed = scanSignatures(doc).sigs.length > 0;
|
|
5329
|
+
} catch (e) {
|
|
5330
|
+
throw new PadesError("PDF_INVALID", "PDF \u0431\u0438\u0448 \u044D\u0441\u0432\u044D\u043B \u044D\u0432\u0434\u044D\u0440\u0441\u044D\u043D", { cause: e });
|
|
5331
|
+
}
|
|
5332
|
+
let verifyUri = "";
|
|
5333
|
+
if (signed) {
|
|
5334
|
+
const id = docIdFromPage(doc);
|
|
5335
|
+
if (id !== "") verifyUri = VERIFY_URL_PREFIX + id;
|
|
5336
|
+
}
|
|
5337
|
+
const w = round100(appearance.width);
|
|
5338
|
+
const h = round100(appearance.height);
|
|
5339
|
+
let s;
|
|
5340
|
+
try {
|
|
5341
|
+
s = suggestVisible(doc, verifyUri, appearance.page ?? 0, round100(appearance.x), round100(appearance.y), w, h, appearance.exact === true);
|
|
5342
|
+
} catch (e) {
|
|
5343
|
+
if (e instanceof AppearanceError) throw new PadesError("REQUEST_INVALID", `appearance: ${e.message}`, { cause: e });
|
|
5344
|
+
throw new PadesError("PDF_INVALID", "PDF \u0437\u0430\u0434\u0430\u0440\u0441\u0430\u043D\u0433\u04AF\u0439", { cause: e });
|
|
5345
|
+
}
|
|
5346
|
+
const pages = s.pages.map((p) => p ? { width: p.w / 100, height: p.h / 100 } : { width: 0, height: 0 });
|
|
5347
|
+
const cur = pages[s.page - 1];
|
|
5348
|
+
return {
|
|
5349
|
+
page: s.page,
|
|
5350
|
+
x: s.placement.x / 100,
|
|
5351
|
+
y: s.placement.y / 100,
|
|
5352
|
+
width: w / 100,
|
|
5353
|
+
height: h / 100,
|
|
5354
|
+
status: s.placement.status,
|
|
5355
|
+
pageWidth: cur.width,
|
|
5356
|
+
pageHeight: cur.height,
|
|
5357
|
+
pageCount: pages.length,
|
|
5358
|
+
pages
|
|
5269
5359
|
};
|
|
5270
5360
|
}
|
|
5271
5361
|
var DEFAULT_LTV_RETRIES = 2;
|
|
@@ -5417,5 +5507,6 @@ async function complete2(state, signature, opts = {}) {
|
|
|
5417
5507
|
PadesError,
|
|
5418
5508
|
complete,
|
|
5419
5509
|
prepare,
|
|
5420
|
-
profileVersion
|
|
5510
|
+
profileVersion,
|
|
5511
|
+
suggestPlacement
|
|
5421
5512
|
});
|
package/dist/pades.d.cts
CHANGED
|
@@ -58,7 +58,8 @@ interface PadesPrepareOptions {
|
|
|
58
58
|
* (байхгүй бол MediaBox)-ийн /Rotate-ийн ДАРААХ (дэлгэцэнд харагдах) зүүн доод булангаас; x баруун тийш, y дээш. Утга бүр
|
|
59
59
|
* 0.01 pt хүртэл тойрогдоно. Өндөр ≥ 45 pt (QR), эс бөгөөс REQUEST_INVALID.
|
|
60
60
|
* `x, y` нь хүссэн байрлал: тэнд хуудасны агуулга байвал дүрслэл чөлөөт зай руу шилжинэ (PLACEMENT_SPEC.md) — эцсийн
|
|
61
|
-
* байрлал {@link PadesPrepared.placement}-д.
|
|
61
|
+
* байрлал {@link PadesPrepared.placement}-д. `exact: true` бол яг энд зурна (шилжүүлэхгүй, §6a). Урьдчилан харах /
|
|
62
|
+
* координат хөрвүүлэхэд {@link suggestPlacement}.
|
|
62
63
|
*/
|
|
63
64
|
interface PadesAppearance {
|
|
64
65
|
/**
|
|
@@ -73,6 +74,14 @@ interface PadesAppearance {
|
|
|
73
74
|
height: number;
|
|
74
75
|
/** `mn` | `en`; байхгүй бол `lang` (тэр нь байхгүй бол mn). */
|
|
75
76
|
lang?: "mn" | "en";
|
|
77
|
+
/**
|
|
78
|
+
* Draw the stamp exactly at page/x/y/width/height — a position the signer chose (e.g. dragged on a page preview);
|
|
79
|
+
* never moved off page content (PLACEMENT_SPEC.md §6a). The rect must still lie inside the page (else
|
|
80
|
+
* `REQUEST_INVALID`, never clamped). The page is still scanned: `placement.status` is `requested` when the rect is
|
|
81
|
+
* free, `overlap` when content is under it, `unscanned` when the page cannot be scanned — never `moved`.
|
|
82
|
+
* false / absent (default) = the rect is only the preferred spot. Not written into the PDF. Since 0.29.0.
|
|
83
|
+
*/
|
|
84
|
+
exact?: boolean;
|
|
76
85
|
}
|
|
77
86
|
interface PadesPrepared {
|
|
78
87
|
/** SHA-256(DER(signedAttrs)) — 32 байт; `eid.signPdfDigest({dtbs})` / токены `C_Sign`-ийн оролт. */
|
|
@@ -91,10 +100,11 @@ interface PadesPrepared {
|
|
|
91
100
|
* - `requested` — drawn at `appearance.x/y` (that spot was free);
|
|
92
101
|
* - `moved` — that spot overlapped page content; the stamp moved to the first free spot (mirrored column, then up in
|
|
93
102
|
* 12 pt steps);
|
|
94
|
-
* - `overlap` — no free spot; drawn at the requested spot over content;
|
|
103
|
+
* - `overlap` — no free spot (with `appearance.exact`: content under the rect); drawn at the requested spot over content;
|
|
95
104
|
* - `unscanned` — the page could not be scanned within the limits; drawn at the requested spot.
|
|
96
105
|
*
|
|
97
|
-
* The signature is valid in every case; surface `overlap` /
|
|
106
|
+
* With `appearance.exact` the status is never `moved`. The signature is valid in every case; surface `overlap` /
|
|
107
|
+
* `unscanned` to the user (e.g. a notice).
|
|
98
108
|
*/
|
|
99
109
|
interface PadesPlacement {
|
|
100
110
|
/** 1-based page of the input document the stamp is on. */
|
|
@@ -106,6 +116,34 @@ interface PadesPlacement {
|
|
|
106
116
|
status: PadesPlacementStatus;
|
|
107
117
|
}
|
|
108
118
|
type PadesPlacementStatus = "requested" | "moved" | "overlap" | "unscanned";
|
|
119
|
+
/**
|
|
120
|
+
* {@link suggestPlacement}'s result (Go `pades.Suggestion`, PLACEMENT_SPEC.md §6b), pt. `page, x, y, width, height,
|
|
121
|
+
* status` are exactly what {@link prepare} returns in {@link PadesPrepared.placement} for the same PDF and appearance
|
|
122
|
+
* (except an unsigned input that already carries verify pages of the docId later passed to prepare). Coordinates are the
|
|
123
|
+
* appearance space: origin at the visible lower-left, x right, y up. A UI that renders page `page` at `s` px/pt with a
|
|
124
|
+
* top-left origin maps `left = x·s`, `top = (pageHeight − y − height)·s`; back: `x = left/s`,
|
|
125
|
+
* `y = pageHeight − top/s − height`, then pass `exact: true` so the stamp stays where the user put it.
|
|
126
|
+
*/
|
|
127
|
+
interface PlacementSuggestion {
|
|
128
|
+
/** 1-based page of the input document (page 0 resolved as in prepare). */
|
|
129
|
+
page: number;
|
|
130
|
+
x: number;
|
|
131
|
+
y: number;
|
|
132
|
+
width: number;
|
|
133
|
+
height: number;
|
|
134
|
+
/** `requested` | `moved` | `overlap` | `unscanned` (never `moved` with `exact`). */
|
|
135
|
+
status: "requested" | "moved" | "overlap" | "unscanned";
|
|
136
|
+
/** Visible size of `page` (CropBox, else MediaBox; after /Rotate) = `pages[page - 1]`. */
|
|
137
|
+
pageWidth: number;
|
|
138
|
+
pageHeight: number;
|
|
139
|
+
/** Pages in /Pages tree order. */
|
|
140
|
+
pageCount: number;
|
|
141
|
+
/** Visible size of every page, index 0 = page 1; `{0, 0}` = that page's geometry is unreadable (no stamp there). */
|
|
142
|
+
pages: {
|
|
143
|
+
width: number;
|
|
144
|
+
height: number;
|
|
145
|
+
}[];
|
|
146
|
+
}
|
|
109
147
|
interface PadesCompleteOptions {
|
|
110
148
|
/** RFC 3161 TSA. Анхдагч `https://tsa.timeserver.mn/`. */
|
|
111
149
|
tsaUrl?: string;
|
|
@@ -175,6 +213,21 @@ declare function profileVersion(): string;
|
|
|
175
213
|
* PDF_PRIOR_SIGNATURE_INVALID / PDF_FOREIGN_SIGNATURE / SIGNER_INVALID / REQUEST_INVALID
|
|
176
214
|
*/
|
|
177
215
|
declare function prepare(pdf: Uint8Array | ArrayBuffer, opts: PadesPrepareOptions): Promise<PadesPrepared>;
|
|
216
|
+
/**
|
|
217
|
+
* Runs {@link prepare}'s stamp placement (page 0 resolution, page scan, candidate search; `appearance.exact`) on `pdf`
|
|
218
|
+
* without signing — no certificate, no network (PLACEMENT_SPEC.md §6b). A UI shows the default stamp position and the
|
|
219
|
+
* page sizes before signing, maps the user's drag back to `appearance` coordinates and passes `exact: true` to prepare.
|
|
220
|
+
*
|
|
221
|
+
* Checks, in order: size (`PDF_TOO_LARGE`), `%PDF-` header and structure (`PDF_INVALID`), the appearance values
|
|
222
|
+
* (`REQUEST_INVALID`), encryption (`PDF_ENCRYPTED`), the signature scan (`PDF_INVALID`), page > page count / page box /
|
|
223
|
+
* `/Rotate` / rect outside the page (`REQUEST_INVALID`). Not checked (prepare does): prior signatures
|
|
224
|
+
* (`PDF_FOREIGN_SIGNATURE`, `PDF_PRIOR_SIGNATURE_INVALID`, `PDF_LOCKED`, `PDF_TOO_MANY_SIGNATURES`), the signer, `docId`,
|
|
225
|
+
* whether the name/role fit the stamp. Page 0 skips this document's eID verify pages using the docId read from its
|
|
226
|
+
* verify page; an unsigned document skips no page (the last page). Since 0.29.0.
|
|
227
|
+
*
|
|
228
|
+
* @throws {PadesError} PDF_TOO_LARGE / PDF_INVALID / REQUEST_INVALID / PDF_ENCRYPTED
|
|
229
|
+
*/
|
|
230
|
+
declare function suggestPlacement(pdf: Uint8Array, appearance: PadesAppearance): Promise<PlacementSuggestion>;
|
|
178
231
|
/**
|
|
179
232
|
* Иргэний гарын үсгийг (session `signature.value` — base64 мөр эсвэл байт; RSA PKCS#1 v1.5, ECDSA r‖s эсвэл DER) DTBS-д
|
|
180
233
|
* шалгаад TSA → CMS → embed → OCSP/CRL (genTime-ийн дараа) → DSS revision. Сүлжээ: tsa.timeserver.mn, AIA/CDP.
|
|
@@ -187,4 +240,4 @@ declare function prepare(pdf: Uint8Array | ArrayBuffer, opts: PadesPrepareOption
|
|
|
187
240
|
*/
|
|
188
241
|
declare function complete(state: Uint8Array | ArrayBuffer, signature: Uint8Array | string, opts?: PadesCompleteOptions): Promise<PadesCompleted>;
|
|
189
242
|
|
|
190
|
-
export { CertificateRevokedError, PADES_ERROR_CODES, PROFILE_VERSION, type PadesAppearance, type PadesCompleteOptions, type PadesCompleted, PadesError, type PadesErrorCode, type PadesPlacement, type PadesPlacementStatus, type PadesPrepareOptions, type PadesPrepared, complete, prepare, profileVersion };
|
|
243
|
+
export { CertificateRevokedError, PADES_ERROR_CODES, PROFILE_VERSION, type PadesAppearance, type PadesCompleteOptions, type PadesCompleted, PadesError, type PadesErrorCode, type PadesPlacement, type PadesPlacementStatus, type PadesPrepareOptions, type PadesPrepared, type PlacementSuggestion, complete, prepare, profileVersion, suggestPlacement };
|
package/dist/pades.d.ts
CHANGED
|
@@ -58,7 +58,8 @@ interface PadesPrepareOptions {
|
|
|
58
58
|
* (байхгүй бол MediaBox)-ийн /Rotate-ийн ДАРААХ (дэлгэцэнд харагдах) зүүн доод булангаас; x баруун тийш, y дээш. Утга бүр
|
|
59
59
|
* 0.01 pt хүртэл тойрогдоно. Өндөр ≥ 45 pt (QR), эс бөгөөс REQUEST_INVALID.
|
|
60
60
|
* `x, y` нь хүссэн байрлал: тэнд хуудасны агуулга байвал дүрслэл чөлөөт зай руу шилжинэ (PLACEMENT_SPEC.md) — эцсийн
|
|
61
|
-
* байрлал {@link PadesPrepared.placement}-д.
|
|
61
|
+
* байрлал {@link PadesPrepared.placement}-д. `exact: true` бол яг энд зурна (шилжүүлэхгүй, §6a). Урьдчилан харах /
|
|
62
|
+
* координат хөрвүүлэхэд {@link suggestPlacement}.
|
|
62
63
|
*/
|
|
63
64
|
interface PadesAppearance {
|
|
64
65
|
/**
|
|
@@ -73,6 +74,14 @@ interface PadesAppearance {
|
|
|
73
74
|
height: number;
|
|
74
75
|
/** `mn` | `en`; байхгүй бол `lang` (тэр нь байхгүй бол mn). */
|
|
75
76
|
lang?: "mn" | "en";
|
|
77
|
+
/**
|
|
78
|
+
* Draw the stamp exactly at page/x/y/width/height — a position the signer chose (e.g. dragged on a page preview);
|
|
79
|
+
* never moved off page content (PLACEMENT_SPEC.md §6a). The rect must still lie inside the page (else
|
|
80
|
+
* `REQUEST_INVALID`, never clamped). The page is still scanned: `placement.status` is `requested` when the rect is
|
|
81
|
+
* free, `overlap` when content is under it, `unscanned` when the page cannot be scanned — never `moved`.
|
|
82
|
+
* false / absent (default) = the rect is only the preferred spot. Not written into the PDF. Since 0.29.0.
|
|
83
|
+
*/
|
|
84
|
+
exact?: boolean;
|
|
76
85
|
}
|
|
77
86
|
interface PadesPrepared {
|
|
78
87
|
/** SHA-256(DER(signedAttrs)) — 32 байт; `eid.signPdfDigest({dtbs})` / токены `C_Sign`-ийн оролт. */
|
|
@@ -91,10 +100,11 @@ interface PadesPrepared {
|
|
|
91
100
|
* - `requested` — drawn at `appearance.x/y` (that spot was free);
|
|
92
101
|
* - `moved` — that spot overlapped page content; the stamp moved to the first free spot (mirrored column, then up in
|
|
93
102
|
* 12 pt steps);
|
|
94
|
-
* - `overlap` — no free spot; drawn at the requested spot over content;
|
|
103
|
+
* - `overlap` — no free spot (with `appearance.exact`: content under the rect); drawn at the requested spot over content;
|
|
95
104
|
* - `unscanned` — the page could not be scanned within the limits; drawn at the requested spot.
|
|
96
105
|
*
|
|
97
|
-
* The signature is valid in every case; surface `overlap` /
|
|
106
|
+
* With `appearance.exact` the status is never `moved`. The signature is valid in every case; surface `overlap` /
|
|
107
|
+
* `unscanned` to the user (e.g. a notice).
|
|
98
108
|
*/
|
|
99
109
|
interface PadesPlacement {
|
|
100
110
|
/** 1-based page of the input document the stamp is on. */
|
|
@@ -106,6 +116,34 @@ interface PadesPlacement {
|
|
|
106
116
|
status: PadesPlacementStatus;
|
|
107
117
|
}
|
|
108
118
|
type PadesPlacementStatus = "requested" | "moved" | "overlap" | "unscanned";
|
|
119
|
+
/**
|
|
120
|
+
* {@link suggestPlacement}'s result (Go `pades.Suggestion`, PLACEMENT_SPEC.md §6b), pt. `page, x, y, width, height,
|
|
121
|
+
* status` are exactly what {@link prepare} returns in {@link PadesPrepared.placement} for the same PDF and appearance
|
|
122
|
+
* (except an unsigned input that already carries verify pages of the docId later passed to prepare). Coordinates are the
|
|
123
|
+
* appearance space: origin at the visible lower-left, x right, y up. A UI that renders page `page` at `s` px/pt with a
|
|
124
|
+
* top-left origin maps `left = x·s`, `top = (pageHeight − y − height)·s`; back: `x = left/s`,
|
|
125
|
+
* `y = pageHeight − top/s − height`, then pass `exact: true` so the stamp stays where the user put it.
|
|
126
|
+
*/
|
|
127
|
+
interface PlacementSuggestion {
|
|
128
|
+
/** 1-based page of the input document (page 0 resolved as in prepare). */
|
|
129
|
+
page: number;
|
|
130
|
+
x: number;
|
|
131
|
+
y: number;
|
|
132
|
+
width: number;
|
|
133
|
+
height: number;
|
|
134
|
+
/** `requested` | `moved` | `overlap` | `unscanned` (never `moved` with `exact`). */
|
|
135
|
+
status: "requested" | "moved" | "overlap" | "unscanned";
|
|
136
|
+
/** Visible size of `page` (CropBox, else MediaBox; after /Rotate) = `pages[page - 1]`. */
|
|
137
|
+
pageWidth: number;
|
|
138
|
+
pageHeight: number;
|
|
139
|
+
/** Pages in /Pages tree order. */
|
|
140
|
+
pageCount: number;
|
|
141
|
+
/** Visible size of every page, index 0 = page 1; `{0, 0}` = that page's geometry is unreadable (no stamp there). */
|
|
142
|
+
pages: {
|
|
143
|
+
width: number;
|
|
144
|
+
height: number;
|
|
145
|
+
}[];
|
|
146
|
+
}
|
|
109
147
|
interface PadesCompleteOptions {
|
|
110
148
|
/** RFC 3161 TSA. Анхдагч `https://tsa.timeserver.mn/`. */
|
|
111
149
|
tsaUrl?: string;
|
|
@@ -175,6 +213,21 @@ declare function profileVersion(): string;
|
|
|
175
213
|
* PDF_PRIOR_SIGNATURE_INVALID / PDF_FOREIGN_SIGNATURE / SIGNER_INVALID / REQUEST_INVALID
|
|
176
214
|
*/
|
|
177
215
|
declare function prepare(pdf: Uint8Array | ArrayBuffer, opts: PadesPrepareOptions): Promise<PadesPrepared>;
|
|
216
|
+
/**
|
|
217
|
+
* Runs {@link prepare}'s stamp placement (page 0 resolution, page scan, candidate search; `appearance.exact`) on `pdf`
|
|
218
|
+
* without signing — no certificate, no network (PLACEMENT_SPEC.md §6b). A UI shows the default stamp position and the
|
|
219
|
+
* page sizes before signing, maps the user's drag back to `appearance` coordinates and passes `exact: true` to prepare.
|
|
220
|
+
*
|
|
221
|
+
* Checks, in order: size (`PDF_TOO_LARGE`), `%PDF-` header and structure (`PDF_INVALID`), the appearance values
|
|
222
|
+
* (`REQUEST_INVALID`), encryption (`PDF_ENCRYPTED`), the signature scan (`PDF_INVALID`), page > page count / page box /
|
|
223
|
+
* `/Rotate` / rect outside the page (`REQUEST_INVALID`). Not checked (prepare does): prior signatures
|
|
224
|
+
* (`PDF_FOREIGN_SIGNATURE`, `PDF_PRIOR_SIGNATURE_INVALID`, `PDF_LOCKED`, `PDF_TOO_MANY_SIGNATURES`), the signer, `docId`,
|
|
225
|
+
* whether the name/role fit the stamp. Page 0 skips this document's eID verify pages using the docId read from its
|
|
226
|
+
* verify page; an unsigned document skips no page (the last page). Since 0.29.0.
|
|
227
|
+
*
|
|
228
|
+
* @throws {PadesError} PDF_TOO_LARGE / PDF_INVALID / REQUEST_INVALID / PDF_ENCRYPTED
|
|
229
|
+
*/
|
|
230
|
+
declare function suggestPlacement(pdf: Uint8Array, appearance: PadesAppearance): Promise<PlacementSuggestion>;
|
|
178
231
|
/**
|
|
179
232
|
* Иргэний гарын үсгийг (session `signature.value` — base64 мөр эсвэл байт; RSA PKCS#1 v1.5, ECDSA r‖s эсвэл DER) DTBS-д
|
|
180
233
|
* шалгаад TSA → CMS → embed → OCSP/CRL (genTime-ийн дараа) → DSS revision. Сүлжээ: tsa.timeserver.mn, AIA/CDP.
|
|
@@ -187,4 +240,4 @@ declare function prepare(pdf: Uint8Array | ArrayBuffer, opts: PadesPrepareOption
|
|
|
187
240
|
*/
|
|
188
241
|
declare function complete(state: Uint8Array | ArrayBuffer, signature: Uint8Array | string, opts?: PadesCompleteOptions): Promise<PadesCompleted>;
|
|
189
242
|
|
|
190
|
-
export { CertificateRevokedError, PADES_ERROR_CODES, PROFILE_VERSION, type PadesAppearance, type PadesCompleteOptions, type PadesCompleted, PadesError, type PadesErrorCode, type PadesPlacement, type PadesPlacementStatus, type PadesPrepareOptions, type PadesPrepared, complete, prepare, profileVersion };
|
|
243
|
+
export { CertificateRevokedError, PADES_ERROR_CODES, PROFILE_VERSION, type PadesAppearance, type PadesCompleteOptions, type PadesCompleted, PadesError, type PadesErrorCode, type PadesPlacement, type PadesPlacementStatus, type PadesPrepareOptions, type PadesPrepared, type PlacementSuggestion, complete, prepare, profileVersion, suggestPlacement };
|
package/dist/pades.js
CHANGED
|
@@ -14,14 +14,16 @@ import {
|
|
|
14
14
|
escapeName,
|
|
15
15
|
hexString,
|
|
16
16
|
isBrowser,
|
|
17
|
+
lastNonVerifyPage,
|
|
17
18
|
nthPage,
|
|
18
19
|
pageGeometry,
|
|
20
|
+
pageList,
|
|
19
21
|
round100,
|
|
20
22
|
serialize,
|
|
21
23
|
visibleRect,
|
|
22
24
|
visibleWidget,
|
|
23
25
|
zlibInflateStrict
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-P65FCDR5.js";
|
|
25
27
|
import {
|
|
26
28
|
CLAIMED_ROLE_MAX_RUNES,
|
|
27
29
|
CertificateRevokedError,
|
|
@@ -1041,14 +1043,38 @@ function placeVisible(box, rot, x, y, w, h, occ) {
|
|
|
1041
1043
|
} catch {
|
|
1042
1044
|
continue;
|
|
1043
1045
|
}
|
|
1044
|
-
|
|
1045
|
-
const e1 = r[1] - PLACE_PAD;
|
|
1046
|
-
const e2 = r[2] + PLACE_PAD;
|
|
1047
|
-
const e3 = r[3] + PLACE_PAD;
|
|
1048
|
-
if (!occ.some((b) => b[0] < e2 && e0 < b[2] && b[1] < e3 && e1 < b[3])) return [cx, cy];
|
|
1046
|
+
if (placeFree(r, occ)) return [cx, cy];
|
|
1049
1047
|
}
|
|
1050
1048
|
return void 0;
|
|
1051
1049
|
}
|
|
1050
|
+
function placeFree(r, occ) {
|
|
1051
|
+
const e0 = r[0] - PLACE_PAD;
|
|
1052
|
+
const e1 = r[1] - PLACE_PAD;
|
|
1053
|
+
const e2 = r[2] + PLACE_PAD;
|
|
1054
|
+
const e3 = r[3] + PLACE_PAD;
|
|
1055
|
+
return !occ.some((b) => b[0] < e2 && e0 < b[2] && b[1] < e3 && e1 < b[3]);
|
|
1056
|
+
}
|
|
1057
|
+
function placeOnPage(page, box, rot, x, y, w, h, exact) {
|
|
1058
|
+
let occ;
|
|
1059
|
+
try {
|
|
1060
|
+
occ = occupancy(page, box);
|
|
1061
|
+
} catch {
|
|
1062
|
+
return { x, y, status: "unscanned" };
|
|
1063
|
+
}
|
|
1064
|
+
if (exact) {
|
|
1065
|
+
let r;
|
|
1066
|
+
try {
|
|
1067
|
+
r = visibleRect(box, rot, x, y, w, h);
|
|
1068
|
+
} catch {
|
|
1069
|
+
return { x, y, status: "overlap" };
|
|
1070
|
+
}
|
|
1071
|
+
return { x, y, status: placeFree(r, occ) ? "requested" : "overlap" };
|
|
1072
|
+
}
|
|
1073
|
+
const at = placeVisible(box, rot, x, y, w, h, occ);
|
|
1074
|
+
if (!at) return { x, y, status: "overlap" };
|
|
1075
|
+
if (at[0] !== x || at[1] !== y) return { x: at[0], y: at[1], status: "moved" };
|
|
1076
|
+
return { x, y, status: "requested" };
|
|
1077
|
+
}
|
|
1052
1078
|
|
|
1053
1079
|
// src/pades/pdf/signature.ts
|
|
1054
1080
|
var MEASURED_MAX_CMS = 14 << 10;
|
|
@@ -1121,20 +1147,8 @@ async function prepareSignature(base, signingTime, signerName, reason, vis) {
|
|
|
1121
1147
|
let rect = visibleRect(box, rot, vis.x, vis.y, vis.w, vis.h);
|
|
1122
1148
|
placement = { x: vis.x, y: vis.y, status: "requested" };
|
|
1123
1149
|
if (vis.avoid) {
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
occ = occupancy(page, box);
|
|
1127
|
-
} catch {
|
|
1128
|
-
placement.status = "unscanned";
|
|
1129
|
-
}
|
|
1130
|
-
if (occ) {
|
|
1131
|
-
const at = placeVisible(box, rot, vis.x, vis.y, vis.w, vis.h, occ);
|
|
1132
|
-
if (!at) placement.status = "overlap";
|
|
1133
|
-
else if (at[0] !== vis.x || at[1] !== vis.y) {
|
|
1134
|
-
placement = { x: at[0], y: at[1], status: "moved" };
|
|
1135
|
-
rect = visibleRect(box, rot, at[0], at[1], vis.w, vis.h);
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1150
|
+
placement = placeOnPage(page, box, rot, vis.x, vis.y, vis.w, vis.h, vis.exact === true);
|
|
1151
|
+
if (placement.x !== vis.x || placement.y !== vis.y) rect = visibleRect(box, rot, placement.x, placement.y, vis.w, vis.h);
|
|
1138
1152
|
}
|
|
1139
1153
|
const bodies = appearanceObjects({ w: vis.w, h: vis.h, rotate: rot, name: vis.name, role: vis.role, lang: vis.lang, date: vis.date, url: vis.url }, apIDs);
|
|
1140
1154
|
inc.writeObject(fieldID, visibleWidget(fieldName, rect, page.ptr.id, page.ptr.gen, sigID, apIDs[0]));
|
|
@@ -1443,6 +1457,29 @@ function signatureCMSList(doc) {
|
|
|
1443
1457
|
return out;
|
|
1444
1458
|
}
|
|
1445
1459
|
|
|
1460
|
+
// src/pades/page/suggest.ts
|
|
1461
|
+
function suggestVisible(doc, verifyUri, page, x, y, w, h, exact) {
|
|
1462
|
+
const pages = pageList(new Incremental(doc).root().key("Pages"));
|
|
1463
|
+
const n = pages.length;
|
|
1464
|
+
if (page === 0) page = lastNonVerifyPage(pages, verifyUri);
|
|
1465
|
+
if (page < 1 || page > n) throw new AppearanceError(`page ${page} > \u0445\u0443\u0443\u0434\u0430\u0441\u043D\u044B \u0442\u043E\u043E ${n}`);
|
|
1466
|
+
const sizes = pages.map((p) => {
|
|
1467
|
+
try {
|
|
1468
|
+
const { box: box2, rot: rot2 } = pageGeometry(p);
|
|
1469
|
+
const vw = box2[2] - box2[0];
|
|
1470
|
+
const vh = box2[3] - box2[1];
|
|
1471
|
+
return rot2 === 90 || rot2 === 270 ? { w: vh, h: vw } : { w: vw, h: vh };
|
|
1472
|
+
} catch (e) {
|
|
1473
|
+
if (e instanceof AppearanceError) return void 0;
|
|
1474
|
+
throw e;
|
|
1475
|
+
}
|
|
1476
|
+
});
|
|
1477
|
+
const target = pages[page - 1];
|
|
1478
|
+
const { box, rot } = pageGeometry(target);
|
|
1479
|
+
visibleRect(box, rot, x, y, w, h);
|
|
1480
|
+
return { page, placement: placeOnPage(target, box, rot, x, y, w, h, exact), pages: sizes };
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1446
1483
|
// src/pades/state.ts
|
|
1447
1484
|
var MAGIC = enc.encode("EIDPADES1");
|
|
1448
1485
|
function encodeState(s) {
|
|
@@ -1713,6 +1750,7 @@ function checkAppearance(o) {
|
|
|
1713
1750
|
const page = a.page ?? 0;
|
|
1714
1751
|
if (!Number.isInteger(page) || page < 0) throw bad("page \u2265 0");
|
|
1715
1752
|
if (a.lang !== void 0 && a.lang !== "" && a.lang !== "mn" && a.lang !== "en") throw bad("lang: mn | en");
|
|
1753
|
+
if (a.exact !== void 0 && typeof a.exact !== "boolean") throw bad("exact: boolean");
|
|
1716
1754
|
const role = o.claimedRole ?? "";
|
|
1717
1755
|
if (role !== "" && /[\p{Cc}\p{Cf}\p{Cs}]/u.test(role)) throw bad("claimedRole-\u0434 \u0443\u0434\u0438\u0440\u0434\u0430\u0445 \u0442\u044D\u043C\u0434\u044D\u0433\u0442");
|
|
1718
1756
|
}
|
|
@@ -1740,7 +1778,55 @@ function visibleSpec(doc, o, name, now, docId, revIndex) {
|
|
|
1740
1778
|
lang: a.lang || o.lang || "mn",
|
|
1741
1779
|
date: `${String(z.getUTCFullYear()).padStart(4, "0")}-${p2(z.getUTCMonth() + 1)}-${p2(z.getUTCDate())} ${p2(z.getUTCHours())}:${p2(z.getUTCMinutes())} (+08)`,
|
|
1742
1780
|
url: `${VERIFY_URL_PREFIX}${docId}/${revIndex}`,
|
|
1743
|
-
avoid: true
|
|
1781
|
+
avoid: true,
|
|
1782
|
+
exact: a.exact === true
|
|
1783
|
+
};
|
|
1784
|
+
}
|
|
1785
|
+
async function suggestPlacement(pdf, appearance) {
|
|
1786
|
+
const doc = u8(pdf, "pdf");
|
|
1787
|
+
if (doc.length > MAX_INPUT_BYTES) throw new PadesError("PDF_TOO_LARGE", "PDF 9.75 MB-\u0430\u0430\u0441 \u0438\u0445 \u0431\u0430\u0439\u043D\u0430");
|
|
1788
|
+
if (doc.length < 5 || String.fromCharCode(...doc.subarray(0, 5)) !== "%PDF-") throw new PadesError("PDF_INVALID", "PDF \u0431\u0438\u0448 \u044D\u0441\u0432\u044D\u043B \u044D\u0432\u0434\u044D\u0440\u0441\u044D\u043D");
|
|
1789
|
+
try {
|
|
1790
|
+
checkStructure(doc);
|
|
1791
|
+
} catch (e) {
|
|
1792
|
+
throw new PadesError("PDF_INVALID", "PDF-\u0438\u0439\u043D \u0431\u04AF\u0442\u044D\u0446 \u0445\u044D\u0442 \u0433\u04AF\u043D \u044D\u0441\u0432\u044D\u043B \u0442\u04E9\u0432\u04E9\u0433\u0442\u044D\u0439", { cause: e });
|
|
1793
|
+
}
|
|
1794
|
+
if (appearance === null || typeof appearance !== "object") throw new PadesError("REQUEST_INVALID", "appearance \u0437\u0430\u0430\u0432\u0430\u043B");
|
|
1795
|
+
checkAppearance({ appearance });
|
|
1796
|
+
if (encrypted(doc)) throw new PadesError("PDF_ENCRYPTED", "\u0448\u0438\u0444\u0440\u043B\u044D\u0433\u0434\u0441\u044D\u043D PDF \u0434\u044D\u043C\u0436\u0438\u0433\u0434\u044D\u0445\u0433\u04AF\u0439");
|
|
1797
|
+
let signed;
|
|
1798
|
+
try {
|
|
1799
|
+
signed = scanSignatures(doc).sigs.length > 0;
|
|
1800
|
+
} catch (e) {
|
|
1801
|
+
throw new PadesError("PDF_INVALID", "PDF \u0431\u0438\u0448 \u044D\u0441\u0432\u044D\u043B \u044D\u0432\u0434\u044D\u0440\u0441\u044D\u043D", { cause: e });
|
|
1802
|
+
}
|
|
1803
|
+
let verifyUri = "";
|
|
1804
|
+
if (signed) {
|
|
1805
|
+
const id = docIdFromPage(doc);
|
|
1806
|
+
if (id !== "") verifyUri = VERIFY_URL_PREFIX + id;
|
|
1807
|
+
}
|
|
1808
|
+
const w = round100(appearance.width);
|
|
1809
|
+
const h = round100(appearance.height);
|
|
1810
|
+
let s;
|
|
1811
|
+
try {
|
|
1812
|
+
s = suggestVisible(doc, verifyUri, appearance.page ?? 0, round100(appearance.x), round100(appearance.y), w, h, appearance.exact === true);
|
|
1813
|
+
} catch (e) {
|
|
1814
|
+
if (e instanceof AppearanceError) throw new PadesError("REQUEST_INVALID", `appearance: ${e.message}`, { cause: e });
|
|
1815
|
+
throw new PadesError("PDF_INVALID", "PDF \u0437\u0430\u0434\u0430\u0440\u0441\u0430\u043D\u0433\u04AF\u0439", { cause: e });
|
|
1816
|
+
}
|
|
1817
|
+
const pages = s.pages.map((p) => p ? { width: p.w / 100, height: p.h / 100 } : { width: 0, height: 0 });
|
|
1818
|
+
const cur = pages[s.page - 1];
|
|
1819
|
+
return {
|
|
1820
|
+
page: s.page,
|
|
1821
|
+
x: s.placement.x / 100,
|
|
1822
|
+
y: s.placement.y / 100,
|
|
1823
|
+
width: w / 100,
|
|
1824
|
+
height: h / 100,
|
|
1825
|
+
status: s.placement.status,
|
|
1826
|
+
pageWidth: cur.width,
|
|
1827
|
+
pageHeight: cur.height,
|
|
1828
|
+
pageCount: pages.length,
|
|
1829
|
+
pages
|
|
1744
1830
|
};
|
|
1745
1831
|
}
|
|
1746
1832
|
var DEFAULT_LTV_RETRIES = 2;
|
|
@@ -1891,5 +1977,6 @@ export {
|
|
|
1891
1977
|
PadesError,
|
|
1892
1978
|
complete,
|
|
1893
1979
|
prepare,
|
|
1894
|
-
profileVersion
|
|
1980
|
+
profileVersion,
|
|
1981
|
+
suggestPlacement
|
|
1895
1982
|
};
|
package/dist/validate.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gerege-systems/eid-mongolia-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "e-ID Mongolia Relying Party SDK — иргэнээр утсаар нь нэвтрэлт ба хууль ёсны цахим гарын үсэг (RP-API v3, Smart-ID нийцтэй).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|