@gerege-systems/eid-mongolia-sdk 0.46.0 → 0.47.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 +73 -3
- package/dist/{browser-CSP4_HJj.d.ts → browser-5yPFDx6a.d.ts} +39 -2
- package/dist/{browser-Dn-mhGl0.d.cts → browser-C-n2Wa5u.d.cts} +39 -2
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +1 -1
- package/dist/{chunk-4JAA4RON.js → chunk-6H6KBQV4.js} +1 -1
- package/dist/{chunk-ISTWNY6N.js → chunk-BTT7P7GB.js} +26 -20
- package/dist/{chunk-6AGWRTZG.js → chunk-J4BEQDT3.js} +58 -0
- package/dist/{errors-yzUBuWFg.d.cts → errors-BekL912E.d.cts} +57 -1
- package/dist/{errors-yzUBuWFg.d.ts → errors-BekL912E.d.ts} +57 -1
- package/dist/index.cjs +168 -1
- package/dist/index.d.cts +59 -5
- package/dist/index.d.ts +59 -5
- package/dist/index.js +122 -3
- package/dist/pades.cjs +26 -20
- package/dist/pades.d.cts +1 -1
- package/dist/pades.d.ts +1 -1
- package/dist/pades.js +3 -3
- package/dist/validate.d.cts +1 -1
- package/dist/validate.d.ts +1 -1
- package/dist/validate.js +3 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -24,6 +24,11 @@ __export(index_exports, {
|
|
|
24
24
|
ApiError: () => ApiError,
|
|
25
25
|
AppTransactionTooLargeError: () => AppTransactionTooLargeError,
|
|
26
26
|
AuthApi: () => AuthApi,
|
|
27
|
+
AuthSessionAlreadyUsedError: () => AuthSessionAlreadyUsedError,
|
|
28
|
+
AuthSessionNotCompletedError: () => AuthSessionNotCompletedError,
|
|
29
|
+
AuthSessionNotFoundError: () => AuthSessionNotFoundError,
|
|
30
|
+
AuthSessionTooOldError: () => AuthSessionTooOldError,
|
|
31
|
+
AuthSessionWrongFlowError: () => AuthSessionWrongFlowError,
|
|
27
32
|
AuthenticationError: () => AuthenticationError,
|
|
28
33
|
CITIZEN_INTERMEDIATES_PEM: () => CITIZEN_INTERMEDIATES_PEM,
|
|
29
34
|
CITIZEN_ISSUING_CA_SKI: () => CITIZEN_ISSUING_CA_SKI,
|
|
@@ -68,7 +73,11 @@ __export(index_exports, {
|
|
|
68
73
|
RequestInvalidError: () => RequestInvalidError,
|
|
69
74
|
ResponseTooLargeError: () => ResponseTooLargeError,
|
|
70
75
|
ResponseValidator: () => ResponseValidator,
|
|
76
|
+
RpNotActiveError: () => RpNotActiveError,
|
|
77
|
+
RpPermissionsFullError: () => RpPermissionsFullError,
|
|
71
78
|
SEAL_ERROR_CODES: () => SEAL_ERROR_CODES,
|
|
79
|
+
SEAL_GRANT_ERROR_CODES: () => SEAL_GRANT_ERROR_CODES,
|
|
80
|
+
SEAL_GRANT_REQUEST_FIELDS: () => SEAL_GRANT_REQUEST_FIELDS,
|
|
72
81
|
SEAL_REQUEST_FIELDS: () => SEAL_REQUEST_FIELDS,
|
|
73
82
|
SHARE_ERROR_CODES: () => SHARE_ERROR_CODES,
|
|
74
83
|
SHARE_FORM_FIELDS: () => SHARE_FORM_FIELDS,
|
|
@@ -78,6 +87,9 @@ __export(index_exports, {
|
|
|
78
87
|
SealCertNotYetValidError: () => SealCertNotYetValidError,
|
|
79
88
|
SealCertRevokedError: () => SealCertRevokedError,
|
|
80
89
|
SealCertificateRequestError: () => SealCertificateRequestError,
|
|
90
|
+
SealGrantAlreadyApprovedError: () => SealGrantAlreadyApprovedError,
|
|
91
|
+
SealGrantNotFoundError: () => SealGrantNotFoundError,
|
|
92
|
+
SealGrantRequestError: () => SealGrantRequestError,
|
|
81
93
|
SealKeyUnavailableError: () => SealKeyUnavailableError,
|
|
82
94
|
SealNotIssuedError: () => SealNotIssuedError,
|
|
83
95
|
SealRequestNotFoundError: () => SealRequestNotFoundError,
|
|
@@ -207,6 +219,24 @@ var SealApproverUnavailableError = class extends ApiError {
|
|
|
207
219
|
};
|
|
208
220
|
var SealRequestNotFoundError = class extends ApiError {
|
|
209
221
|
};
|
|
222
|
+
var AuthSessionWrongFlowError = class extends ApiError {
|
|
223
|
+
};
|
|
224
|
+
var AuthSessionNotCompletedError = class extends ApiError {
|
|
225
|
+
};
|
|
226
|
+
var AuthSessionTooOldError = class extends ApiError {
|
|
227
|
+
};
|
|
228
|
+
var AuthSessionAlreadyUsedError = class extends ApiError {
|
|
229
|
+
};
|
|
230
|
+
var AuthSessionNotFoundError = class extends ApiError {
|
|
231
|
+
};
|
|
232
|
+
var SealGrantAlreadyApprovedError = class extends ApiError {
|
|
233
|
+
};
|
|
234
|
+
var SealGrantNotFoundError = class extends ApiError {
|
|
235
|
+
};
|
|
236
|
+
var RpNotActiveError = class extends ApiError {
|
|
237
|
+
};
|
|
238
|
+
var RpPermissionsFullError = class extends ApiError {
|
|
239
|
+
};
|
|
210
240
|
var OrgNotActiveError = class extends ApiError {
|
|
211
241
|
};
|
|
212
242
|
var SealNotIssuedError = class extends ApiError {
|
|
@@ -230,6 +260,24 @@ var SEAL_ERROR_CODES = [
|
|
|
230
260
|
"SEAL_REQUEST_NOT_FOUND",
|
|
231
261
|
"SEAL_SERVICE_DISABLED"
|
|
232
262
|
];
|
|
263
|
+
var SEAL_GRANT_ERROR_CODES = [
|
|
264
|
+
"REQUEST_INVALID",
|
|
265
|
+
"RP_NOT_REGISTERED",
|
|
266
|
+
"NOT_ORG_CEO",
|
|
267
|
+
"AUTH_SESSION_NOT_FOUND",
|
|
268
|
+
"ORG_NOT_FOUND",
|
|
269
|
+
"SEAL_GRANT_NOT_FOUND",
|
|
270
|
+
"AUTH_SESSION_WRONG_FLOW",
|
|
271
|
+
"AUTH_SESSION_NOT_COMPLETED",
|
|
272
|
+
"AUTH_SESSION_TOO_OLD",
|
|
273
|
+
"AUTH_SESSION_ALREADY_USED",
|
|
274
|
+
"ORG_NOT_ACTIVE",
|
|
275
|
+
"RP_NOT_ACTIVE",
|
|
276
|
+
"SEAL_GRANT_ALREADY_APPROVED",
|
|
277
|
+
"RP_PERMISSIONS_FULL",
|
|
278
|
+
"SEAL_APPROVER_UNAVAILABLE",
|
|
279
|
+
"RATE_LIMITED"
|
|
280
|
+
];
|
|
233
281
|
var SealServiceDisabledError = class extends ApiError {
|
|
234
282
|
/** Хариуны биеийн `service`; байхгүй / танигдаагүй утга бол undefined. */
|
|
235
283
|
service;
|
|
@@ -262,6 +310,17 @@ var SealCertificateRequestError = class extends EidError {
|
|
|
262
310
|
requestId;
|
|
263
311
|
failure;
|
|
264
312
|
};
|
|
313
|
+
var SealGrantRequestError = class extends EidError {
|
|
314
|
+
constructor(outcome, grantId, failure) {
|
|
315
|
+
super(`\u0442\u0430\u043C\u0433\u0430\u043D\u044B \u044D\u0440\u0445\u0438\u0439\u043D \u0445\u04AF\u0441\u044D\u043B\u0442 ${outcome}${failure ? ` (${failure})` : ""}`);
|
|
316
|
+
this.outcome = outcome;
|
|
317
|
+
this.grantId = grantId;
|
|
318
|
+
this.failure = failure;
|
|
319
|
+
}
|
|
320
|
+
outcome;
|
|
321
|
+
grantId;
|
|
322
|
+
failure;
|
|
323
|
+
};
|
|
265
324
|
var RETRYABLE_ERROR_CODES = [
|
|
266
325
|
"RATE_LIMITED",
|
|
267
326
|
"STATE_UNAVAILABLE",
|
|
@@ -359,7 +418,16 @@ var TYPED_API_ERRORS = /* @__PURE__ */ new Map([
|
|
|
359
418
|
["SEAL_CERT_NOT_YET_VALID", SealCertNotYetValidError],
|
|
360
419
|
["SEAL_APPROVER_UNAVAILABLE", SealApproverUnavailableError],
|
|
361
420
|
["SEAL_REQUEST_NOT_FOUND", SealRequestNotFoundError],
|
|
362
|
-
["SEAL_SERVICE_DISABLED", SealServiceDisabledError]
|
|
421
|
+
["SEAL_SERVICE_DISABLED", SealServiceDisabledError],
|
|
422
|
+
["AUTH_SESSION_WRONG_FLOW", AuthSessionWrongFlowError],
|
|
423
|
+
["AUTH_SESSION_NOT_COMPLETED", AuthSessionNotCompletedError],
|
|
424
|
+
["AUTH_SESSION_TOO_OLD", AuthSessionTooOldError],
|
|
425
|
+
["AUTH_SESSION_ALREADY_USED", AuthSessionAlreadyUsedError],
|
|
426
|
+
["AUTH_SESSION_NOT_FOUND", AuthSessionNotFoundError],
|
|
427
|
+
["SEAL_GRANT_ALREADY_APPROVED", SealGrantAlreadyApprovedError],
|
|
428
|
+
["SEAL_GRANT_NOT_FOUND", SealGrantNotFoundError],
|
|
429
|
+
["RP_NOT_ACTIVE", RpNotActiveError],
|
|
430
|
+
["RP_PERMISSIONS_FULL", RpPermissionsFullError]
|
|
363
431
|
]);
|
|
364
432
|
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
365
433
|
var MAX_JSON_BYTES = 4 << 20;
|
|
@@ -490,6 +558,8 @@ var RP_ROUTES = {
|
|
|
490
558
|
certChoiceDeviceLink: { method: "POST", path: "/signature/certificate-choice/device-link/anonymous" },
|
|
491
559
|
certChoiceEtsi: { method: "POST", path: "/signature/certificate-choice/notification/etsi/{semanticsIdentifier}" },
|
|
492
560
|
orgRepresentations: { method: "GET", path: "/organization/representations/etsi/{personEtsi}" },
|
|
561
|
+
/** Иргэн улсын бүртгэлээр Гүйцэтгэх захирал байгаа байгууллага бүрийн RP тамганы эрхүүд (PKI_READ; CA V156). */
|
|
562
|
+
orgSealGrants: { method: "GET", path: "/organization/seal-grants/etsi/{personEtsi}" },
|
|
493
563
|
session: { method: "GET", path: "/session/{sessionId}" },
|
|
494
564
|
personCertificates: { method: "GET", path: "/certificates/etsi/{personEtsi}" },
|
|
495
565
|
personDevices: { method: "GET", path: "/devices/etsi/{personEtsi}" },
|
|
@@ -510,6 +580,10 @@ var RP_ROUTES = {
|
|
|
510
580
|
sealCertificateRequest: { method: "POST", path: "/seal/certificate/{orgEtsi}" },
|
|
511
581
|
/** Тамганы гэрчилгээний хүсэлтийн төлөв (CA !483, ORG_ONBOARDING §4.3) — ISSUED үед `certificate`-тэй. */
|
|
512
582
|
sealCertificateRequestStatus: { method: "GET", path: "/seal/certificate/{orgEtsi}/requests/{requestId}" },
|
|
583
|
+
/** RP-ийн санаачилсан тамганы эрхийн хүсэлт (CA V156): `{orgEtsi, sessionId}` → 202 `{grantId, orgEtsi, status, expiresAt}`. */
|
|
584
|
+
sealGrantRequest: { method: "POST", path: "/seal/grants" },
|
|
585
|
+
/** Тамганы эрхийн хүсэлтийн төлөв (зөвхөн хүсэлтийн эзэн RP). */
|
|
586
|
+
sealGrantStatus: { method: "GET", path: "/seal/grants/{grantId}" },
|
|
513
587
|
/** Байгууллагын тамга (CA `dto.SealRequest` `{digest, hashType}` → `dto.SealResponse`). */
|
|
514
588
|
seal: { method: "POST", path: "/seal/{orgEtsi}" }
|
|
515
589
|
};
|
|
@@ -530,6 +604,7 @@ var PDF_SIGNATURE_REGISTER_FIELDS = [
|
|
|
530
604
|
"signerEtsi"
|
|
531
605
|
];
|
|
532
606
|
var SEAL_REQUEST_FIELDS = ["digest", "hashType"];
|
|
607
|
+
var SEAL_GRANT_REQUEST_FIELDS = ["orgEtsi", "sessionId"];
|
|
533
608
|
var SHARE_FORM_FIELDS = ["file", "filename", "to", "subject", "message", "lang"];
|
|
534
609
|
function routePath(route, ...args) {
|
|
535
610
|
let i = 0;
|
|
@@ -1252,6 +1327,17 @@ var OrganizationApi = class {
|
|
|
1252
1327
|
const list = Array.isArray(raw.representations) ? raw.representations : [];
|
|
1253
1328
|
return { personEtsi: String(raw.personEtsi ?? personEtsi), representations: list, raw };
|
|
1254
1329
|
}
|
|
1330
|
+
/**
|
|
1331
|
+
* GET /organization/seal-grants/etsi/{personEtsi} — иргэн улсын бүртгэлээр баталгаажсан Гүйцэтгэх захирал байгаа байгууллага
|
|
1332
|
+
* бүр ба түүний APPROVED / PENDING RP тамганы эрхүүд (захирлын «миний байгууллагын тамгыг хэн ашиглаж байна» харагдац).
|
|
1333
|
+
* PKI_READ эрх шаардана; иргэн сүүлийн 24 цагт танай RP-ээр нэвтэрсэн байх ёстой (үгүй бол 403). Энгийн RP зөвхөн өөрийн
|
|
1334
|
+
* эрхийг харна. Зөвхөн унших — эрх цуцлах нь eID аппаас.
|
|
1335
|
+
*/
|
|
1336
|
+
async sealGrants(personEtsi) {
|
|
1337
|
+
const raw = await this.http.get(routePath(RP_ROUTES.orgSealGrants, personEtsi));
|
|
1338
|
+
const list = Array.isArray(raw.organizations) ? raw.organizations : [];
|
|
1339
|
+
return { personEtsi: String(raw.personEtsi ?? personEtsi), organizations: list.map((o) => ({ ...o, grants: Array.isArray(o.grants) ? o.grants : [] })), raw };
|
|
1340
|
+
}
|
|
1255
1341
|
};
|
|
1256
1342
|
|
|
1257
1343
|
// src/seal.ts
|
|
@@ -2136,6 +2222,22 @@ function parseSealRequest(raw, orgEtsi) {
|
|
|
2136
2222
|
raw
|
|
2137
2223
|
};
|
|
2138
2224
|
}
|
|
2225
|
+
function parseSealGrant(raw, orgEtsi) {
|
|
2226
|
+
const r = rec3(raw);
|
|
2227
|
+
if (typeof r.grantId !== "string" || r.grantId === "" || typeof r.status !== "string" || r.status === "") {
|
|
2228
|
+
throw new ValidationError("seal: \u044D\u0440\u0445\u0438\u0439\u043D \u0445\u04AF\u0441\u044D\u043B\u0442\u0438\u0439\u043D \u0445\u0430\u0440\u0438\u0443\u043D\u0434 grantId/status \u0430\u043B\u0433\u0430");
|
|
2229
|
+
}
|
|
2230
|
+
return {
|
|
2231
|
+
grantId: r.grantId,
|
|
2232
|
+
orgEtsi: String(r.orgEtsi ?? orgEtsi ?? ""),
|
|
2233
|
+
status: r.status,
|
|
2234
|
+
expiresAt: String(r.expiresAt ?? ""),
|
|
2235
|
+
...typeof r.approvedAt === "string" ? { approvedAt: r.approvedAt } : {},
|
|
2236
|
+
...typeof r.revokedAt === "string" ? { revokedAt: r.revokedAt } : {},
|
|
2237
|
+
...typeof r.failure === "string" && r.failure ? { failure: r.failure } : {},
|
|
2238
|
+
raw
|
|
2239
|
+
};
|
|
2240
|
+
}
|
|
2139
2241
|
function sleep(ms2, signal) {
|
|
2140
2242
|
return new Promise((resolve, reject) => {
|
|
2141
2243
|
if (signal?.aborted) return reject(signal.reason);
|
|
@@ -2213,6 +2315,59 @@ var SealApi = class {
|
|
|
2213
2315
|
await sleep(Math.min(wait, left), opts.signal);
|
|
2214
2316
|
}
|
|
2215
2317
|
}
|
|
2318
|
+
/**
|
|
2319
|
+
* `POST /seal/grants` `{orgEtsi, sessionId}` — тамганы эрх (`SEAL:<orgEtsi>`)-ийг RP өөрөө хүсэх (202, `status:
|
|
2320
|
+
* "PENDING"`). `sessionId` — танай RP-ийн эхлүүлсэн, сүүлийн 5 минутад OK-оор дууссан AUTHENTICATION session; түүний хүн
|
|
2321
|
+
* байгууллагын улсын бүртгэлээр баталгаажсан Гүйцэтгэх захирал байх ёстой — push зөвхөн түүн рүү очиж PIN2-оор
|
|
2322
|
+
* зөвшөөрнө. Нэг session — нэг хүсэлт; ижил session-ээр дахин дуудвал ижил PENDING хүсэлтийг буцаана. SEAL эрх шаардахгүй,
|
|
2323
|
+
* биллинг тооцохгүй. Төлөвийг {@link waitForGrant} / {@link grantStatus}-ээр асууна. Алдаа: 400 {@link
|
|
2324
|
+
* RequestInvalidError}; 403 `ForbiddenError` (`RP_NOT_REGISTERED` | `NOT_ORG_CEO`); 404 {@link AuthSessionNotFoundError} |
|
|
2325
|
+
* `ORG_NOT_FOUND`; 409 {@link AuthSessionWrongFlowError} | {@link AuthSessionNotCompletedError} | {@link
|
|
2326
|
+
* AuthSessionTooOldError} | {@link AuthSessionAlreadyUsedError} | {@link OrgNotActiveError} | {@link RpNotActiveError} |
|
|
2327
|
+
* {@link SealGrantAlreadyApprovedError} | {@link RpPermissionsFullError} | {@link SealApproverUnavailableError}; 429
|
|
2328
|
+
* `RATE_LIMITED` (`retryAfterMs`).
|
|
2329
|
+
*/
|
|
2330
|
+
async requestGrant(orgEtsi, sessionId) {
|
|
2331
|
+
if (typeof orgEtsi !== "string" || orgEtsi.trim() === "" || orgEtsi.length > 64) throw new ValidationError("seal: orgEtsi \u0445\u043E\u043E\u0441\u043E\u043D \u044D\u0441\u0432\u044D\u043B 64 \u0442\u044D\u043C\u0434\u044D\u0433\u0442\u044D\u044D\u0441 \u0443\u0440\u0442");
|
|
2332
|
+
if (typeof sessionId !== "string" || sessionId.trim() === "" || sessionId.length > 64) throw new ValidationError("seal: sessionId \u0445\u043E\u043E\u0441\u043E\u043D \u044D\u0441\u0432\u044D\u043B 64 \u0442\u044D\u043C\u0434\u044D\u0433\u0442\u044D\u044D\u0441 \u0443\u0440\u0442");
|
|
2333
|
+
const body = { orgEtsi: orgEtsi.trim(), sessionId: sessionId.trim() };
|
|
2334
|
+
return parseSealGrant(await this.http.post(RP_ROUTES.sealGrantRequest.path, body), body.orgEtsi);
|
|
2335
|
+
}
|
|
2336
|
+
/**
|
|
2337
|
+
* `GET /seal/grants/{grantId}` — хүсэлтийн төлөв. Зөвхөн хүсэлтийн эзэн RP; бусад RP-д / олдоогүй → {@link
|
|
2338
|
+
* SealGrantNotFoundError} 404. `APPROVED` нь эрх цуцлагдтал хэвээр (`REVOKED` болтол).
|
|
2339
|
+
*/
|
|
2340
|
+
async grantStatus(grantId) {
|
|
2341
|
+
if (typeof grantId !== "string" || grantId === "") throw new ValidationError("seal: grantId \u0445\u043E\u043E\u0441\u043E\u043D");
|
|
2342
|
+
return parseSealGrant(await this.http.get(routePath(RP_ROUTES.sealGrantStatus, grantId)));
|
|
2343
|
+
}
|
|
2344
|
+
/**
|
|
2345
|
+
* Хүсэлт APPROVED болтол `intervalMs` тутамд асууж зөвшөөрсөн хүсэлтийг буцаана. REJECTED / EXPIRED / FAILED / REVOKED →
|
|
2346
|
+
* {@link SealGrantRequestError} (`outcome`, `failure`; шинэ хүсэлт хэрэгтэй); `timeoutMs` дуусвал `outcome: "TIMEOUT"`
|
|
2347
|
+
* (хүсэлт серверт PENDING хэвээр — ижил `grantId`-аар дахин хүлээж болно). Түр алдаа (`ApiError.retryable`) — Retry-After-ийг
|
|
2348
|
+
* хүлээгээд үргэлжилнэ; бусад алдаа шууд шидэгдэнэ. Хүлээх хугацаа, зайн анхдагч нь {@link waitForCertificate}-тэй ижил.
|
|
2349
|
+
*/
|
|
2350
|
+
async waitForGrant(grantId, opts = {}) {
|
|
2351
|
+
const interval = opts.intervalMs !== void 0 && opts.intervalMs > 0 ? opts.intervalMs : DEFAULT_SEAL_POLL_INTERVAL_MS;
|
|
2352
|
+
const deadline = Date.now() + (opts.timeoutMs !== void 0 && opts.timeoutMs > 0 ? opts.timeoutMs : DEFAULT_SEAL_WAIT_TIMEOUT_MS);
|
|
2353
|
+
for (; ; ) {
|
|
2354
|
+
if (opts.signal?.aborted) throw opts.signal.reason;
|
|
2355
|
+
let wait = interval;
|
|
2356
|
+
try {
|
|
2357
|
+
const g = await this.grantStatus(grantId);
|
|
2358
|
+
if (g.status === "APPROVED") return g;
|
|
2359
|
+
if (g.status === "REJECTED" || g.status === "EXPIRED" || g.status === "FAILED" || g.status === "REVOKED") {
|
|
2360
|
+
throw new SealGrantRequestError(g.status, g.grantId, g.failure);
|
|
2361
|
+
}
|
|
2362
|
+
} catch (e) {
|
|
2363
|
+
if (!(e instanceof ApiError && e.retryable)) throw e;
|
|
2364
|
+
wait = Math.max(interval, e.retryAfterMs ?? 0);
|
|
2365
|
+
}
|
|
2366
|
+
const left = deadline - Date.now();
|
|
2367
|
+
if (left <= 0) throw new SealGrantRequestError("TIMEOUT", grantId);
|
|
2368
|
+
await sleep(Math.min(wait, left), opts.signal);
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2216
2371
|
/**
|
|
2217
2372
|
* `POST /seal/{orgEtsi}` — digest-ийг байгууллагын тамгаар тамгална. `hashAlgorithm`: SHA-256 (анхдагч) | SHA-384 |
|
|
2218
2373
|
* SHA-512; digest-ийн урт таарахгүй бол сүлжээнд гарахгүй. Хариуны гарын үсгийг хариуны гэрчилгээгээр digest дээр
|
|
@@ -4492,6 +4647,11 @@ function createEidLogin(opts) {
|
|
|
4492
4647
|
ApiError,
|
|
4493
4648
|
AppTransactionTooLargeError,
|
|
4494
4649
|
AuthApi,
|
|
4650
|
+
AuthSessionAlreadyUsedError,
|
|
4651
|
+
AuthSessionNotCompletedError,
|
|
4652
|
+
AuthSessionNotFoundError,
|
|
4653
|
+
AuthSessionTooOldError,
|
|
4654
|
+
AuthSessionWrongFlowError,
|
|
4495
4655
|
AuthenticationError,
|
|
4496
4656
|
CITIZEN_INTERMEDIATES_PEM,
|
|
4497
4657
|
CITIZEN_ISSUING_CA_SKI,
|
|
@@ -4536,7 +4696,11 @@ function createEidLogin(opts) {
|
|
|
4536
4696
|
RequestInvalidError,
|
|
4537
4697
|
ResponseTooLargeError,
|
|
4538
4698
|
ResponseValidator,
|
|
4699
|
+
RpNotActiveError,
|
|
4700
|
+
RpPermissionsFullError,
|
|
4539
4701
|
SEAL_ERROR_CODES,
|
|
4702
|
+
SEAL_GRANT_ERROR_CODES,
|
|
4703
|
+
SEAL_GRANT_REQUEST_FIELDS,
|
|
4540
4704
|
SEAL_REQUEST_FIELDS,
|
|
4541
4705
|
SHARE_ERROR_CODES,
|
|
4542
4706
|
SHARE_FORM_FIELDS,
|
|
@@ -4546,6 +4710,9 @@ function createEidLogin(opts) {
|
|
|
4546
4710
|
SealCertNotYetValidError,
|
|
4547
4711
|
SealCertRevokedError,
|
|
4548
4712
|
SealCertificateRequestError,
|
|
4713
|
+
SealGrantAlreadyApprovedError,
|
|
4714
|
+
SealGrantNotFoundError,
|
|
4715
|
+
SealGrantRequestError,
|
|
4549
4716
|
SealKeyUnavailableError,
|
|
4550
4717
|
SealNotIssuedError,
|
|
4551
4718
|
SealRequestNotFoundError,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { R as RpCredentials, C as CertificateLevel, I as Interaction, S as SignatureAlgorithm, H as HashAlgorithm, N as NotificationSession, D as DeviceLinkSession, a as SessionResult, P as PersonBlock, b as RepresentationsResponse, A as AcspContext, F as FlowType } from './browser-
|
|
2
|
-
export {
|
|
1
|
+
import { R as RpCredentials, C as CertificateLevel, I as Interaction, S as SignatureAlgorithm, H as HashAlgorithm, N as NotificationSession, D as DeviceLinkSession, a as SessionResult, P as PersonBlock, b as RepresentationsResponse, c as PersonSealGrantsResponse, A as AcspContext, F as FlowType } from './browser-C-n2Wa5u.cjs';
|
|
2
|
+
export { d as DEFAULT_SIGN_SESSION_TTL_MS, E as EndResult, e as NavigatorLike, O as OrgResult, f as PersonOrgSealGrants, g as PersonSealGrant, h as Representation, i as SessionPresentation, j as SessionState, k as SignContext, l as SignatureAlgorithmParameters, m as SignatureProtocol, T as TokenCertSessionBlock, n as TokenCertStatus, o as isMobileUserAgent, p as parseExpiresAt, s as sessionExpiry, q as startExpiry } from './browser-C-n2Wa5u.cjs';
|
|
3
3
|
import { X509Certificate, KeyObject } from 'node:crypto';
|
|
4
|
-
import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-
|
|
5
|
-
export { a as AppTransactionTooLargeError, b as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, F as ForbiddenError, N as NetworkError,
|
|
4
|
+
import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-BekL912E.cjs';
|
|
5
|
+
export { a as AppTransactionTooLargeError, b as AuthSessionAlreadyUsedError, c as AuthSessionNotCompletedError, d as AuthSessionNotFoundError, e as AuthSessionTooOldError, f as AuthSessionWrongFlowError, g as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, F as ForbiddenError, N as NetworkError, h as NoSigningCertificateError, i as ON_BEHALF_ERROR_CODES, j as OrgNotActiveError, P as PDF_REGISTER_ERROR_CODES, k as PdfRegisterErrorCode, Q as QrTokenInvalidError, l as RETRYABLE_ERROR_CODES, m as RequestInvalidError, n as ResponseTooLargeError, o as RpNotActiveError, p as RpPermissionsFullError, S as SEAL_ERROR_CODES, q as SEAL_GRANT_ERROR_CODES, r as SealApproverUnavailableError, s as SealCertExpiredError, t as SealCertNotYetValidError, u as SealCertRevokedError, v as SealCertificateRequestError, w as SealErrorCode, x as SealGrantAlreadyApprovedError, y as SealGrantErrorCode, z as SealGrantNotFoundError, B as SealGrantOutcome, G as SealGrantRequestError, I as SealKeyUnavailableError, J as SealNotIssuedError, K as SealRequestNotFoundError, L as SealRequestOutcome, M as SealService, T as SealServiceDisabledError, U as SessionFailedError, V as ValidationError, W as parseRetryAfter } from './errors-BekL912E.cjs';
|
|
6
6
|
|
|
7
7
|
interface HttpConfig {
|
|
8
8
|
/** RP-API-ийн бүтэн суурь URL. Ж: https://rp.eidmongolia.mn */
|
|
@@ -408,6 +408,13 @@ declare class OrganizationApi {
|
|
|
408
408
|
constructor(http: Http);
|
|
409
409
|
/** GET /organization/representations/etsi/{personEtsi}. Сонголт нь итгэх эх биш — сервер дахин шалгана. */
|
|
410
410
|
getRepresentations(personEtsi: string): Promise<RepresentationsResponse>;
|
|
411
|
+
/**
|
|
412
|
+
* GET /organization/seal-grants/etsi/{personEtsi} — иргэн улсын бүртгэлээр баталгаажсан Гүйцэтгэх захирал байгаа байгууллага
|
|
413
|
+
* бүр ба түүний APPROVED / PENDING RP тамганы эрхүүд (захирлын «миний байгууллагын тамгыг хэн ашиглаж байна» харагдац).
|
|
414
|
+
* PKI_READ эрх шаардана; иргэн сүүлийн 24 цагт танай RP-ээр нэвтэрсэн байх ёстой (үгүй бол 403). Энгийн RP зөвхөн өөрийн
|
|
415
|
+
* эрхийг харна. Зөвхөн унших — эрх цуцлах нь eID аппаас.
|
|
416
|
+
*/
|
|
417
|
+
sealGrants(personEtsi: string): Promise<PersonSealGrantsResponse>;
|
|
411
418
|
}
|
|
412
419
|
|
|
413
420
|
/** `GET /seal/certificate/{orgEtsi}` (CA `dto.SealCertificateResponse`). */
|
|
@@ -466,6 +473,26 @@ interface SealWaitOptions {
|
|
|
466
473
|
declare const DEFAULT_SEAL_WAIT_TIMEOUT_MS: number;
|
|
467
474
|
/** `waitForCertificate`-ийн анхдагч poll зай (CA зөвлөмж 2–5 с). */
|
|
468
475
|
declare const DEFAULT_SEAL_POLL_INTERVAL_MS = 3000;
|
|
476
|
+
/** Тамганы эрхийн хүсэлтийн төлөв (CA `dto.RPSealGrantStatus.status`). */
|
|
477
|
+
type SealGrantRequestStatus = "PENDING" | "APPROVED" | "REJECTED" | "EXPIRED" | "FAILED" | "REVOKED";
|
|
478
|
+
/**
|
|
479
|
+
* `POST /seal/grants` (202) ба `GET /seal/grants/{grantId}` (CA `dto.RPSealGrantStatus`). `APPROVED` үед `/seal/{orgEtsi}`
|
|
480
|
+
* ажиллана.
|
|
481
|
+
*/
|
|
482
|
+
interface SealGrantRequest {
|
|
483
|
+
grantId: string;
|
|
484
|
+
orgEtsi: string;
|
|
485
|
+
/** PENDING — хүлээнэ; APPROVED — эрхтэй; REJECTED / EXPIRED / FAILED — шинэ хүсэлт; REVOKED — эрх цуцлагдсан. */
|
|
486
|
+
status: SealGrantRequestStatus | string;
|
|
487
|
+
/** RFC 3339 — PENDING хүсэлтийг зөвшөөрөх хугацааны төгсгөл (эрх өөрөө хугацаагүй). */
|
|
488
|
+
expiresAt: string;
|
|
489
|
+
/** RFC 3339 — захирал PIN2-оор зөвшөөрсөн цаг (APPROVED, эсвэл зөвшөөрсний дараа REVOKED). */
|
|
490
|
+
approvedAt?: string;
|
|
491
|
+
revokedAt?: string;
|
|
492
|
+
/** FAILED / EXPIRED / REVOKED-ийн машин код (ж: `EXPIRED`, `PUSH_FAILED`, `RP_NOT_ACTIVE`, `ORG_NOT_ACTIVE`, `CANCELLED`). */
|
|
493
|
+
failure?: string;
|
|
494
|
+
raw: unknown;
|
|
495
|
+
}
|
|
469
496
|
/** `POST /seal/{orgEtsi}` (CA `dto.SealResponse`). */
|
|
470
497
|
interface SealResult {
|
|
471
498
|
orgEtsi: string;
|
|
@@ -520,6 +547,31 @@ declare class SealApi {
|
|
|
520
547
|
* `failure: "SEAL_SERVICE_DISABLED"`.
|
|
521
548
|
*/
|
|
522
549
|
waitForCertificate(orgEtsi: string, requestId: string, opts?: SealWaitOptions): Promise<SealCertificate>;
|
|
550
|
+
/**
|
|
551
|
+
* `POST /seal/grants` `{orgEtsi, sessionId}` — тамганы эрх (`SEAL:<orgEtsi>`)-ийг RP өөрөө хүсэх (202, `status:
|
|
552
|
+
* "PENDING"`). `sessionId` — танай RP-ийн эхлүүлсэн, сүүлийн 5 минутад OK-оор дууссан AUTHENTICATION session; түүний хүн
|
|
553
|
+
* байгууллагын улсын бүртгэлээр баталгаажсан Гүйцэтгэх захирал байх ёстой — push зөвхөн түүн рүү очиж PIN2-оор
|
|
554
|
+
* зөвшөөрнө. Нэг session — нэг хүсэлт; ижил session-ээр дахин дуудвал ижил PENDING хүсэлтийг буцаана. SEAL эрх шаардахгүй,
|
|
555
|
+
* биллинг тооцохгүй. Төлөвийг {@link waitForGrant} / {@link grantStatus}-ээр асууна. Алдаа: 400 {@link
|
|
556
|
+
* RequestInvalidError}; 403 `ForbiddenError` (`RP_NOT_REGISTERED` | `NOT_ORG_CEO`); 404 {@link AuthSessionNotFoundError} |
|
|
557
|
+
* `ORG_NOT_FOUND`; 409 {@link AuthSessionWrongFlowError} | {@link AuthSessionNotCompletedError} | {@link
|
|
558
|
+
* AuthSessionTooOldError} | {@link AuthSessionAlreadyUsedError} | {@link OrgNotActiveError} | {@link RpNotActiveError} |
|
|
559
|
+
* {@link SealGrantAlreadyApprovedError} | {@link RpPermissionsFullError} | {@link SealApproverUnavailableError}; 429
|
|
560
|
+
* `RATE_LIMITED` (`retryAfterMs`).
|
|
561
|
+
*/
|
|
562
|
+
requestGrant(orgEtsi: string, sessionId: string): Promise<SealGrantRequest>;
|
|
563
|
+
/**
|
|
564
|
+
* `GET /seal/grants/{grantId}` — хүсэлтийн төлөв. Зөвхөн хүсэлтийн эзэн RP; бусад RP-д / олдоогүй → {@link
|
|
565
|
+
* SealGrantNotFoundError} 404. `APPROVED` нь эрх цуцлагдтал хэвээр (`REVOKED` болтол).
|
|
566
|
+
*/
|
|
567
|
+
grantStatus(grantId: string): Promise<SealGrantRequest>;
|
|
568
|
+
/**
|
|
569
|
+
* Хүсэлт APPROVED болтол `intervalMs` тутамд асууж зөвшөөрсөн хүсэлтийг буцаана. REJECTED / EXPIRED / FAILED / REVOKED →
|
|
570
|
+
* {@link SealGrantRequestError} (`outcome`, `failure`; шинэ хүсэлт хэрэгтэй); `timeoutMs` дуусвал `outcome: "TIMEOUT"`
|
|
571
|
+
* (хүсэлт серверт PENDING хэвээр — ижил `grantId`-аар дахин хүлээж болно). Түр алдаа (`ApiError.retryable`) — Retry-After-ийг
|
|
572
|
+
* хүлээгээд үргэлжилнэ; бусад алдаа шууд шидэгдэнэ. Хүлээх хугацаа, зайн анхдагч нь {@link waitForCertificate}-тэй ижил.
|
|
573
|
+
*/
|
|
574
|
+
waitForGrant(grantId: string, opts?: SealWaitOptions): Promise<SealGrantRequest>;
|
|
523
575
|
/**
|
|
524
576
|
* `POST /seal/{orgEtsi}` — digest-ийг байгууллагын тамгаар тамгална. `hashAlgorithm`: SHA-256 (анхдагч) | SHA-384 |
|
|
525
577
|
* SHA-512; digest-ийн урт таарахгүй бол сүлжээнд гарахгүй. Хариуны гарын үсгийг хариуны гэрчилгээгээр digest дээр
|
|
@@ -1618,6 +1670,8 @@ declare const PDF_SIGNATURE_REGISTER_FIELDS: readonly ["docID", "revIndex", "med
|
|
|
1618
1670
|
* JSON tag (`relyingPartyUUID`/`relyingPartyName` нь CA-д заавал биш). CA `DisallowUnknownFields`.
|
|
1619
1671
|
*/
|
|
1620
1672
|
declare const SEAL_REQUEST_FIELDS: readonly ["digest", "hashType"];
|
|
1673
|
+
/** `POST /seal/grants`-ийн биеийн талбарууд (CA `handlers_seal_grant_rp.go`). */
|
|
1674
|
+
declare const SEAL_GRANT_REQUEST_FIELDS: readonly ["orgEtsi", "sessionId"];
|
|
1621
1675
|
declare const SHARE_FORM_FIELDS: readonly ["file", "filename", "to", "subject", "message", "lang"];
|
|
1622
1676
|
|
|
1623
1677
|
interface OcspCheckerOptions {
|
|
@@ -2008,4 +2062,4 @@ declare function withReturnHint(callbackUrl: string, userAgent: string): string;
|
|
|
2008
2062
|
*/
|
|
2009
2063
|
declare function createEidLogin(opts: EidLoginOptions): EidLogin;
|
|
2010
2064
|
|
|
2011
|
-
export { APP_ATTESTATION_INVALID, AcspContext, type AcspV2Params, type ActivityCounts, type ActivityItem, type ActivityQuery, ApiError, AuthApi, type AuthDefaults, type AuthOptions, type BuildDeviceLinkInput, CITIZEN_INTERMEDIATES_PEM, CITIZEN_ISSUING_CA_SKI, CSR_KEY_REUSED, type CertChoiceOptions, type CertCounts, type CertSubject, CertificateLevel, type ClientConfig, type CompletedForRegistration, DEFAULT_BASE_URL, DEFAULT_MAX_WAIT_MS, DEFAULT_PDF_TIMEOUT_MS, DEFAULT_QR_ISSUER, DEFAULT_SEAL_POLL_INTERVAL_MS, DEFAULT_SEAL_WAIT_TIMEOUT_MS, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, EidError, type EidLogin, type EidLoginContext, type EidLoginEvent, type EidLoginEventKind, type EidLoginIdentity, type EidLoginMode, type EidLoginOptions, type EidLoginRateLimitFn, type EidLoginRateLimits, type EidLoginRateRule, type EidLoginRequest, type EidLoginResponse, type EidLoginStore, type EidLoginSuccess, type EidLoginTx, FlowType, HashAlgorithm, Http, type HttpConfig, HttpErrorInit, Interaction, KYC_INCOMPLETE, LoginStoreFullError, MAX_APP_TRANSACTION_BYTES, MEMORY_LOGIN_STORE_MAX, NATIONAL_ROOT_CA_PEM, NO_ACTIVE_DEVICE, NotificationSession, type OcspCheckerOptions, OnBehalfErrorCode, OrganizationApi, PDF_SIGNATURE_REGISTER_FIELDS, type ParsedQr, type PdfDigestInput, type PdfDigestSession, type PdfDigestSigner, type PersonActivity, PersonApi, PersonBlock, type PersonCertificate, type PersonCertificates, type PersonChild, type PersonChildren, type PersonDevice, type PersonDevices, type PersonSummary, type PriorSignature, QR_CLOCK_SKEW_SECONDS, QR_ERROR_CODES, QR_LIMITS, QR_MAX_AGE_SECONDS, QR_PREFIX, QrApi, type QrApiDeps, type QrCheck, type QrClaims, type QrConfig, type QrDeviceLinkTickerOptions, QrError, type QrErrorCode, type QrExpect, type QrPresentation, type QrSession, type QrSigner, type QrStartInput, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, RetryableErrorCode, type RevocationChecker, type RevocationOutcome, type RevocationStatus, RpCredentials, SEAL_REQUEST_FIELDS, SHARE_ERROR_CODES, SHARE_FORM_FIELDS, SealApi, type SealCertificate, type SealCertificateRequest, type SealCertificateRequestStatus, type SealResult, type SealWaitOptions, SessionApi, SessionResult, type SessionTtl, ShareError, type ShareErrorCode, type ShareInfo, type ShareInput, type ShareNotSignedReason, type ShareResult, SignApi, type SignDefaults, type SignOptions, SignatureAlgorithm, type Signer, type SignerRef, TOKEN_CONFLICT_CODES, TOKEN_ERROR_CODES, TOKEN_ISSUANCE_PENDING, TokenApi, type TokenAuthChallenge, type TokenAuthResult, type TokenCertInfo, type TokenCertInput, type TokenCertItem, type TokenCertPreview, type TokenCertResult, type TokenCertStart, type TokenConflictCode, type TokenErrorCode, type TokenIdentity, type TokenLimit, type TokenOrganization, type TrustConfig, type ValidateAuthOptions, type ValidateSignOptions, type VerifiedIdentity, type VerifiedSignature, WAIT_GRACE_MS, acspV2Digest, buildAcspV2Payload, buildDeviceLink, buildRegisterBody, certificateLevelOf, createEidLogin, defaultRateLimit, deviceLinkInput, forwardedClientIp, interactionsToBase64, isSealCertificate, memoryLoginStore, ocspRevocationChecker, parseQr, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, qrStatement, randomChallenge, registrationFromCompleted, resolveBaseUrl, sessionSecretDigest, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyQrPresentation, verifySessionSecretDigest, verifyTokenCertificates, withReturnHint };
|
|
2065
|
+
export { APP_ATTESTATION_INVALID, AcspContext, type AcspV2Params, type ActivityCounts, type ActivityItem, type ActivityQuery, ApiError, AuthApi, type AuthDefaults, type AuthOptions, type BuildDeviceLinkInput, CITIZEN_INTERMEDIATES_PEM, CITIZEN_ISSUING_CA_SKI, CSR_KEY_REUSED, type CertChoiceOptions, type CertCounts, type CertSubject, CertificateLevel, type ClientConfig, type CompletedForRegistration, DEFAULT_BASE_URL, DEFAULT_MAX_WAIT_MS, DEFAULT_PDF_TIMEOUT_MS, DEFAULT_QR_ISSUER, DEFAULT_SEAL_POLL_INTERVAL_MS, DEFAULT_SEAL_WAIT_TIMEOUT_MS, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, EidError, type EidLogin, type EidLoginContext, type EidLoginEvent, type EidLoginEventKind, type EidLoginIdentity, type EidLoginMode, type EidLoginOptions, type EidLoginRateLimitFn, type EidLoginRateLimits, type EidLoginRateRule, type EidLoginRequest, type EidLoginResponse, type EidLoginStore, type EidLoginSuccess, type EidLoginTx, FlowType, HashAlgorithm, Http, type HttpConfig, HttpErrorInit, Interaction, KYC_INCOMPLETE, LoginStoreFullError, MAX_APP_TRANSACTION_BYTES, MEMORY_LOGIN_STORE_MAX, NATIONAL_ROOT_CA_PEM, NO_ACTIVE_DEVICE, NotificationSession, type OcspCheckerOptions, OnBehalfErrorCode, OrganizationApi, PDF_SIGNATURE_REGISTER_FIELDS, type ParsedQr, type PdfDigestInput, type PdfDigestSession, type PdfDigestSigner, type PersonActivity, PersonApi, PersonBlock, type PersonCertificate, type PersonCertificates, type PersonChild, type PersonChildren, type PersonDevice, type PersonDevices, PersonSealGrantsResponse, type PersonSummary, type PriorSignature, QR_CLOCK_SKEW_SECONDS, QR_ERROR_CODES, QR_LIMITS, QR_MAX_AGE_SECONDS, QR_PREFIX, QrApi, type QrApiDeps, type QrCheck, type QrClaims, type QrConfig, type QrDeviceLinkTickerOptions, QrError, type QrErrorCode, type QrExpect, type QrPresentation, type QrSession, type QrSigner, type QrStartInput, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, RetryableErrorCode, type RevocationChecker, type RevocationOutcome, type RevocationStatus, RpCredentials, SEAL_GRANT_REQUEST_FIELDS, SEAL_REQUEST_FIELDS, SHARE_ERROR_CODES, SHARE_FORM_FIELDS, SealApi, type SealCertificate, type SealCertificateRequest, type SealCertificateRequestStatus, type SealGrantRequest, type SealGrantRequestStatus, type SealResult, type SealWaitOptions, SessionApi, SessionResult, type SessionTtl, ShareError, type ShareErrorCode, type ShareInfo, type ShareInput, type ShareNotSignedReason, type ShareResult, SignApi, type SignDefaults, type SignOptions, SignatureAlgorithm, type Signer, type SignerRef, TOKEN_CONFLICT_CODES, TOKEN_ERROR_CODES, TOKEN_ISSUANCE_PENDING, TokenApi, type TokenAuthChallenge, type TokenAuthResult, type TokenCertInfo, type TokenCertInput, type TokenCertItem, type TokenCertPreview, type TokenCertResult, type TokenCertStart, type TokenConflictCode, type TokenErrorCode, type TokenIdentity, type TokenLimit, type TokenOrganization, type TrustConfig, type ValidateAuthOptions, type ValidateSignOptions, type VerifiedIdentity, type VerifiedSignature, WAIT_GRACE_MS, acspV2Digest, buildAcspV2Payload, buildDeviceLink, buildRegisterBody, certificateLevelOf, createEidLogin, defaultRateLimit, deviceLinkInput, forwardedClientIp, interactionsToBase64, isSealCertificate, memoryLoginStore, ocspRevocationChecker, parseQr, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, qrStatement, randomChallenge, registrationFromCompleted, resolveBaseUrl, sessionSecretDigest, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyQrPresentation, verifySessionSecretDigest, verifyTokenCertificates, withReturnHint };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { R as RpCredentials, C as CertificateLevel, I as Interaction, S as SignatureAlgorithm, H as HashAlgorithm, N as NotificationSession, D as DeviceLinkSession, a as SessionResult, P as PersonBlock, b as RepresentationsResponse, A as AcspContext, F as FlowType } from './browser-
|
|
2
|
-
export {
|
|
1
|
+
import { R as RpCredentials, C as CertificateLevel, I as Interaction, S as SignatureAlgorithm, H as HashAlgorithm, N as NotificationSession, D as DeviceLinkSession, a as SessionResult, P as PersonBlock, b as RepresentationsResponse, c as PersonSealGrantsResponse, A as AcspContext, F as FlowType } from './browser-5yPFDx6a.js';
|
|
2
|
+
export { d as DEFAULT_SIGN_SESSION_TTL_MS, E as EndResult, e as NavigatorLike, O as OrgResult, f as PersonOrgSealGrants, g as PersonSealGrant, h as Representation, i as SessionPresentation, j as SessionState, k as SignContext, l as SignatureAlgorithmParameters, m as SignatureProtocol, T as TokenCertSessionBlock, n as TokenCertStatus, o as isMobileUserAgent, p as parseExpiresAt, s as sessionExpiry, q as startExpiry } from './browser-5yPFDx6a.js';
|
|
3
3
|
import { X509Certificate, KeyObject } from 'node:crypto';
|
|
4
|
-
import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-
|
|
5
|
-
export { a as AppTransactionTooLargeError, b as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, F as ForbiddenError, N as NetworkError,
|
|
4
|
+
import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-BekL912E.js';
|
|
5
|
+
export { a as AppTransactionTooLargeError, b as AuthSessionAlreadyUsedError, c as AuthSessionNotCompletedError, d as AuthSessionNotFoundError, e as AuthSessionTooOldError, f as AuthSessionWrongFlowError, g as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, F as ForbiddenError, N as NetworkError, h as NoSigningCertificateError, i as ON_BEHALF_ERROR_CODES, j as OrgNotActiveError, P as PDF_REGISTER_ERROR_CODES, k as PdfRegisterErrorCode, Q as QrTokenInvalidError, l as RETRYABLE_ERROR_CODES, m as RequestInvalidError, n as ResponseTooLargeError, o as RpNotActiveError, p as RpPermissionsFullError, S as SEAL_ERROR_CODES, q as SEAL_GRANT_ERROR_CODES, r as SealApproverUnavailableError, s as SealCertExpiredError, t as SealCertNotYetValidError, u as SealCertRevokedError, v as SealCertificateRequestError, w as SealErrorCode, x as SealGrantAlreadyApprovedError, y as SealGrantErrorCode, z as SealGrantNotFoundError, B as SealGrantOutcome, G as SealGrantRequestError, I as SealKeyUnavailableError, J as SealNotIssuedError, K as SealRequestNotFoundError, L as SealRequestOutcome, M as SealService, T as SealServiceDisabledError, U as SessionFailedError, V as ValidationError, W as parseRetryAfter } from './errors-BekL912E.js';
|
|
6
6
|
|
|
7
7
|
interface HttpConfig {
|
|
8
8
|
/** RP-API-ийн бүтэн суурь URL. Ж: https://rp.eidmongolia.mn */
|
|
@@ -408,6 +408,13 @@ declare class OrganizationApi {
|
|
|
408
408
|
constructor(http: Http);
|
|
409
409
|
/** GET /organization/representations/etsi/{personEtsi}. Сонголт нь итгэх эх биш — сервер дахин шалгана. */
|
|
410
410
|
getRepresentations(personEtsi: string): Promise<RepresentationsResponse>;
|
|
411
|
+
/**
|
|
412
|
+
* GET /organization/seal-grants/etsi/{personEtsi} — иргэн улсын бүртгэлээр баталгаажсан Гүйцэтгэх захирал байгаа байгууллага
|
|
413
|
+
* бүр ба түүний APPROVED / PENDING RP тамганы эрхүүд (захирлын «миний байгууллагын тамгыг хэн ашиглаж байна» харагдац).
|
|
414
|
+
* PKI_READ эрх шаардана; иргэн сүүлийн 24 цагт танай RP-ээр нэвтэрсэн байх ёстой (үгүй бол 403). Энгийн RP зөвхөн өөрийн
|
|
415
|
+
* эрхийг харна. Зөвхөн унших — эрх цуцлах нь eID аппаас.
|
|
416
|
+
*/
|
|
417
|
+
sealGrants(personEtsi: string): Promise<PersonSealGrantsResponse>;
|
|
411
418
|
}
|
|
412
419
|
|
|
413
420
|
/** `GET /seal/certificate/{orgEtsi}` (CA `dto.SealCertificateResponse`). */
|
|
@@ -466,6 +473,26 @@ interface SealWaitOptions {
|
|
|
466
473
|
declare const DEFAULT_SEAL_WAIT_TIMEOUT_MS: number;
|
|
467
474
|
/** `waitForCertificate`-ийн анхдагч poll зай (CA зөвлөмж 2–5 с). */
|
|
468
475
|
declare const DEFAULT_SEAL_POLL_INTERVAL_MS = 3000;
|
|
476
|
+
/** Тамганы эрхийн хүсэлтийн төлөв (CA `dto.RPSealGrantStatus.status`). */
|
|
477
|
+
type SealGrantRequestStatus = "PENDING" | "APPROVED" | "REJECTED" | "EXPIRED" | "FAILED" | "REVOKED";
|
|
478
|
+
/**
|
|
479
|
+
* `POST /seal/grants` (202) ба `GET /seal/grants/{grantId}` (CA `dto.RPSealGrantStatus`). `APPROVED` үед `/seal/{orgEtsi}`
|
|
480
|
+
* ажиллана.
|
|
481
|
+
*/
|
|
482
|
+
interface SealGrantRequest {
|
|
483
|
+
grantId: string;
|
|
484
|
+
orgEtsi: string;
|
|
485
|
+
/** PENDING — хүлээнэ; APPROVED — эрхтэй; REJECTED / EXPIRED / FAILED — шинэ хүсэлт; REVOKED — эрх цуцлагдсан. */
|
|
486
|
+
status: SealGrantRequestStatus | string;
|
|
487
|
+
/** RFC 3339 — PENDING хүсэлтийг зөвшөөрөх хугацааны төгсгөл (эрх өөрөө хугацаагүй). */
|
|
488
|
+
expiresAt: string;
|
|
489
|
+
/** RFC 3339 — захирал PIN2-оор зөвшөөрсөн цаг (APPROVED, эсвэл зөвшөөрсний дараа REVOKED). */
|
|
490
|
+
approvedAt?: string;
|
|
491
|
+
revokedAt?: string;
|
|
492
|
+
/** FAILED / EXPIRED / REVOKED-ийн машин код (ж: `EXPIRED`, `PUSH_FAILED`, `RP_NOT_ACTIVE`, `ORG_NOT_ACTIVE`, `CANCELLED`). */
|
|
493
|
+
failure?: string;
|
|
494
|
+
raw: unknown;
|
|
495
|
+
}
|
|
469
496
|
/** `POST /seal/{orgEtsi}` (CA `dto.SealResponse`). */
|
|
470
497
|
interface SealResult {
|
|
471
498
|
orgEtsi: string;
|
|
@@ -520,6 +547,31 @@ declare class SealApi {
|
|
|
520
547
|
* `failure: "SEAL_SERVICE_DISABLED"`.
|
|
521
548
|
*/
|
|
522
549
|
waitForCertificate(orgEtsi: string, requestId: string, opts?: SealWaitOptions): Promise<SealCertificate>;
|
|
550
|
+
/**
|
|
551
|
+
* `POST /seal/grants` `{orgEtsi, sessionId}` — тамганы эрх (`SEAL:<orgEtsi>`)-ийг RP өөрөө хүсэх (202, `status:
|
|
552
|
+
* "PENDING"`). `sessionId` — танай RP-ийн эхлүүлсэн, сүүлийн 5 минутад OK-оор дууссан AUTHENTICATION session; түүний хүн
|
|
553
|
+
* байгууллагын улсын бүртгэлээр баталгаажсан Гүйцэтгэх захирал байх ёстой — push зөвхөн түүн рүү очиж PIN2-оор
|
|
554
|
+
* зөвшөөрнө. Нэг session — нэг хүсэлт; ижил session-ээр дахин дуудвал ижил PENDING хүсэлтийг буцаана. SEAL эрх шаардахгүй,
|
|
555
|
+
* биллинг тооцохгүй. Төлөвийг {@link waitForGrant} / {@link grantStatus}-ээр асууна. Алдаа: 400 {@link
|
|
556
|
+
* RequestInvalidError}; 403 `ForbiddenError` (`RP_NOT_REGISTERED` | `NOT_ORG_CEO`); 404 {@link AuthSessionNotFoundError} |
|
|
557
|
+
* `ORG_NOT_FOUND`; 409 {@link AuthSessionWrongFlowError} | {@link AuthSessionNotCompletedError} | {@link
|
|
558
|
+
* AuthSessionTooOldError} | {@link AuthSessionAlreadyUsedError} | {@link OrgNotActiveError} | {@link RpNotActiveError} |
|
|
559
|
+
* {@link SealGrantAlreadyApprovedError} | {@link RpPermissionsFullError} | {@link SealApproverUnavailableError}; 429
|
|
560
|
+
* `RATE_LIMITED` (`retryAfterMs`).
|
|
561
|
+
*/
|
|
562
|
+
requestGrant(orgEtsi: string, sessionId: string): Promise<SealGrantRequest>;
|
|
563
|
+
/**
|
|
564
|
+
* `GET /seal/grants/{grantId}` — хүсэлтийн төлөв. Зөвхөн хүсэлтийн эзэн RP; бусад RP-д / олдоогүй → {@link
|
|
565
|
+
* SealGrantNotFoundError} 404. `APPROVED` нь эрх цуцлагдтал хэвээр (`REVOKED` болтол).
|
|
566
|
+
*/
|
|
567
|
+
grantStatus(grantId: string): Promise<SealGrantRequest>;
|
|
568
|
+
/**
|
|
569
|
+
* Хүсэлт APPROVED болтол `intervalMs` тутамд асууж зөвшөөрсөн хүсэлтийг буцаана. REJECTED / EXPIRED / FAILED / REVOKED →
|
|
570
|
+
* {@link SealGrantRequestError} (`outcome`, `failure`; шинэ хүсэлт хэрэгтэй); `timeoutMs` дуусвал `outcome: "TIMEOUT"`
|
|
571
|
+
* (хүсэлт серверт PENDING хэвээр — ижил `grantId`-аар дахин хүлээж болно). Түр алдаа (`ApiError.retryable`) — Retry-After-ийг
|
|
572
|
+
* хүлээгээд үргэлжилнэ; бусад алдаа шууд шидэгдэнэ. Хүлээх хугацаа, зайн анхдагч нь {@link waitForCertificate}-тэй ижил.
|
|
573
|
+
*/
|
|
574
|
+
waitForGrant(grantId: string, opts?: SealWaitOptions): Promise<SealGrantRequest>;
|
|
523
575
|
/**
|
|
524
576
|
* `POST /seal/{orgEtsi}` — digest-ийг байгууллагын тамгаар тамгална. `hashAlgorithm`: SHA-256 (анхдагч) | SHA-384 |
|
|
525
577
|
* SHA-512; digest-ийн урт таарахгүй бол сүлжээнд гарахгүй. Хариуны гарын үсгийг хариуны гэрчилгээгээр digest дээр
|
|
@@ -1618,6 +1670,8 @@ declare const PDF_SIGNATURE_REGISTER_FIELDS: readonly ["docID", "revIndex", "med
|
|
|
1618
1670
|
* JSON tag (`relyingPartyUUID`/`relyingPartyName` нь CA-д заавал биш). CA `DisallowUnknownFields`.
|
|
1619
1671
|
*/
|
|
1620
1672
|
declare const SEAL_REQUEST_FIELDS: readonly ["digest", "hashType"];
|
|
1673
|
+
/** `POST /seal/grants`-ийн биеийн талбарууд (CA `handlers_seal_grant_rp.go`). */
|
|
1674
|
+
declare const SEAL_GRANT_REQUEST_FIELDS: readonly ["orgEtsi", "sessionId"];
|
|
1621
1675
|
declare const SHARE_FORM_FIELDS: readonly ["file", "filename", "to", "subject", "message", "lang"];
|
|
1622
1676
|
|
|
1623
1677
|
interface OcspCheckerOptions {
|
|
@@ -2008,4 +2062,4 @@ declare function withReturnHint(callbackUrl: string, userAgent: string): string;
|
|
|
2008
2062
|
*/
|
|
2009
2063
|
declare function createEidLogin(opts: EidLoginOptions): EidLogin;
|
|
2010
2064
|
|
|
2011
|
-
export { APP_ATTESTATION_INVALID, AcspContext, type AcspV2Params, type ActivityCounts, type ActivityItem, type ActivityQuery, ApiError, AuthApi, type AuthDefaults, type AuthOptions, type BuildDeviceLinkInput, CITIZEN_INTERMEDIATES_PEM, CITIZEN_ISSUING_CA_SKI, CSR_KEY_REUSED, type CertChoiceOptions, type CertCounts, type CertSubject, CertificateLevel, type ClientConfig, type CompletedForRegistration, DEFAULT_BASE_URL, DEFAULT_MAX_WAIT_MS, DEFAULT_PDF_TIMEOUT_MS, DEFAULT_QR_ISSUER, DEFAULT_SEAL_POLL_INTERVAL_MS, DEFAULT_SEAL_WAIT_TIMEOUT_MS, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, EidError, type EidLogin, type EidLoginContext, type EidLoginEvent, type EidLoginEventKind, type EidLoginIdentity, type EidLoginMode, type EidLoginOptions, type EidLoginRateLimitFn, type EidLoginRateLimits, type EidLoginRateRule, type EidLoginRequest, type EidLoginResponse, type EidLoginStore, type EidLoginSuccess, type EidLoginTx, FlowType, HashAlgorithm, Http, type HttpConfig, HttpErrorInit, Interaction, KYC_INCOMPLETE, LoginStoreFullError, MAX_APP_TRANSACTION_BYTES, MEMORY_LOGIN_STORE_MAX, NATIONAL_ROOT_CA_PEM, NO_ACTIVE_DEVICE, NotificationSession, type OcspCheckerOptions, OnBehalfErrorCode, OrganizationApi, PDF_SIGNATURE_REGISTER_FIELDS, type ParsedQr, type PdfDigestInput, type PdfDigestSession, type PdfDigestSigner, type PersonActivity, PersonApi, PersonBlock, type PersonCertificate, type PersonCertificates, type PersonChild, type PersonChildren, type PersonDevice, type PersonDevices, type PersonSummary, type PriorSignature, QR_CLOCK_SKEW_SECONDS, QR_ERROR_CODES, QR_LIMITS, QR_MAX_AGE_SECONDS, QR_PREFIX, QrApi, type QrApiDeps, type QrCheck, type QrClaims, type QrConfig, type QrDeviceLinkTickerOptions, QrError, type QrErrorCode, type QrExpect, type QrPresentation, type QrSession, type QrSigner, type QrStartInput, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, RetryableErrorCode, type RevocationChecker, type RevocationOutcome, type RevocationStatus, RpCredentials, SEAL_REQUEST_FIELDS, SHARE_ERROR_CODES, SHARE_FORM_FIELDS, SealApi, type SealCertificate, type SealCertificateRequest, type SealCertificateRequestStatus, type SealResult, type SealWaitOptions, SessionApi, SessionResult, type SessionTtl, ShareError, type ShareErrorCode, type ShareInfo, type ShareInput, type ShareNotSignedReason, type ShareResult, SignApi, type SignDefaults, type SignOptions, SignatureAlgorithm, type Signer, type SignerRef, TOKEN_CONFLICT_CODES, TOKEN_ERROR_CODES, TOKEN_ISSUANCE_PENDING, TokenApi, type TokenAuthChallenge, type TokenAuthResult, type TokenCertInfo, type TokenCertInput, type TokenCertItem, type TokenCertPreview, type TokenCertResult, type TokenCertStart, type TokenConflictCode, type TokenErrorCode, type TokenIdentity, type TokenLimit, type TokenOrganization, type TrustConfig, type ValidateAuthOptions, type ValidateSignOptions, type VerifiedIdentity, type VerifiedSignature, WAIT_GRACE_MS, acspV2Digest, buildAcspV2Payload, buildDeviceLink, buildRegisterBody, certificateLevelOf, createEidLogin, defaultRateLimit, deviceLinkInput, forwardedClientIp, interactionsToBase64, isSealCertificate, memoryLoginStore, ocspRevocationChecker, parseQr, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, qrStatement, randomChallenge, registrationFromCompleted, resolveBaseUrl, sessionSecretDigest, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyQrPresentation, verifySessionSecretDigest, verifyTokenCertificates, withReturnHint };
|
|
2065
|
+
export { APP_ATTESTATION_INVALID, AcspContext, type AcspV2Params, type ActivityCounts, type ActivityItem, type ActivityQuery, ApiError, AuthApi, type AuthDefaults, type AuthOptions, type BuildDeviceLinkInput, CITIZEN_INTERMEDIATES_PEM, CITIZEN_ISSUING_CA_SKI, CSR_KEY_REUSED, type CertChoiceOptions, type CertCounts, type CertSubject, CertificateLevel, type ClientConfig, type CompletedForRegistration, DEFAULT_BASE_URL, DEFAULT_MAX_WAIT_MS, DEFAULT_PDF_TIMEOUT_MS, DEFAULT_QR_ISSUER, DEFAULT_SEAL_POLL_INTERVAL_MS, DEFAULT_SEAL_WAIT_TIMEOUT_MS, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, EidError, type EidLogin, type EidLoginContext, type EidLoginEvent, type EidLoginEventKind, type EidLoginIdentity, type EidLoginMode, type EidLoginOptions, type EidLoginRateLimitFn, type EidLoginRateLimits, type EidLoginRateRule, type EidLoginRequest, type EidLoginResponse, type EidLoginStore, type EidLoginSuccess, type EidLoginTx, FlowType, HashAlgorithm, Http, type HttpConfig, HttpErrorInit, Interaction, KYC_INCOMPLETE, LoginStoreFullError, MAX_APP_TRANSACTION_BYTES, MEMORY_LOGIN_STORE_MAX, NATIONAL_ROOT_CA_PEM, NO_ACTIVE_DEVICE, NotificationSession, type OcspCheckerOptions, OnBehalfErrorCode, OrganizationApi, PDF_SIGNATURE_REGISTER_FIELDS, type ParsedQr, type PdfDigestInput, type PdfDigestSession, type PdfDigestSigner, type PersonActivity, PersonApi, PersonBlock, type PersonCertificate, type PersonCertificates, type PersonChild, type PersonChildren, type PersonDevice, type PersonDevices, PersonSealGrantsResponse, type PersonSummary, type PriorSignature, QR_CLOCK_SKEW_SECONDS, QR_ERROR_CODES, QR_LIMITS, QR_MAX_AGE_SECONDS, QR_PREFIX, QrApi, type QrApiDeps, type QrCheck, type QrClaims, type QrConfig, type QrDeviceLinkTickerOptions, QrError, type QrErrorCode, type QrExpect, type QrPresentation, type QrSession, type QrSigner, type QrStartInput, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, RetryableErrorCode, type RevocationChecker, type RevocationOutcome, type RevocationStatus, RpCredentials, SEAL_GRANT_REQUEST_FIELDS, SEAL_REQUEST_FIELDS, SHARE_ERROR_CODES, SHARE_FORM_FIELDS, SealApi, type SealCertificate, type SealCertificateRequest, type SealCertificateRequestStatus, type SealGrantRequest, type SealGrantRequestStatus, type SealResult, type SealWaitOptions, SessionApi, SessionResult, type SessionTtl, ShareError, type ShareErrorCode, type ShareInfo, type ShareInput, type ShareNotSignedReason, type ShareResult, SignApi, type SignDefaults, type SignOptions, SignatureAlgorithm, type Signer, type SignerRef, TOKEN_CONFLICT_CODES, TOKEN_ERROR_CODES, TOKEN_ISSUANCE_PENDING, TokenApi, type TokenAuthChallenge, type TokenAuthResult, type TokenCertInfo, type TokenCertInput, type TokenCertItem, type TokenCertPreview, type TokenCertResult, type TokenCertStart, type TokenConflictCode, type TokenErrorCode, type TokenIdentity, type TokenLimit, type TokenOrganization, type TrustConfig, type ValidateAuthOptions, type ValidateSignOptions, type VerifiedIdentity, type VerifiedSignature, WAIT_GRACE_MS, acspV2Digest, buildAcspV2Payload, buildDeviceLink, buildRegisterBody, certificateLevelOf, createEidLogin, defaultRateLimit, deviceLinkInput, forwardedClientIp, interactionsToBase64, isSealCertificate, memoryLoginStore, ocspRevocationChecker, parseQr, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, qrStatement, randomChallenge, registrationFromCompleted, resolveBaseUrl, sessionSecretDigest, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyQrPresentation, verifySessionSecretDigest, verifyTokenCertificates, withReturnHint };
|