@gerege-systems/eid-mongolia-sdk 0.34.0 → 0.36.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
@@ -151,7 +151,7 @@ app.use("/auth/eid", express.json(), async (req, res) => {
151
151
  | Атрибут (`mount…` сонголт) | Утга | Анхдагч |
152
152
  |---|---|---|
153
153
  | `start-url` (`startUrl`), `status-url` (`statusUrl`) | backend endpoint | — (заавал) |
154
- | `lang` | `mn` \| `en` | `mn` |
154
+ | `lang` | `mn` \| `en` \| `ru` \| `zh` \| `fr` \| `es` \| `ar` (eID аппын хэлнүүд; `zh-CN` г.м. → үндсэн хэл; бусад → `mn`). `ar` → цонх `dir="rtl"` | `mn` |
155
155
  | `mode` | `auto` (утас → Web2App, бусад → QR цонх) \| `qr` \| `app` | `auto` |
156
156
  | `theme` | `auto` \| `light` \| `dark` | `auto` |
157
157
  | `success-url` (`successUrl`) | backend redirect өгөөгүй үед шилжих URL | — |
@@ -674,31 +674,6 @@ const p = await prepare(pdfBytes, { signerCert, verifyPage: true, fileName: "Г
674
674
  appearance: { page, x, y, width: s.width, height: s.height, exact: true } });
675
675
  ```
676
676
 
677
- **Гарын үсэг ба байгууллагын тамганы зураг (0.31.0+).** `appearance.signatureImage` (иргэний гарын үсгийн зураг) ба
678
- `appearance.stampImage` (байгууллагын тамга — зөвхөн `claimedRole`/onBehalfOf-той, эс бөгөөс `REQUEST_INVALID`) —
679
- `PdfImage { width, height, color: [r, g, b], alpha: "<base64 zlib>", sha256 }`, CA-ийн өгөх «PDF зураг» (PNG биш; SDK
680
- `alpha`-г байтаар нь /SMask болгон бичнэ, шахалт хийхгүй — бүх SDK байт-ижил). Зураг дүрслэлийн ДОТОР (дээд зурвас; тамга
681
- баруун дээд буланд хайрцгийг давж) зурагдана — тусдаа annotation биш тул өмнөх гарын үсэг «өөрчлөгдөөгүй» хэвээр.
682
- `width`, `height` хоёулаа 0 бол анхдагч хэмжээ: 220×64 / гарын үсэгтэй 220×110 / тамгатай 240×147.5 (`suggestPlacement`-д ч —
683
- ижил `appearance`-ийг өг). Зургийн оролт буруу (хэмжээ 1…1600 px, өнгө 0…255, alpha ≤ 300 KiB, нэг zlib stream яг
684
- `width·height` байт, `sha256` жижиг hex) бол `REQUEST_INVALID`. Зургийн sha256 `complete().images` →
685
- `registrationFromCompleted` → `images` болж CA-д очно. Дүрэм: `APPEARANCE_SPEC.md` §6, `PLACEMENT_SPEC.md` §6c.
686
-
687
- Зургийг RP backend-ээс (0.32.0+): `eid.person.signatureImage(personEtsi)` → `GET /person/etsi/{personEtsi}/signature-image`
688
- (**SIGN** эрх + иргэн сүүлийн 24 цагт нэвтэрсэн; зураг хадгалаагүй бол `null`, 403 → `ForbiddenError`) →
689
- `EidImage { png, sha256, width, height, updatedAt, pdfImage }`; тамга — `organization.getRepresentations()`-ийн
690
- `representations[].stampImage` (`stampImageSet` — бий эсэх; зураг зөвхөн SIGN эрхтэй RP-д). `pdfImage`-ийг хэвээр дамжуулна:
691
-
692
- ```ts
693
- // backend
694
- const sig = await eid.person.signatureImage(signerEtsi); // EidImage | null
695
- const rep = (await eid.organization.getRepresentations(signerEtsi)).representations.find((r) => r.orgEtsi === orgEtsi);
696
- const signatureImage = sig?.pdfImage, stampImage = rep?.stampImage?.pdfImage;
697
- // клиент (/pades)
698
- const p = await prepare(pdfBytes, { signerCert, claimedRole, verifyPage: true, fileName: "Гэрээ №12.pdf",
699
- appearance: { x: 340, y: 36, width: 0, height: 0, signatureImage, stampImage } }); // 240 × 147.5
700
- ```
701
-
702
677
  **Баталгаажуулах хуудсыг эхэнд (0.30.0+).** `verifyPagePosition: "first"` — QR хуудас баримтын 1-р хуудас болно (анхдагч
703
678
  `"last"` — төгсгөлд, өмнөхтэй байт-ижил; бусад утга `REQUEST_INVALID`). Хуудас нэмэгдэх үед л (гарын үсэггүй баримт,
704
679
  `verifyPage: true`) нөлөөтэй. `appearance.page`, `suggestPlacement`, `placement.page` үргэлж **оролтын** PDF-ийн хуудсаар
@@ -1154,8 +1129,8 @@ npm run test:convert-e2e # /convert жинхэнэ LibreOffice Chromium-д (BR
1154
1129
 
1155
1130
  `/pades`-ийн conformance fixture (golden: оролт, тестийн PKI-ийн гэрчилгээ, TSA/OCSP/CRL-ийн тогтмол хариу, хүлээгдэх
1156
1131
  sha256) ба фонт/гинжийн asset-ийг Go reference-ээс `node scripts/sync-pades-golden.mjs` хуулна (`GO_SDK_COMMIT` —
1157
- Go `pades-golden-v10` — зургийн кейсүүд `img-*`; v7-оос `placement/` scanner vectors-той, page 0 verify хуудас алгасна,
1158
- `exact` + `expect.suggestion`); CI `--check`-ээр бэхэлсэн commit-тэй тулгана. Профайл:
1132
+ tag `pades-golden-vN`, одоо v7 — `placement/` scanner vectors-той, page 0 verify хуудас алгасна, `exact` +
1133
+ `expect.suggestion`); CI `--check`-ээр бэхэлсэн commit-тэй тулгана. Профайл:
1159
1134
  Go репогийн `pades/PROFILE.md`, `PAGE_SPEC.md`, `PRECHECKS.md`, `WIRE.md`, `APPEARANCE_SPEC.md`, `PLACEMENT_SPEC.md`.
1160
1135
 
1161
1136
  ### Гэрээний шалгалт
@@ -1,3 +1,19 @@
1
+ import './errors-CgJcEjrZ.js';
2
+
3
+ /** isMobileUserAgent-ийн уншдаг navigator-ийн хэсэг (тестэд орлуулна). */
4
+ interface NavigatorLike {
5
+ userAgent?: string;
6
+ maxTouchPoints?: number;
7
+ userAgentData?: {
8
+ mobile?: boolean;
9
+ };
10
+ }
11
+ /**
12
+ * Анхдагч гар утас/таблет илрүүлэгч: Android, iPhone/iPod/iPad, UA-CH `mobile`, мөн desktop UA
13
+ * илгээдэг iPadOS (Macintosh + мэдрэгч дэлгэц, maxTouchPoints > 1).
14
+ */
15
+ declare function isMobileUserAgent(nav?: NavigatorLike): boolean;
16
+
1
17
  /** Сертификатын баталгаажуулалтын түвшин (eIDAS LoA). QUALIFIED — хууль ёсны гарын үсэгт. */
2
18
  type CertificateLevel = "ADVANCED" | "QUALIFIED" | "QSCD";
3
19
  /** Гарын үсгийн протокол: auth → ACSP_V2, sign → RAW_DIGEST_SIGNATURE (Smart-ID v3). */
@@ -268,55 +284,6 @@ interface Representation {
268
284
  validFrom: string;
269
285
  /** ISO 8601; байхгүй = хугацаагүй. */
270
286
  validTo?: string;
271
- /** Байгууллагад тамганы зураг хадгалсан эсэх (хуучин CA-д байхгүй). */
272
- stampImageSet?: boolean;
273
- /**
274
- * Тамганы зураг — зөвхөн SIGN эрхтэй RP-д, зураг байвал. PDF-д: `appearance.stampImage = stampImage.pdfImage`
275
- * (`claimedRole`-той).
276
- */
277
- stampImage?: EidImage;
278
- }
279
- /**
280
- * CA-ийн хадгалсан ил тод PNG — иргэний гарын үсгийн зураг (`person.signatureImage()`) эсвэл байгууллагын тамга
281
- * (`Representation.stampImage`); CA docs/SIGNATURE_IMAGES.md.
282
- */
283
- interface EidImage {
284
- /** base64 ил тод PNG. */
285
- png: string;
286
- /** PNG-ийн sha256, жижиг hex. */
287
- sha256: string;
288
- width: number;
289
- height: number;
290
- /** RFC 3339 (UTC). */
291
- updatedAt?: string;
292
- /**
293
- * Харагдах гарын үсэгт шигтгэх «PDF зураг» — `appearance.signatureImage` / `stampImage`-д хэвээр өгнө; CA PNG-ийг
294
- * хөрвүүлж чадаагүй (олон өнгө, alpha > 300 KiB) бол байхгүй.
295
- */
296
- pdfImage?: PdfImage;
297
- }
298
- /**
299
- * A "PDF image" as the CA serves it (Go `pades.PDFImage`, APPEARANCE_SPEC.md §6.1): one ink colour + an 8-bit alpha
300
- * channel. The SDK writes `alpha` into the PDF verbatim (/SMask, /FlateDecode) — nothing is compressed at runtime, so
301
- * every SDK writes the same bytes. Not a PNG.
302
- */
303
- interface PdfImage {
304
- /** px, 1…1600. */
305
- width: number;
306
- /** px, 1…1600. */
307
- height: number;
308
- /** Ink colour `[r, g, b]`, 0…255. */
309
- color: [number, number, number];
310
- /**
311
- * Standard base64 of a zlib stream (RFC 1950, no preset dictionary, nothing after the Adler-32) inflating to exactly
312
- * `width·height` bytes, rows top-down, no PNG filter bytes; ≤ 300 KiB decoded.
313
- */
314
- alpha: string;
315
- /**
316
- * Lowercase hex SHA-256 of the PNG the CA stores; not written into the PDF — carried to the registration
317
- * (`PadesCompleted.images` → `registrationFromCompleted` → `images`).
318
- */
319
- sha256: string;
320
287
  }
321
288
  /** GET /organization/representations/etsi/{personEtsi} хариу. */
322
289
  interface RepresentationsResponse {
@@ -352,4 +319,4 @@ interface RpCredentials {
352
319
  apiSecret: string;
353
320
  }
354
321
 
355
- export { type AcspContext as A, type CertificateLevel as C, type DeviceLinkSession as D, type EidImage as E, type FlowType as F, type HashAlgorithm as H, type Interaction as I, type NotificationSession as N, type OrgResult as O, type PdfImage as P, type RpCredentials as R, type SignatureAlgorithm as S, type TokenCertSessionBlock as T, type SessionResult as a, type PersonBlock as b, type RepresentationsResponse as c, DEFAULT_SIGN_SESSION_TTL_MS as d, type EndResult as e, type Representation as f, type SessionPresentation as g, type SessionState as h, type SignContext as i, type SignatureAlgorithmParameters as j, type SignatureProtocol as k, type TokenCertStatus as l, startExpiry as m, parseExpiresAt as p, sessionExpiry as s };
322
+ export { type AcspContext as A, type CertificateLevel as C, type DeviceLinkSession as D, type EndResult as E, type FlowType as F, type HashAlgorithm as H, type Interaction as I, type NotificationSession as N, type OrgResult as O, type PersonBlock as P, type RpCredentials as R, type SignatureAlgorithm as S, type TokenCertSessionBlock as T, type SessionResult as a, type RepresentationsResponse as b, DEFAULT_SIGN_SESSION_TTL_MS as c, type NavigatorLike as d, type Representation as e, type SessionPresentation as f, type SessionState as g, type SignContext as h, type SignatureAlgorithmParameters as i, type SignatureProtocol as j, type TokenCertStatus as k, isMobileUserAgent as l, startExpiry as m, parseExpiresAt as p, sessionExpiry as s };
@@ -1,3 +1,19 @@
1
+ import './errors-CgJcEjrZ.cjs';
2
+
3
+ /** isMobileUserAgent-ийн уншдаг navigator-ийн хэсэг (тестэд орлуулна). */
4
+ interface NavigatorLike {
5
+ userAgent?: string;
6
+ maxTouchPoints?: number;
7
+ userAgentData?: {
8
+ mobile?: boolean;
9
+ };
10
+ }
11
+ /**
12
+ * Анхдагч гар утас/таблет илрүүлэгч: Android, iPhone/iPod/iPad, UA-CH `mobile`, мөн desktop UA
13
+ * илгээдэг iPadOS (Macintosh + мэдрэгч дэлгэц, maxTouchPoints > 1).
14
+ */
15
+ declare function isMobileUserAgent(nav?: NavigatorLike): boolean;
16
+
1
17
  /** Сертификатын баталгаажуулалтын түвшин (eIDAS LoA). QUALIFIED — хууль ёсны гарын үсэгт. */
2
18
  type CertificateLevel = "ADVANCED" | "QUALIFIED" | "QSCD";
3
19
  /** Гарын үсгийн протокол: auth → ACSP_V2, sign → RAW_DIGEST_SIGNATURE (Smart-ID v3). */
@@ -268,55 +284,6 @@ interface Representation {
268
284
  validFrom: string;
269
285
  /** ISO 8601; байхгүй = хугацаагүй. */
270
286
  validTo?: string;
271
- /** Байгууллагад тамганы зураг хадгалсан эсэх (хуучин CA-д байхгүй). */
272
- stampImageSet?: boolean;
273
- /**
274
- * Тамганы зураг — зөвхөн SIGN эрхтэй RP-д, зураг байвал. PDF-д: `appearance.stampImage = stampImage.pdfImage`
275
- * (`claimedRole`-той).
276
- */
277
- stampImage?: EidImage;
278
- }
279
- /**
280
- * CA-ийн хадгалсан ил тод PNG — иргэний гарын үсгийн зураг (`person.signatureImage()`) эсвэл байгууллагын тамга
281
- * (`Representation.stampImage`); CA docs/SIGNATURE_IMAGES.md.
282
- */
283
- interface EidImage {
284
- /** base64 ил тод PNG. */
285
- png: string;
286
- /** PNG-ийн sha256, жижиг hex. */
287
- sha256: string;
288
- width: number;
289
- height: number;
290
- /** RFC 3339 (UTC). */
291
- updatedAt?: string;
292
- /**
293
- * Харагдах гарын үсэгт шигтгэх «PDF зураг» — `appearance.signatureImage` / `stampImage`-д хэвээр өгнө; CA PNG-ийг
294
- * хөрвүүлж чадаагүй (олон өнгө, alpha > 300 KiB) бол байхгүй.
295
- */
296
- pdfImage?: PdfImage;
297
- }
298
- /**
299
- * A "PDF image" as the CA serves it (Go `pades.PDFImage`, APPEARANCE_SPEC.md §6.1): one ink colour + an 8-bit alpha
300
- * channel. The SDK writes `alpha` into the PDF verbatim (/SMask, /FlateDecode) — nothing is compressed at runtime, so
301
- * every SDK writes the same bytes. Not a PNG.
302
- */
303
- interface PdfImage {
304
- /** px, 1…1600. */
305
- width: number;
306
- /** px, 1…1600. */
307
- height: number;
308
- /** Ink colour `[r, g, b]`, 0…255. */
309
- color: [number, number, number];
310
- /**
311
- * Standard base64 of a zlib stream (RFC 1950, no preset dictionary, nothing after the Adler-32) inflating to exactly
312
- * `width·height` bytes, rows top-down, no PNG filter bytes; ≤ 300 KiB decoded.
313
- */
314
- alpha: string;
315
- /**
316
- * Lowercase hex SHA-256 of the PNG the CA stores; not written into the PDF — carried to the registration
317
- * (`PadesCompleted.images` → `registrationFromCompleted` → `images`).
318
- */
319
- sha256: string;
320
287
  }
321
288
  /** GET /organization/representations/etsi/{personEtsi} хариу. */
322
289
  interface RepresentationsResponse {
@@ -352,4 +319,4 @@ interface RpCredentials {
352
319
  apiSecret: string;
353
320
  }
354
321
 
355
- export { type AcspContext as A, type CertificateLevel as C, type DeviceLinkSession as D, type EidImage as E, type FlowType as F, type HashAlgorithm as H, type Interaction as I, type NotificationSession as N, type OrgResult as O, type PdfImage as P, type RpCredentials as R, type SignatureAlgorithm as S, type TokenCertSessionBlock as T, type SessionResult as a, type PersonBlock as b, type RepresentationsResponse as c, DEFAULT_SIGN_SESSION_TTL_MS as d, type EndResult as e, type Representation as f, type SessionPresentation as g, type SessionState as h, type SignContext as i, type SignatureAlgorithmParameters as j, type SignatureProtocol as k, type TokenCertStatus as l, startExpiry as m, parseExpiresAt as p, sessionExpiry as s };
322
+ export { type AcspContext as A, type CertificateLevel as C, type DeviceLinkSession as D, type EndResult as E, type FlowType as F, type HashAlgorithm as H, type Interaction as I, type NotificationSession as N, type OrgResult as O, type PersonBlock as P, type RpCredentials as R, type SignatureAlgorithm as S, type TokenCertSessionBlock as T, type SessionResult as a, type RepresentationsResponse as b, DEFAULT_SIGN_SESSION_TTL_MS as c, type NavigatorLike as d, type Representation as e, type SessionPresentation as f, type SessionState as g, type SignContext as h, type SignatureAlgorithmParameters as i, type SignatureProtocol as j, type TokenCertStatus as k, isMobileUserAgent as l, startExpiry as m, parseExpiresAt as p, sessionExpiry as s };
@@ -1,18 +1,2 @@
1
- export { D as DeviceLinkError, E as EidError } from './errors-mcDbKiz_.cjs';
2
- export { D as DeviceLinkSession } from './types-Cf3GT4wh.cjs';
3
-
4
- /** isMobileUserAgent-ийн уншдаг navigator-ийн хэсэг (тестэд орлуулна). */
5
- interface NavigatorLike {
6
- userAgent?: string;
7
- maxTouchPoints?: number;
8
- userAgentData?: {
9
- mobile?: boolean;
10
- };
11
- }
12
- /**
13
- * Анхдагч гар утас/таблет илрүүлэгч: Android, iPhone/iPod/iPad, UA-CH `mobile`, мөн desktop UA
14
- * илгээдэг iPadOS (Macintosh + мэдрэгч дэлгэц, maxTouchPoints > 1).
15
- */
16
- declare function isMobileUserAgent(nav?: NavigatorLike): boolean;
17
-
18
- export { type NavigatorLike, isMobileUserAgent };
1
+ export { D as DeviceLinkSession, d as NavigatorLike, l as isMobileUserAgent } from './browser-w1Ca6FdZ.cjs';
2
+ export { D as DeviceLinkError, E as EidError } from './errors-CgJcEjrZ.cjs';
package/dist/browser.d.ts CHANGED
@@ -1,18 +1,2 @@
1
- export { D as DeviceLinkError, E as EidError } from './errors-mcDbKiz_.js';
2
- export { D as DeviceLinkSession } from './types-Cf3GT4wh.js';
3
-
4
- /** isMobileUserAgent-ийн уншдаг navigator-ийн хэсэг (тестэд орлуулна). */
5
- interface NavigatorLike {
6
- userAgent?: string;
7
- maxTouchPoints?: number;
8
- userAgentData?: {
9
- mobile?: boolean;
10
- };
11
- }
12
- /**
13
- * Анхдагч гар утас/таблет илрүүлэгч: Android, iPhone/iPod/iPad, UA-CH `mobile`, мөн desktop UA
14
- * илгээдэг iPadOS (Macintosh + мэдрэгч дэлгэц, maxTouchPoints > 1).
15
- */
16
- declare function isMobileUserAgent(nav?: NavigatorLike): boolean;
17
-
18
- export { type NavigatorLike, isMobileUserAgent };
1
+ export { D as DeviceLinkSession, d as NavigatorLike, l as isMobileUserAgent } from './browser-CCP--VGv.js';
2
+ export { D as DeviceLinkError, E as EidError } from './errors-CgJcEjrZ.js';
package/dist/browser.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  DeviceLinkError,
6
6
  EidError
7
- } from "./chunk-TNXO4QLU.js";
7
+ } from "./chunk-PWFTN52X.js";
8
8
  export {
9
9
  DeviceLinkError,
10
10
  EidError,