@gerege-systems/eid-mongolia-sdk 0.15.4 → 0.17.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 +96 -21
- package/bin/convert-assets.mjs +79 -0
- package/bin/eid-convert.worker.js +18 -0
- package/dist/{browser-BZ3hvv6-.d.ts → browser-BPhROZkH.d.ts} +20 -49
- package/dist/{browser-8k_VDSP8.d.cts → browser-DFnRVCfN.d.cts} +20 -49
- package/dist/browser.cjs +11 -47
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +4 -8
- package/dist/chunk-WOWGH65C.js +13 -0
- package/dist/{chunk-TB2KQH3W.js → chunk-Y3JYLJPG.js} +1 -5
- package/dist/convert.d.ts +113 -0
- package/dist/convert.js +1638 -0
- package/dist/{errors-Z7SgLVTr.d.cts → errors-pK1L0s4N.d.cts} +9 -9
- package/dist/{errors-Z7SgLVTr.d.ts → errors-pK1L0s4N.d.ts} +9 -9
- package/dist/index.cjs +13 -53
- package/dist/index.d.cts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +15 -19
- package/dist/pades.cjs +343 -46
- package/dist/pades.d.cts +19 -2
- package/dist/pades.d.ts +19 -2
- package/dist/pades.js +344 -47
- package/package.json +23 -4
- package/dist/chunk-REWNE7PO.js +0 -51
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gerege-systems/eid-mongolia-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "e-ID Mongolia Relying Party SDK — иргэнээр утсаар нь нэвтрэлт ба хууль ёсны цахим гарын үсэг (RP-API v3, Smart-ID нийцтэй).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,10 +27,15 @@
|
|
|
27
27
|
"types": "./dist/button.d.ts",
|
|
28
28
|
"import": "./dist/button.js",
|
|
29
29
|
"require": "./dist/button.cjs"
|
|
30
|
+
},
|
|
31
|
+
"./convert": {
|
|
32
|
+
"types": "./dist/convert.d.ts",
|
|
33
|
+
"import": "./dist/convert.js"
|
|
30
34
|
}
|
|
31
35
|
},
|
|
32
36
|
"files": [
|
|
33
37
|
"dist",
|
|
38
|
+
"bin",
|
|
34
39
|
"README.md",
|
|
35
40
|
"LICENSE"
|
|
36
41
|
],
|
|
@@ -38,13 +43,14 @@
|
|
|
38
43
|
"node": ">=18"
|
|
39
44
|
},
|
|
40
45
|
"scripts": {
|
|
41
|
-
"build": "tsup src/index.ts src/browser.ts src/pades.ts --format esm,cjs --dts --clean && tsup src/button.ts --format esm,cjs --dts --tsconfig tsconfig.button.json",
|
|
42
|
-
"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-unit.test.ts",
|
|
46
|
+
"build": "tsup src/index.ts src/browser.ts src/pades.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",
|
|
47
|
+
"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-unit.test.ts test/convert.test.ts",
|
|
43
48
|
"test:contract": "npm run build && node --experimental-strip-types test/contract.test.ts",
|
|
44
49
|
"lint": "tsc --noEmit && tsc --noEmit -p tsconfig.button.json",
|
|
45
50
|
"golden:check": "node scripts/sync-pades-golden.mjs --check",
|
|
46
51
|
"size:pades": "node scripts/pades-bundle-size.mjs",
|
|
47
|
-
"test:compat": "node scripts/test-compat.mjs"
|
|
52
|
+
"test:compat": "node scripts/test-compat.mjs",
|
|
53
|
+
"test:convert-e2e": "npm run build && node scripts/convert-e2e.mjs"
|
|
48
54
|
},
|
|
49
55
|
"keywords": [
|
|
50
56
|
"eid",
|
|
@@ -59,11 +65,21 @@
|
|
|
59
65
|
"pades",
|
|
60
66
|
"pdf-signing"
|
|
61
67
|
],
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"@matbee/libreoffice-converter": "2.7.2"
|
|
70
|
+
},
|
|
71
|
+
"peerDependenciesMeta": {
|
|
72
|
+
"@matbee/libreoffice-converter": {
|
|
73
|
+
"optional": true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
62
76
|
"devDependencies": {
|
|
77
|
+
"@matbee/libreoffice-converter": "2.7.2",
|
|
63
78
|
"@types/jsdom": "^21.1.7",
|
|
64
79
|
"@types/node": "^20.0.0",
|
|
65
80
|
"jsdom": "^26.1.0",
|
|
66
81
|
"jsqr": "^1.4.0",
|
|
82
|
+
"playwright": "1.63.0",
|
|
67
83
|
"tsup": "^8.0.0",
|
|
68
84
|
"typescript": "^5.4.0"
|
|
69
85
|
},
|
|
@@ -78,5 +94,8 @@
|
|
|
78
94
|
"publishConfig": {
|
|
79
95
|
"access": "public",
|
|
80
96
|
"provenance": true
|
|
97
|
+
},
|
|
98
|
+
"bin": {
|
|
99
|
+
"eid-mongolia-convert-assets": "./bin/convert-assets.mjs"
|
|
81
100
|
}
|
|
82
101
|
}
|
package/dist/chunk-REWNE7PO.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DeviceLinkError
|
|
3
|
-
} from "./chunk-TB2KQH3W.js";
|
|
4
|
-
|
|
5
|
-
// src/devicelink.ts
|
|
6
|
-
var SESSION_ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
7
|
-
var VC_RE = /^[0-9]{5}$/;
|
|
8
|
-
function deviceLink(session) {
|
|
9
|
-
const base = session.deviceLinkBase?.trim();
|
|
10
|
-
if (!base) throw new DeviceLinkError("deviceLink: \u0445\u0430\u0440\u0438\u0443\u043D\u0434 deviceLinkBase \u0431\u0430\u0439\u0445\u0433\u04AF\u0439 \u2014 device-link session \u044D\u0441\u044D\u0445\u0438\u0439\u0433 \u0448\u0430\u043B\u0433\u0430");
|
|
11
|
-
let u;
|
|
12
|
-
try {
|
|
13
|
-
u = new URL(base);
|
|
14
|
-
} catch {
|
|
15
|
-
throw new DeviceLinkError(`deviceLink: deviceLinkBase \u0431\u0443\u0440\u0443\u0443 URL: ${base}`);
|
|
16
|
-
}
|
|
17
|
-
if (u.protocol !== "https:" && u.protocol !== "http:") {
|
|
18
|
-
throw new DeviceLinkError(`deviceLink: deviceLinkBase https URL \u0431\u0430\u0439\u0445 \u0451\u0441\u0442\u043E\u0439: ${u.protocol}`);
|
|
19
|
-
}
|
|
20
|
-
if (!SESSION_ID_RE.test(session.sessionId)) throw new DeviceLinkError("deviceLink: sessionId UUID (lowercase) \u0431\u0438\u0448");
|
|
21
|
-
if (session.vc == null || !VC_RE.test(session.vc)) throw new DeviceLinkError("deviceLink: vc 5 \u043E\u0440\u043E\u043D\u0442\u043E\u0439 \u0442\u043E\u043E \u0431\u0438\u0448");
|
|
22
|
-
u.searchParams.set("sessionId", session.sessionId);
|
|
23
|
-
u.searchParams.set("vc", session.vc);
|
|
24
|
-
return u.toString();
|
|
25
|
-
}
|
|
26
|
-
function isMobileUserAgent(nav) {
|
|
27
|
-
const n = nav ?? globalThis.navigator;
|
|
28
|
-
if (!n) return false;
|
|
29
|
-
if (n.userAgentData?.mobile === true) return true;
|
|
30
|
-
const ua = n.userAgent ?? "";
|
|
31
|
-
if (/Android|iPhone|iPod|iPad/i.test(ua)) return true;
|
|
32
|
-
return /Macintosh/.test(ua) && (n.maxTouchPoints ?? 0) > 1;
|
|
33
|
-
}
|
|
34
|
-
function openOrShowQR(session, opts) {
|
|
35
|
-
const link = deviceLink(session);
|
|
36
|
-
const mobile = typeof opts.isMobile === "function" ? opts.isMobile() : opts.isMobile ?? isMobileUserAgent();
|
|
37
|
-
if (mobile) {
|
|
38
|
-
const loc = globalThis.location;
|
|
39
|
-
if (!loc) throw new DeviceLinkError("openOrShowQR: location \u0431\u0430\u0439\u0445\u0433\u04AF\u0439 \u2014 \u0437\u04E9\u0432\u0445\u04E9\u043D \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0442");
|
|
40
|
-
loc.assign(link);
|
|
41
|
-
return "opened";
|
|
42
|
-
}
|
|
43
|
-
opts.showQR(link);
|
|
44
|
-
return "qr";
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export {
|
|
48
|
-
deviceLink,
|
|
49
|
-
isMobileUserAgent,
|
|
50
|
-
openOrShowQR
|
|
51
|
-
};
|