@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 +3 -28
- package/dist/{types-Cf3GT4wh.d.cts → browser-CCP--VGv.d.ts} +17 -50
- package/dist/{types-Cf3GT4wh.d.ts → browser-w1Ca6FdZ.d.cts} +17 -50
- package/dist/browser.d.cts +2 -18
- package/dist/browser.d.ts +2 -18
- package/dist/browser.js +1 -1
- package/dist/button.cjs +265 -46
- package/dist/button.d.cts +10 -3
- package/dist/button.d.ts +10 -3
- package/dist/button.js +263 -46
- package/dist/{chunk-M4NS4UFP.js → chunk-MA4RMWBO.js} +13 -102
- package/dist/{chunk-TNXO4QLU.js → chunk-PWFTN52X.js} +0 -1
- package/dist/{errors-mcDbKiz_.d.cts → errors-CgJcEjrZ.d.cts} +2 -2
- package/dist/{errors-mcDbKiz_.d.ts → errors-CgJcEjrZ.d.ts} +2 -2
- package/dist/index.cjs +1 -24
- package/dist/index.d.cts +7 -29
- package/dist/index.d.ts +7 -29
- package/dist/index.js +2 -24
- package/dist/pades.cjs +20 -169
- package/dist/pades.d.cts +2 -44
- package/dist/pades.d.ts +2 -44
- package/dist/pades.js +9 -71
- package/dist/validate.cjs +15 -150
- package/dist/validate.d.cts +1 -1
- package/dist/validate.d.ts +1 -1
- package/dist/validate.js +5 -35
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -229,7 +229,6 @@ var PDF_REGISTER_ERROR_CODES = [
|
|
|
229
229
|
"REGISTRY_CONFLICT",
|
|
230
230
|
"DOC_NOT_FOUND",
|
|
231
231
|
"PRIOR_MISMATCH",
|
|
232
|
-
"IMAGE_MISMATCH",
|
|
233
232
|
"RATE_LIMITED",
|
|
234
233
|
"STATE_UNAVAILABLE"
|
|
235
234
|
];
|
|
@@ -406,7 +405,6 @@ var RP_ROUTES = {
|
|
|
406
405
|
personActivity: { method: "GET", path: "/rp/activity/etsi/{personEtsi}" },
|
|
407
406
|
personSummary: { method: "GET", path: "/person/summary/etsi/{personEtsi}" },
|
|
408
407
|
personChildren: { method: "GET", path: "/person/children/etsi/{personEtsi}" },
|
|
409
|
-
personSignatureImage: { method: "GET", path: "/person/etsi/{personEtsi}/signature-image" },
|
|
410
408
|
tokenCertificate: { method: "POST", path: "/token/certificate" },
|
|
411
409
|
tokenCertificateResult: { method: "GET", path: "/token/certificate/{sessionID}" },
|
|
412
410
|
pdfSignatures: { method: "POST", path: "/pdf/signatures" },
|
|
@@ -430,8 +428,7 @@ var PDF_SIGNATURE_REGISTER_FIELDS = [
|
|
|
430
428
|
"priorCmsSha256",
|
|
431
429
|
"priorRevisionSha256",
|
|
432
430
|
"onBehalfOf",
|
|
433
|
-
"signerEtsi"
|
|
434
|
-
"images"
|
|
431
|
+
"signerEtsi"
|
|
435
432
|
];
|
|
436
433
|
var SHARE_FORM_FIELDS = ["file", "filename", "to", "subject", "message", "lang"];
|
|
437
434
|
function routePath(route, ...args) {
|
|
@@ -639,7 +636,6 @@ function registrationFromCompleted(done, extra) {
|
|
|
639
636
|
}
|
|
640
637
|
if (extra.onBehalfOf) out.onBehalfOf = extra.onBehalfOf;
|
|
641
638
|
if (extra.signerEtsi) out.signerEtsi = extra.signerEtsi;
|
|
642
|
-
if (done.images?.length) out.images = done.images.map((x) => ({ kind: x.kind, sha256: x.sha256 }));
|
|
643
639
|
return out;
|
|
644
640
|
}
|
|
645
641
|
function priorSplits(n) {
|
|
@@ -701,12 +697,6 @@ function buildRegisterBody(input) {
|
|
|
701
697
|
if (priorRev.length) body.priorRevisionSha256 = priorRev;
|
|
702
698
|
if (input.onBehalfOf?.trim()) body.onBehalfOf = input.onBehalfOf.trim();
|
|
703
699
|
if (input.signerEtsi?.trim()) body.signerEtsi = input.signerEtsi.trim();
|
|
704
|
-
if (input.images?.length) {
|
|
705
|
-
body.images = input.images.map((x, i) => {
|
|
706
|
-
if (x?.kind !== "signature" && x?.kind !== "stamp") fail2(`images[${i}].kind: signature | stamp`);
|
|
707
|
-
return { kind: x.kind, sha256: hex(`images[${i}].sha256`, x.sha256) };
|
|
708
|
-
});
|
|
709
|
-
}
|
|
710
700
|
for (const k of Object.keys(body)) if (!PDF_SIGNATURE_REGISTER_FIELDS.includes(k)) fail2(`\u0434\u043E\u0442\u043E\u043E\u0434: \u04AF\u043B \u043C\u044D\u0434\u044D\u0433\u0434\u044D\u0445 \u0442\u0430\u043B\u0431\u0430\u0440 ${k}`);
|
|
711
701
|
return body;
|
|
712
702
|
}
|
|
@@ -1186,19 +1176,6 @@ var PersonApi = class {
|
|
|
1186
1176
|
children(personEtsi) {
|
|
1187
1177
|
return this.get(routePath(RP_ROUTES.personChildren, personEtsi));
|
|
1188
1178
|
}
|
|
1189
|
-
/**
|
|
1190
|
-
* GET /person/etsi/{personEtsi}/signature-image — иргэний гарын үсгийн зураг (харагдах гарын үсэгт:
|
|
1191
|
-
* `appearance.signatureImage = img.pdfImage`). PKI_READ биш, **SIGN** эрх; иргэн сүүлийн 24 цагт танай RP-ээр
|
|
1192
|
-
* нэвтэрсэн байх ёстой (эс бөгөөс `ForbiddenError`). Иргэн зураг хадгалаагүй (404) бол `null`.
|
|
1193
|
-
*/
|
|
1194
|
-
async signatureImage(personEtsi) {
|
|
1195
|
-
try {
|
|
1196
|
-
return rec3(await this.http.get(routePath(RP_ROUTES.personSignatureImage, personEtsi)));
|
|
1197
|
-
} catch (e) {
|
|
1198
|
-
if (e instanceof ApiError && e.status === 404) return null;
|
|
1199
|
-
throw e;
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
1179
|
};
|
|
1203
1180
|
|
|
1204
1181
|
// src/token.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +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,
|
|
2
|
-
export {
|
|
3
|
-
import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-
|
|
4
|
-
export { a as AppTransactionTooLargeError, b as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, F as ForbiddenError, N as NetworkError, c as NoSigningCertificateError, d as ON_BEHALF_ERROR_CODES, P as PDF_REGISTER_ERROR_CODES, e as PdfRegisterErrorCode, Q as QrTokenInvalidError, f as RETRYABLE_ERROR_CODES, g as RequestInvalidError, h as ResponseTooLargeError, S as SessionFailedError, V as ValidationError, p as parseRetryAfter } from './errors-
|
|
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-w1Ca6FdZ.cjs';
|
|
2
|
+
export { c as DEFAULT_SIGN_SESSION_TTL_MS, E as EndResult, d as NavigatorLike, O as OrgResult, e as Representation, f as SessionPresentation, g as SessionState, h as SignContext, i as SignatureAlgorithmParameters, j as SignatureProtocol, T as TokenCertSessionBlock, k as TokenCertStatus, l as isMobileUserAgent, p as parseExpiresAt, s as sessionExpiry, m as startExpiry } from './browser-w1Ca6FdZ.cjs';
|
|
3
|
+
import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-CgJcEjrZ.cjs';
|
|
4
|
+
export { a as AppTransactionTooLargeError, b as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, F as ForbiddenError, N as NetworkError, c as NoSigningCertificateError, d as ON_BEHALF_ERROR_CODES, P as PDF_REGISTER_ERROR_CODES, e as PdfRegisterErrorCode, Q as QrTokenInvalidError, f as RETRYABLE_ERROR_CODES, g as RequestInvalidError, h as ResponseTooLargeError, S as SessionFailedError, V as ValidationError, p as parseRetryAfter } from './errors-CgJcEjrZ.cjs';
|
|
5
5
|
import { X509Certificate, KeyObject } from 'node:crypto';
|
|
6
|
-
export { NavigatorLike, isMobileUserAgent } from './browser.cjs';
|
|
7
6
|
|
|
8
7
|
interface HttpConfig {
|
|
9
8
|
/** RP-API-ийн бүтэн суурь URL. Ж: https://rp.eidmongolia.mn */
|
|
@@ -220,18 +219,6 @@ interface RegisterSignatureInput {
|
|
|
220
219
|
onBehalfOf?: string;
|
|
221
220
|
/** Заавал биш (`PNOMN-…`): ирвэл CMS-ийн зурагчийн SERIALNUMBER-тэй тэнцүү (эс бөгөөс 409 `SIGNER_MISMATCH`). */
|
|
222
221
|
signerEtsi?: string;
|
|
223
|
-
/**
|
|
224
|
-
* `complete().images` (0.31.0+) — харагдах дүрслэлд шигтгэсэн зураг бүрийн `{kind, sha256}` (pades APPEARANCE_SPEC.md
|
|
225
|
-
* §6.6): CA зурагчийн/байгууллагын хадгалсан PNG-тэй тулгана. Зураггүй бол илгээхгүй.
|
|
226
|
-
*/
|
|
227
|
-
images?: PdfSignatureImage[];
|
|
228
|
-
}
|
|
229
|
-
/** {@link RegisterSignatureInput.images}-ийн нэг мөр (Go `eid.PDFSignatureImage`). */
|
|
230
|
-
interface PdfSignatureImage {
|
|
231
|
-
/** `signature` — иргэний гарын үсгийн зураг; `stamp` — байгууллагын тамганы зураг. */
|
|
232
|
-
kind: "signature" | "stamp";
|
|
233
|
-
/** CA-ийн хадгалсан PNG-ийн SHA-256 (64 жижиг hex). */
|
|
234
|
-
sha256: string;
|
|
235
222
|
}
|
|
236
223
|
/** Өмнөх нэг гарын үсгийн хоёр түлхүүр ({@link RegisterSignatureInput.priorSignatures}). */
|
|
237
224
|
interface PriorSignature {
|
|
@@ -255,8 +242,6 @@ interface CompletedForRegistration {
|
|
|
255
242
|
priorRevisionSha256?: string[];
|
|
256
243
|
/** `complete().claimedRole` (0.27.0+) — хоосон биш бол `onBehalfOf` заавал. */
|
|
257
244
|
claimedRole?: string;
|
|
258
|
-
/** `complete().images` (0.31.0+) — байвал `images` болж илгээгдэнэ. */
|
|
259
|
-
images?: PdfSignatureImage[];
|
|
260
245
|
}
|
|
261
246
|
/**
|
|
262
247
|
* `pades.complete()`-ийн үр дүнгээс `registerSignature`-ийн биеийг бөглөнө (`hasPage`-ийг илгээхгүй — CA `revIndex`-ээс
|
|
@@ -578,12 +563,6 @@ declare class PersonApi {
|
|
|
578
563
|
summary(personEtsi: string): Promise<PersonSummary>;
|
|
579
564
|
/** Асран хамгаалж буй хүүхдүүд (зөвхөн унших). */
|
|
580
565
|
children(personEtsi: string): Promise<PersonChildren>;
|
|
581
|
-
/**
|
|
582
|
-
* GET /person/etsi/{personEtsi}/signature-image — иргэний гарын үсгийн зураг (харагдах гарын үсэгт:
|
|
583
|
-
* `appearance.signatureImage = img.pdfImage`). PKI_READ биш, **SIGN** эрх; иргэн сүүлийн 24 цагт танай RP-ээр
|
|
584
|
-
* нэвтэрсэн байх ёстой (эс бөгөөс `ForbiddenError`). Иргэн зураг хадгалаагүй (404) бол `null`.
|
|
585
|
-
*/
|
|
586
|
-
signatureImage(personEtsi: string): Promise<EidImage | null>;
|
|
587
566
|
}
|
|
588
567
|
|
|
589
568
|
/** Задалсан subject. Cert-д байхгүй талбар — undefined. Давхардсан OID-ийн эхнийх нь. */
|
|
@@ -1470,11 +1449,10 @@ declare class EidClient {
|
|
|
1470
1449
|
|
|
1471
1450
|
/**
|
|
1472
1451
|
* `POST /pdf/signatures`-ийн биеийн талбарууд — CA `server/internal/dto/pdf.go` `PDFSignatureRegisterRequest`-ийн JSON
|
|
1473
|
-
* tag (CA main d948fdd4, !355
|
|
1474
|
-
* тул SDK зөвхөн эдгээрийг илгээнэ. Live discovery-ийн
|
|
1452
|
+
* tag (CA main d948fdd4, !355). CA `DisallowUnknownFields` тул SDK зөвхөн эдгээрийг илгээнэ. Live discovery-ийн
|
|
1475
1453
|
* `endpoints.pdf.signatures` тайлбартай гэрээний тест тулгана.
|
|
1476
1454
|
*/
|
|
1477
|
-
declare const PDF_SIGNATURE_REGISTER_FIELDS: readonly ["docID", "revIndex", "medium", "sessionID", "cms", "fileName", "inSha256", "pageSha256", "sigRevSha256", "outSha256", "priorCmsSha256", "priorRevisionSha256", "onBehalfOf", "signerEtsi"
|
|
1455
|
+
declare const PDF_SIGNATURE_REGISTER_FIELDS: readonly ["docID", "revIndex", "medium", "sessionID", "cms", "fileName", "inSha256", "pageSha256", "sigRevSha256", "outSha256", "priorCmsSha256", "priorRevisionSha256", "onBehalfOf", "signerEtsi"];
|
|
1478
1456
|
/**
|
|
1479
1457
|
* `POST /share`-ийн multipart талбарууд — CA `server/internal/httpapi/handlers_share.go` `parseShareRequest` (CA main
|
|
1480
1458
|
* 0329ef95, !371). CA үл мэдэгдэх талбарыг 400 REQUEST_INVALID-аар татгалздаг. Live discovery-ийн `endpoints.share`
|
|
@@ -1859,4 +1837,4 @@ declare function withReturnHint(callbackUrl: string, userAgent: string): string;
|
|
|
1859
1837
|
*/
|
|
1860
1838
|
declare function createEidLogin(opts: EidLoginOptions): EidLogin;
|
|
1861
1839
|
|
|
1862
|
-
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_QR_JWKS_CACHE_TTL_MS, DEFAULT_QR_JWKS_URL, DEFAULT_QR_MAX_AGE_MS, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, EidError,
|
|
1840
|
+
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_QR_JWKS_CACHE_TTL_MS, DEFAULT_QR_JWKS_URL, DEFAULT_QR_MAX_AGE_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, type Jwk, type Jwks, 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 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_ATTRIBUTES, QR_CLOCK_SKEW_MS, QR_ERROR_CODES, QR_PREFIX, QrApi, type QrAttribute, type QrAttrs, type QrCheck, type QrConfig, type QrDeviceLinkTickerOptions, QrError, type QrErrorCode, type QrExpect, type QrFullName, type QrPresentation, type QrSession, type QrStartInput, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, RetryableErrorCode, type RevocationChecker, type RevocationOutcome, type RevocationStatus, RpCredentials, SHARE_ERROR_CODES, SHARE_FORM_FIELDS, 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, memoryLoginStore, ocspRevocationChecker, parseQr, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, randomChallenge, registrationFromCompleted, resolveBaseUrl, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyQrPresentation, verifyTokenCertificates, withReturnHint };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +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,
|
|
2
|
-
export {
|
|
3
|
-
import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-
|
|
4
|
-
export { a as AppTransactionTooLargeError, b as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, F as ForbiddenError, N as NetworkError, c as NoSigningCertificateError, d as ON_BEHALF_ERROR_CODES, P as PDF_REGISTER_ERROR_CODES, e as PdfRegisterErrorCode, Q as QrTokenInvalidError, f as RETRYABLE_ERROR_CODES, g as RequestInvalidError, h as ResponseTooLargeError, S as SessionFailedError, V as ValidationError, p as parseRetryAfter } from './errors-
|
|
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-CCP--VGv.js';
|
|
2
|
+
export { c as DEFAULT_SIGN_SESSION_TTL_MS, E as EndResult, d as NavigatorLike, O as OrgResult, e as Representation, f as SessionPresentation, g as SessionState, h as SignContext, i as SignatureAlgorithmParameters, j as SignatureProtocol, T as TokenCertSessionBlock, k as TokenCertStatus, l as isMobileUserAgent, p as parseExpiresAt, s as sessionExpiry, m as startExpiry } from './browser-CCP--VGv.js';
|
|
3
|
+
import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-CgJcEjrZ.js';
|
|
4
|
+
export { a as AppTransactionTooLargeError, b as AuthenticationError, C as CertChoiceInvalidError, D as DeviceLinkError, F as ForbiddenError, N as NetworkError, c as NoSigningCertificateError, d as ON_BEHALF_ERROR_CODES, P as PDF_REGISTER_ERROR_CODES, e as PdfRegisterErrorCode, Q as QrTokenInvalidError, f as RETRYABLE_ERROR_CODES, g as RequestInvalidError, h as ResponseTooLargeError, S as SessionFailedError, V as ValidationError, p as parseRetryAfter } from './errors-CgJcEjrZ.js';
|
|
5
5
|
import { X509Certificate, KeyObject } from 'node:crypto';
|
|
6
|
-
export { NavigatorLike, isMobileUserAgent } from './browser.js';
|
|
7
6
|
|
|
8
7
|
interface HttpConfig {
|
|
9
8
|
/** RP-API-ийн бүтэн суурь URL. Ж: https://rp.eidmongolia.mn */
|
|
@@ -220,18 +219,6 @@ interface RegisterSignatureInput {
|
|
|
220
219
|
onBehalfOf?: string;
|
|
221
220
|
/** Заавал биш (`PNOMN-…`): ирвэл CMS-ийн зурагчийн SERIALNUMBER-тэй тэнцүү (эс бөгөөс 409 `SIGNER_MISMATCH`). */
|
|
222
221
|
signerEtsi?: string;
|
|
223
|
-
/**
|
|
224
|
-
* `complete().images` (0.31.0+) — харагдах дүрслэлд шигтгэсэн зураг бүрийн `{kind, sha256}` (pades APPEARANCE_SPEC.md
|
|
225
|
-
* §6.6): CA зурагчийн/байгууллагын хадгалсан PNG-тэй тулгана. Зураггүй бол илгээхгүй.
|
|
226
|
-
*/
|
|
227
|
-
images?: PdfSignatureImage[];
|
|
228
|
-
}
|
|
229
|
-
/** {@link RegisterSignatureInput.images}-ийн нэг мөр (Go `eid.PDFSignatureImage`). */
|
|
230
|
-
interface PdfSignatureImage {
|
|
231
|
-
/** `signature` — иргэний гарын үсгийн зураг; `stamp` — байгууллагын тамганы зураг. */
|
|
232
|
-
kind: "signature" | "stamp";
|
|
233
|
-
/** CA-ийн хадгалсан PNG-ийн SHA-256 (64 жижиг hex). */
|
|
234
|
-
sha256: string;
|
|
235
222
|
}
|
|
236
223
|
/** Өмнөх нэг гарын үсгийн хоёр түлхүүр ({@link RegisterSignatureInput.priorSignatures}). */
|
|
237
224
|
interface PriorSignature {
|
|
@@ -255,8 +242,6 @@ interface CompletedForRegistration {
|
|
|
255
242
|
priorRevisionSha256?: string[];
|
|
256
243
|
/** `complete().claimedRole` (0.27.0+) — хоосон биш бол `onBehalfOf` заавал. */
|
|
257
244
|
claimedRole?: string;
|
|
258
|
-
/** `complete().images` (0.31.0+) — байвал `images` болж илгээгдэнэ. */
|
|
259
|
-
images?: PdfSignatureImage[];
|
|
260
245
|
}
|
|
261
246
|
/**
|
|
262
247
|
* `pades.complete()`-ийн үр дүнгээс `registerSignature`-ийн биеийг бөглөнө (`hasPage`-ийг илгээхгүй — CA `revIndex`-ээс
|
|
@@ -578,12 +563,6 @@ declare class PersonApi {
|
|
|
578
563
|
summary(personEtsi: string): Promise<PersonSummary>;
|
|
579
564
|
/** Асран хамгаалж буй хүүхдүүд (зөвхөн унших). */
|
|
580
565
|
children(personEtsi: string): Promise<PersonChildren>;
|
|
581
|
-
/**
|
|
582
|
-
* GET /person/etsi/{personEtsi}/signature-image — иргэний гарын үсгийн зураг (харагдах гарын үсэгт:
|
|
583
|
-
* `appearance.signatureImage = img.pdfImage`). PKI_READ биш, **SIGN** эрх; иргэн сүүлийн 24 цагт танай RP-ээр
|
|
584
|
-
* нэвтэрсэн байх ёстой (эс бөгөөс `ForbiddenError`). Иргэн зураг хадгалаагүй (404) бол `null`.
|
|
585
|
-
*/
|
|
586
|
-
signatureImage(personEtsi: string): Promise<EidImage | null>;
|
|
587
566
|
}
|
|
588
567
|
|
|
589
568
|
/** Задалсан subject. Cert-д байхгүй талбар — undefined. Давхардсан OID-ийн эхнийх нь. */
|
|
@@ -1470,11 +1449,10 @@ declare class EidClient {
|
|
|
1470
1449
|
|
|
1471
1450
|
/**
|
|
1472
1451
|
* `POST /pdf/signatures`-ийн биеийн талбарууд — CA `server/internal/dto/pdf.go` `PDFSignatureRegisterRequest`-ийн JSON
|
|
1473
|
-
* tag (CA main d948fdd4, !355
|
|
1474
|
-
* тул SDK зөвхөн эдгээрийг илгээнэ. Live discovery-ийн
|
|
1452
|
+
* tag (CA main d948fdd4, !355). CA `DisallowUnknownFields` тул SDK зөвхөн эдгээрийг илгээнэ. Live discovery-ийн
|
|
1475
1453
|
* `endpoints.pdf.signatures` тайлбартай гэрээний тест тулгана.
|
|
1476
1454
|
*/
|
|
1477
|
-
declare const PDF_SIGNATURE_REGISTER_FIELDS: readonly ["docID", "revIndex", "medium", "sessionID", "cms", "fileName", "inSha256", "pageSha256", "sigRevSha256", "outSha256", "priorCmsSha256", "priorRevisionSha256", "onBehalfOf", "signerEtsi"
|
|
1455
|
+
declare const PDF_SIGNATURE_REGISTER_FIELDS: readonly ["docID", "revIndex", "medium", "sessionID", "cms", "fileName", "inSha256", "pageSha256", "sigRevSha256", "outSha256", "priorCmsSha256", "priorRevisionSha256", "onBehalfOf", "signerEtsi"];
|
|
1478
1456
|
/**
|
|
1479
1457
|
* `POST /share`-ийн multipart талбарууд — CA `server/internal/httpapi/handlers_share.go` `parseShareRequest` (CA main
|
|
1480
1458
|
* 0329ef95, !371). CA үл мэдэгдэх талбарыг 400 REQUEST_INVALID-аар татгалздаг. Live discovery-ийн `endpoints.share`
|
|
@@ -1859,4 +1837,4 @@ declare function withReturnHint(callbackUrl: string, userAgent: string): string;
|
|
|
1859
1837
|
*/
|
|
1860
1838
|
declare function createEidLogin(opts: EidLoginOptions): EidLogin;
|
|
1861
1839
|
|
|
1862
|
-
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_QR_JWKS_CACHE_TTL_MS, DEFAULT_QR_JWKS_URL, DEFAULT_QR_MAX_AGE_MS, DEFAULT_SHARE_TIMEOUT_MS, DeviceLinkSession, type DeviceLinkSessionType, type DeviceLinkType, EidClient, EidError,
|
|
1840
|
+
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_QR_JWKS_CACHE_TTL_MS, DEFAULT_QR_JWKS_URL, DEFAULT_QR_MAX_AGE_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, type Jwk, type Jwks, 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 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_ATTRIBUTES, QR_CLOCK_SKEW_MS, QR_ERROR_CODES, QR_PREFIX, QrApi, type QrAttribute, type QrAttrs, type QrCheck, type QrConfig, type QrDeviceLinkTickerOptions, QrError, type QrErrorCode, type QrExpect, type QrFullName, type QrPresentation, type QrSession, type QrStartInput, type RegisterSignatureInput, type RegisterSignatureResult, RepresentationsResponse, ResponseValidator, RetryableErrorCode, type RevocationChecker, type RevocationOutcome, type RevocationStatus, RpCredentials, SHARE_ERROR_CODES, SHARE_FORM_FIELDS, 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, memoryLoginStore, ocspRevocationChecker, parseQr, parseSessionResult, parseSubject, personMatchesCertificate, qrDeviceLinkTicker, randomChallenge, registrationFromCompleted, resolveBaseUrl, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyQrPresentation, verifyTokenCertificates, withReturnHint };
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
ValidationError,
|
|
32
32
|
maskPath,
|
|
33
33
|
parseRetryAfter
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-PWFTN52X.js";
|
|
35
35
|
|
|
36
36
|
// src/http.ts
|
|
37
37
|
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
@@ -169,7 +169,6 @@ var RP_ROUTES = {
|
|
|
169
169
|
personActivity: { method: "GET", path: "/rp/activity/etsi/{personEtsi}" },
|
|
170
170
|
personSummary: { method: "GET", path: "/person/summary/etsi/{personEtsi}" },
|
|
171
171
|
personChildren: { method: "GET", path: "/person/children/etsi/{personEtsi}" },
|
|
172
|
-
personSignatureImage: { method: "GET", path: "/person/etsi/{personEtsi}/signature-image" },
|
|
173
172
|
tokenCertificate: { method: "POST", path: "/token/certificate" },
|
|
174
173
|
tokenCertificateResult: { method: "GET", path: "/token/certificate/{sessionID}" },
|
|
175
174
|
pdfSignatures: { method: "POST", path: "/pdf/signatures" },
|
|
@@ -193,8 +192,7 @@ var PDF_SIGNATURE_REGISTER_FIELDS = [
|
|
|
193
192
|
"priorCmsSha256",
|
|
194
193
|
"priorRevisionSha256",
|
|
195
194
|
"onBehalfOf",
|
|
196
|
-
"signerEtsi"
|
|
197
|
-
"images"
|
|
195
|
+
"signerEtsi"
|
|
198
196
|
];
|
|
199
197
|
var SHARE_FORM_FIELDS = ["file", "filename", "to", "subject", "message", "lang"];
|
|
200
198
|
function routePath(route, ...args) {
|
|
@@ -402,7 +400,6 @@ function registrationFromCompleted(done, extra) {
|
|
|
402
400
|
}
|
|
403
401
|
if (extra.onBehalfOf) out.onBehalfOf = extra.onBehalfOf;
|
|
404
402
|
if (extra.signerEtsi) out.signerEtsi = extra.signerEtsi;
|
|
405
|
-
if (done.images?.length) out.images = done.images.map((x) => ({ kind: x.kind, sha256: x.sha256 }));
|
|
406
403
|
return out;
|
|
407
404
|
}
|
|
408
405
|
function priorSplits(n) {
|
|
@@ -464,12 +461,6 @@ function buildRegisterBody(input) {
|
|
|
464
461
|
if (priorRev.length) body.priorRevisionSha256 = priorRev;
|
|
465
462
|
if (input.onBehalfOf?.trim()) body.onBehalfOf = input.onBehalfOf.trim();
|
|
466
463
|
if (input.signerEtsi?.trim()) body.signerEtsi = input.signerEtsi.trim();
|
|
467
|
-
if (input.images?.length) {
|
|
468
|
-
body.images = input.images.map((x, i) => {
|
|
469
|
-
if (x?.kind !== "signature" && x?.kind !== "stamp") fail2(`images[${i}].kind: signature | stamp`);
|
|
470
|
-
return { kind: x.kind, sha256: hex(`images[${i}].sha256`, x.sha256) };
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
464
|
for (const k of Object.keys(body)) if (!PDF_SIGNATURE_REGISTER_FIELDS.includes(k)) fail2(`\u0434\u043E\u0442\u043E\u043E\u0434: \u04AF\u043B \u043C\u044D\u0434\u044D\u0433\u0434\u044D\u0445 \u0442\u0430\u043B\u0431\u0430\u0440 ${k}`);
|
|
474
465
|
return body;
|
|
475
466
|
}
|
|
@@ -949,19 +940,6 @@ var PersonApi = class {
|
|
|
949
940
|
children(personEtsi) {
|
|
950
941
|
return this.get(routePath(RP_ROUTES.personChildren, personEtsi));
|
|
951
942
|
}
|
|
952
|
-
/**
|
|
953
|
-
* GET /person/etsi/{personEtsi}/signature-image — иргэний гарын үсгийн зураг (харагдах гарын үсэгт:
|
|
954
|
-
* `appearance.signatureImage = img.pdfImage`). PKI_READ биш, **SIGN** эрх; иргэн сүүлийн 24 цагт танай RP-ээр
|
|
955
|
-
* нэвтэрсэн байх ёстой (эс бөгөөс `ForbiddenError`). Иргэн зураг хадгалаагүй (404) бол `null`.
|
|
956
|
-
*/
|
|
957
|
-
async signatureImage(personEtsi) {
|
|
958
|
-
try {
|
|
959
|
-
return rec3(await this.http.get(routePath(RP_ROUTES.personSignatureImage, personEtsi)));
|
|
960
|
-
} catch (e) {
|
|
961
|
-
if (e instanceof ApiError && e.status === 404) return null;
|
|
962
|
-
throw e;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
943
|
};
|
|
966
944
|
|
|
967
945
|
// src/token.ts
|