@gerege-systems/eid-mongolia-sdk 0.40.3 → 0.42.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 +58 -1
- package/dist/{browser-DdxKtnvo.d.cts → browser-Cbph4U6r.d.cts} +5 -0
- package/dist/{browser-CxTMnKOc.d.ts → browser-aa_Judox.d.ts} +5 -0
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/{chunk-PWFTN52X.js → chunk-A6FYBPRV.js} +1 -1
- package/dist/index.cjs +235 -108
- package/dist/index.d.cts +80 -6
- package/dist/index.d.ts +80 -6
- package/dist/index.js +201 -77
- package/dist/pades.cjs +30 -0
- package/dist/pades.d.cts +40 -1
- package/dist/pades.d.ts +40 -1
- package/dist/pades.js +30 -1
- package/dist/validate.js +1 -1
- package/package.json +2 -2
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 { 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-
|
|
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-Cbph4U6r.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-Cbph4U6r.cjs';
|
|
3
|
+
import { X509Certificate, KeyObject } from 'node:crypto';
|
|
3
4
|
import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-CgJcEjrZ.cjs';
|
|
4
5
|
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
|
-
import { X509Certificate, KeyObject } from 'node:crypto';
|
|
6
6
|
|
|
7
7
|
interface HttpConfig {
|
|
8
8
|
/** RP-API-ийн бүтэн суурь URL. Ж: https://rp.eidmongolia.mn */
|
|
@@ -270,6 +270,13 @@ declare function buildRegisterBody(input: RegisterSignatureInput): Record<string
|
|
|
270
270
|
/** Certificate-choice session-ий тохиргоо. */
|
|
271
271
|
interface CertChoiceOptions {
|
|
272
272
|
certificateLevel?: CertificateLevel;
|
|
273
|
+
/**
|
|
274
|
+
* Linked signing буцах URL (`initialCallbackUrl`) — зөвхөн {@link SignApi.certificateChoiceDeviceLink}. Өгвөл
|
|
275
|
+
* Web2App/App2App холбоос үүснэ; утас linked SIGN дууссаны дараа энэ URL-ийг `sessionSecretDigest` + `sessionId`
|
|
276
|
+
* query-тэй нээнэ ({@link verifySessionSecretDigest}). CA-д RP-ийн callback_hosts жагсаалтаар шалгагдана;
|
|
277
|
+
* жагсаалтад байхгүй бол CA хаяж, session зөвхөн QR болно. Notification (etsi)-д илгээгдэхгүй.
|
|
278
|
+
*/
|
|
279
|
+
callbackUrl?: string;
|
|
273
280
|
}
|
|
274
281
|
/**
|
|
275
282
|
* Гарын үсэг зурах төхөөрөмж — `validator.validateCertificateChoice`-ийн үр дүн (эсвэл түүнээс хадгалсан утга).
|
|
@@ -333,8 +340,9 @@ declare class SignApi {
|
|
|
333
340
|
*/
|
|
334
341
|
certificateChoiceByEtsi(id: string, opts?: CertChoiceOptions): Promise<NotificationSession>;
|
|
335
342
|
/**
|
|
336
|
-
*
|
|
337
|
-
*
|
|
343
|
+
* Device link: иргэн хэн болохыг урьдчилж мэдэхгүй үед гэрчилгээ сонгуулах. `opts.callbackUrl` өгөөгүй бол
|
|
344
|
+
* ЗӨВХӨН QR (`deviceLinkInput(s, "QR", lang)`); өгвөл (CA-ийн callback_hosts-д байх https URL) Web2App/App2App
|
|
345
|
+
* холбоос мөн угсарна, linked sign дууссаны дараа утас callback-ийг нээнэ. CERT эрх.
|
|
338
346
|
*/
|
|
339
347
|
certificateChoiceDeviceLink(opts?: CertChoiceOptions): Promise<DeviceLinkSession>;
|
|
340
348
|
private signerBody;
|
|
@@ -402,6 +410,54 @@ declare class OrganizationApi {
|
|
|
402
410
|
getRepresentations(personEtsi: string): Promise<RepresentationsResponse>;
|
|
403
411
|
}
|
|
404
412
|
|
|
413
|
+
/** `GET /seal/certificate/{orgEtsi}` (CA `dto.SealCertificateResponse`). */
|
|
414
|
+
interface SealCertificate {
|
|
415
|
+
orgEtsi: string;
|
|
416
|
+
/** DER. */
|
|
417
|
+
certificate: Uint8Array;
|
|
418
|
+
serialNumber: string;
|
|
419
|
+
subjectDn: string;
|
|
420
|
+
issuerDn: string;
|
|
421
|
+
/** RFC 3339. */
|
|
422
|
+
notBefore: string;
|
|
423
|
+
notAfter: string;
|
|
424
|
+
certificateLevel: CertificateLevel | string;
|
|
425
|
+
/** Серверийн түүхий JSON. */
|
|
426
|
+
raw: unknown;
|
|
427
|
+
}
|
|
428
|
+
/** `POST /seal/{orgEtsi}` (CA `dto.SealResponse`). */
|
|
429
|
+
interface SealResult {
|
|
430
|
+
orgEtsi: string;
|
|
431
|
+
/** digest дээрх ECDSA гарын үсэг (ASN.1 DER). */
|
|
432
|
+
signature: Uint8Array;
|
|
433
|
+
/** ж: `ecdsa-with-SHA256` (digest-ийн hash-аас). */
|
|
434
|
+
signatureAlgorithm: string;
|
|
435
|
+
/** Тамгалсан гэрчилгээ (DER). */
|
|
436
|
+
certificate: Uint8Array;
|
|
437
|
+
certificateLevel: CertificateLevel | string;
|
|
438
|
+
/** RFC 3339. */
|
|
439
|
+
sealedAt: string;
|
|
440
|
+
raw: unknown;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* e-Seal профайл: KeyUsage-д nonRepudiation (contentCommitment) байгаа, digitalSignature байхгүй, EKU байхгүй, CA биш
|
|
444
|
+
* (CA/SDK шалгагчийн `usage: "seal"` ангилалтай ижил; Go `eid.IsSealCertificate`).
|
|
445
|
+
*/
|
|
446
|
+
declare function isSealCertificate(cert: X509Certificate | Uint8Array): boolean;
|
|
447
|
+
declare class SealApi {
|
|
448
|
+
private readonly http;
|
|
449
|
+
constructor(http: Http);
|
|
450
|
+
/** `GET /seal/certificate/{orgEtsi}` — байгууллагын идэвхтэй тамганы гэрчилгээ (PAdES-ийн signerCert). */
|
|
451
|
+
getCertificate(orgEtsi: string): Promise<SealCertificate>;
|
|
452
|
+
/**
|
|
453
|
+
* `POST /seal/{orgEtsi}` — digest-ийг байгууллагын тамгаар тамгална. `hashAlgorithm`: SHA-256 (анхдагч) | SHA-384 |
|
|
454
|
+
* SHA-512; digest-ийн урт таарахгүй бол сүлжээнд гарахгүй. Хариуны гарын үсгийг хариуны гэрчилгээгээр digest дээр
|
|
455
|
+
* шалгаж, гэрчилгээ e-Seal ({@link isSealCertificate}) эсэхийг тулгана — эс бөгөөс ValidationError. Гинж/цуцлалтыг
|
|
456
|
+
* `sealPdf` (OCSP/CRL) шалгана.
|
|
457
|
+
*/
|
|
458
|
+
seal(orgEtsi: string, digest: Uint8Array, hashAlgorithm?: HashAlgorithm): Promise<SealResult>;
|
|
459
|
+
}
|
|
460
|
+
|
|
405
461
|
/** Токенд холбогдсон байгууллага. */
|
|
406
462
|
interface TokenOrganization {
|
|
407
463
|
etsi: string;
|
|
@@ -1439,6 +1495,8 @@ declare class EidClient {
|
|
|
1439
1495
|
readonly auth: AuthApi;
|
|
1440
1496
|
readonly sign: SignApi;
|
|
1441
1497
|
readonly organization: OrganizationApi;
|
|
1498
|
+
/** Байгууллагын цахим тамга (e-Seal) — `SEAL:<orgEtsi>` эрх. */
|
|
1499
|
+
readonly seal: SealApi;
|
|
1442
1500
|
readonly person: PersonApi;
|
|
1443
1501
|
readonly token: TokenApi;
|
|
1444
1502
|
/** «Миний QR» (биечлэн шалгах): parse → start → result / check. */
|
|
@@ -1475,6 +1533,11 @@ declare const PDF_SIGNATURE_REGISTER_FIELDS: readonly ["docID", "revIndex", "med
|
|
|
1475
1533
|
* 0329ef95, !371). CA үл мэдэгдэх талбарыг 400 REQUEST_INVALID-аар татгалздаг. Live discovery-ийн `endpoints.share`
|
|
1476
1534
|
* тайлбартай гэрээний тест тулгана.
|
|
1477
1535
|
*/
|
|
1536
|
+
/**
|
|
1537
|
+
* `POST /seal/{orgEtsi}`-ийн биеийн талбарууд, SDK-ийн илгээдэг — CA `server/internal/dto/org_dtos.go` `SealRequest`-ийн
|
|
1538
|
+
* JSON tag (`relyingPartyUUID`/`relyingPartyName` нь CA-д заавал биш). CA `DisallowUnknownFields`.
|
|
1539
|
+
*/
|
|
1540
|
+
declare const SEAL_REQUEST_FIELDS: readonly ["digest", "hashType"];
|
|
1478
1541
|
declare const SHARE_FORM_FIELDS: readonly ["file", "filename", "to", "subject", "message", "lang"];
|
|
1479
1542
|
|
|
1480
1543
|
interface OcspCheckerOptions {
|
|
@@ -1525,6 +1588,17 @@ interface AcspV2Params {
|
|
|
1525
1588
|
declare function buildAcspV2Payload(p: AcspV2Params): Buffer;
|
|
1526
1589
|
/** HASH_{hashAlgorithm}(payload). */
|
|
1527
1590
|
declare function acspV2Digest(p: AcspV2Params, hashAlgorithm: HashAlgorithm | string): Buffer;
|
|
1591
|
+
/**
|
|
1592
|
+
* Linked signing буцах URL-ийн `sessionSecretDigest` = BASE64URL-NOPAD(SHA-256(base64-decode(sessionSecret))).
|
|
1593
|
+
* `sessionSecret` — certificate-choice device-link session-ий нууц (стандарт base64). Smart-ID RP-API v3
|
|
1594
|
+
* `CallbackUrlUtil`-тай ижил.
|
|
1595
|
+
*/
|
|
1596
|
+
declare function sessionSecretDigest(sessionSecret: string): string;
|
|
1597
|
+
/**
|
|
1598
|
+
* Callback-ийн `sessionSecretDigest`-ийг certificate-choice session-ий `sessionSecret`-тэй тулгана (timing-safe).
|
|
1599
|
+
* Буруу хэлбэр / хоосон оролтод `false` (throw хийхгүй).
|
|
1600
|
+
*/
|
|
1601
|
+
declare function verifySessionSecretDigest(digest: string, sessionSecret: string): boolean;
|
|
1528
1602
|
|
|
1529
1603
|
/** Холбоосын төрөл — апп гарын үсгийн `flowType`-д яг энэ утгыг зурна (authCode-оор хамгаалагдсан). */
|
|
1530
1604
|
type DeviceLinkType = "QR" | "Web2App" | "App2App";
|
|
@@ -1854,4 +1928,4 @@ declare function withReturnHint(callbackUrl: string, userAgent: string): string;
|
|
|
1854
1928
|
*/
|
|
1855
1929
|
declare function createEidLogin(opts: EidLoginOptions): EidLogin;
|
|
1856
1930
|
|
|
1857
|
-
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_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, 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, qrStatement, randomChallenge, registrationFromCompleted, resolveBaseUrl, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyQrPresentation, verifyTokenCertificates, withReturnHint };
|
|
1931
|
+
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_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 SealResult, 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 { 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-
|
|
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-aa_Judox.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-aa_Judox.js';
|
|
3
|
+
import { X509Certificate, KeyObject } from 'node:crypto';
|
|
3
4
|
import { O as OnBehalfErrorCode, R as RetryableErrorCode, E as EidError, A as ApiError, H as HttpErrorInit } from './errors-CgJcEjrZ.js';
|
|
4
5
|
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
|
-
import { X509Certificate, KeyObject } from 'node:crypto';
|
|
6
6
|
|
|
7
7
|
interface HttpConfig {
|
|
8
8
|
/** RP-API-ийн бүтэн суурь URL. Ж: https://rp.eidmongolia.mn */
|
|
@@ -270,6 +270,13 @@ declare function buildRegisterBody(input: RegisterSignatureInput): Record<string
|
|
|
270
270
|
/** Certificate-choice session-ий тохиргоо. */
|
|
271
271
|
interface CertChoiceOptions {
|
|
272
272
|
certificateLevel?: CertificateLevel;
|
|
273
|
+
/**
|
|
274
|
+
* Linked signing буцах URL (`initialCallbackUrl`) — зөвхөн {@link SignApi.certificateChoiceDeviceLink}. Өгвөл
|
|
275
|
+
* Web2App/App2App холбоос үүснэ; утас linked SIGN дууссаны дараа энэ URL-ийг `sessionSecretDigest` + `sessionId`
|
|
276
|
+
* query-тэй нээнэ ({@link verifySessionSecretDigest}). CA-д RP-ийн callback_hosts жагсаалтаар шалгагдана;
|
|
277
|
+
* жагсаалтад байхгүй бол CA хаяж, session зөвхөн QR болно. Notification (etsi)-д илгээгдэхгүй.
|
|
278
|
+
*/
|
|
279
|
+
callbackUrl?: string;
|
|
273
280
|
}
|
|
274
281
|
/**
|
|
275
282
|
* Гарын үсэг зурах төхөөрөмж — `validator.validateCertificateChoice`-ийн үр дүн (эсвэл түүнээс хадгалсан утга).
|
|
@@ -333,8 +340,9 @@ declare class SignApi {
|
|
|
333
340
|
*/
|
|
334
341
|
certificateChoiceByEtsi(id: string, opts?: CertChoiceOptions): Promise<NotificationSession>;
|
|
335
342
|
/**
|
|
336
|
-
*
|
|
337
|
-
*
|
|
343
|
+
* Device link: иргэн хэн болохыг урьдчилж мэдэхгүй үед гэрчилгээ сонгуулах. `opts.callbackUrl` өгөөгүй бол
|
|
344
|
+
* ЗӨВХӨН QR (`deviceLinkInput(s, "QR", lang)`); өгвөл (CA-ийн callback_hosts-д байх https URL) Web2App/App2App
|
|
345
|
+
* холбоос мөн угсарна, linked sign дууссаны дараа утас callback-ийг нээнэ. CERT эрх.
|
|
338
346
|
*/
|
|
339
347
|
certificateChoiceDeviceLink(opts?: CertChoiceOptions): Promise<DeviceLinkSession>;
|
|
340
348
|
private signerBody;
|
|
@@ -402,6 +410,54 @@ declare class OrganizationApi {
|
|
|
402
410
|
getRepresentations(personEtsi: string): Promise<RepresentationsResponse>;
|
|
403
411
|
}
|
|
404
412
|
|
|
413
|
+
/** `GET /seal/certificate/{orgEtsi}` (CA `dto.SealCertificateResponse`). */
|
|
414
|
+
interface SealCertificate {
|
|
415
|
+
orgEtsi: string;
|
|
416
|
+
/** DER. */
|
|
417
|
+
certificate: Uint8Array;
|
|
418
|
+
serialNumber: string;
|
|
419
|
+
subjectDn: string;
|
|
420
|
+
issuerDn: string;
|
|
421
|
+
/** RFC 3339. */
|
|
422
|
+
notBefore: string;
|
|
423
|
+
notAfter: string;
|
|
424
|
+
certificateLevel: CertificateLevel | string;
|
|
425
|
+
/** Серверийн түүхий JSON. */
|
|
426
|
+
raw: unknown;
|
|
427
|
+
}
|
|
428
|
+
/** `POST /seal/{orgEtsi}` (CA `dto.SealResponse`). */
|
|
429
|
+
interface SealResult {
|
|
430
|
+
orgEtsi: string;
|
|
431
|
+
/** digest дээрх ECDSA гарын үсэг (ASN.1 DER). */
|
|
432
|
+
signature: Uint8Array;
|
|
433
|
+
/** ж: `ecdsa-with-SHA256` (digest-ийн hash-аас). */
|
|
434
|
+
signatureAlgorithm: string;
|
|
435
|
+
/** Тамгалсан гэрчилгээ (DER). */
|
|
436
|
+
certificate: Uint8Array;
|
|
437
|
+
certificateLevel: CertificateLevel | string;
|
|
438
|
+
/** RFC 3339. */
|
|
439
|
+
sealedAt: string;
|
|
440
|
+
raw: unknown;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* e-Seal профайл: KeyUsage-д nonRepudiation (contentCommitment) байгаа, digitalSignature байхгүй, EKU байхгүй, CA биш
|
|
444
|
+
* (CA/SDK шалгагчийн `usage: "seal"` ангилалтай ижил; Go `eid.IsSealCertificate`).
|
|
445
|
+
*/
|
|
446
|
+
declare function isSealCertificate(cert: X509Certificate | Uint8Array): boolean;
|
|
447
|
+
declare class SealApi {
|
|
448
|
+
private readonly http;
|
|
449
|
+
constructor(http: Http);
|
|
450
|
+
/** `GET /seal/certificate/{orgEtsi}` — байгууллагын идэвхтэй тамганы гэрчилгээ (PAdES-ийн signerCert). */
|
|
451
|
+
getCertificate(orgEtsi: string): Promise<SealCertificate>;
|
|
452
|
+
/**
|
|
453
|
+
* `POST /seal/{orgEtsi}` — digest-ийг байгууллагын тамгаар тамгална. `hashAlgorithm`: SHA-256 (анхдагч) | SHA-384 |
|
|
454
|
+
* SHA-512; digest-ийн урт таарахгүй бол сүлжээнд гарахгүй. Хариуны гарын үсгийг хариуны гэрчилгээгээр digest дээр
|
|
455
|
+
* шалгаж, гэрчилгээ e-Seal ({@link isSealCertificate}) эсэхийг тулгана — эс бөгөөс ValidationError. Гинж/цуцлалтыг
|
|
456
|
+
* `sealPdf` (OCSP/CRL) шалгана.
|
|
457
|
+
*/
|
|
458
|
+
seal(orgEtsi: string, digest: Uint8Array, hashAlgorithm?: HashAlgorithm): Promise<SealResult>;
|
|
459
|
+
}
|
|
460
|
+
|
|
405
461
|
/** Токенд холбогдсон байгууллага. */
|
|
406
462
|
interface TokenOrganization {
|
|
407
463
|
etsi: string;
|
|
@@ -1439,6 +1495,8 @@ declare class EidClient {
|
|
|
1439
1495
|
readonly auth: AuthApi;
|
|
1440
1496
|
readonly sign: SignApi;
|
|
1441
1497
|
readonly organization: OrganizationApi;
|
|
1498
|
+
/** Байгууллагын цахим тамга (e-Seal) — `SEAL:<orgEtsi>` эрх. */
|
|
1499
|
+
readonly seal: SealApi;
|
|
1442
1500
|
readonly person: PersonApi;
|
|
1443
1501
|
readonly token: TokenApi;
|
|
1444
1502
|
/** «Миний QR» (биечлэн шалгах): parse → start → result / check. */
|
|
@@ -1475,6 +1533,11 @@ declare const PDF_SIGNATURE_REGISTER_FIELDS: readonly ["docID", "revIndex", "med
|
|
|
1475
1533
|
* 0329ef95, !371). CA үл мэдэгдэх талбарыг 400 REQUEST_INVALID-аар татгалздаг. Live discovery-ийн `endpoints.share`
|
|
1476
1534
|
* тайлбартай гэрээний тест тулгана.
|
|
1477
1535
|
*/
|
|
1536
|
+
/**
|
|
1537
|
+
* `POST /seal/{orgEtsi}`-ийн биеийн талбарууд, SDK-ийн илгээдэг — CA `server/internal/dto/org_dtos.go` `SealRequest`-ийн
|
|
1538
|
+
* JSON tag (`relyingPartyUUID`/`relyingPartyName` нь CA-д заавал биш). CA `DisallowUnknownFields`.
|
|
1539
|
+
*/
|
|
1540
|
+
declare const SEAL_REQUEST_FIELDS: readonly ["digest", "hashType"];
|
|
1478
1541
|
declare const SHARE_FORM_FIELDS: readonly ["file", "filename", "to", "subject", "message", "lang"];
|
|
1479
1542
|
|
|
1480
1543
|
interface OcspCheckerOptions {
|
|
@@ -1525,6 +1588,17 @@ interface AcspV2Params {
|
|
|
1525
1588
|
declare function buildAcspV2Payload(p: AcspV2Params): Buffer;
|
|
1526
1589
|
/** HASH_{hashAlgorithm}(payload). */
|
|
1527
1590
|
declare function acspV2Digest(p: AcspV2Params, hashAlgorithm: HashAlgorithm | string): Buffer;
|
|
1591
|
+
/**
|
|
1592
|
+
* Linked signing буцах URL-ийн `sessionSecretDigest` = BASE64URL-NOPAD(SHA-256(base64-decode(sessionSecret))).
|
|
1593
|
+
* `sessionSecret` — certificate-choice device-link session-ий нууц (стандарт base64). Smart-ID RP-API v3
|
|
1594
|
+
* `CallbackUrlUtil`-тай ижил.
|
|
1595
|
+
*/
|
|
1596
|
+
declare function sessionSecretDigest(sessionSecret: string): string;
|
|
1597
|
+
/**
|
|
1598
|
+
* Callback-ийн `sessionSecretDigest`-ийг certificate-choice session-ий `sessionSecret`-тэй тулгана (timing-safe).
|
|
1599
|
+
* Буруу хэлбэр / хоосон оролтод `false` (throw хийхгүй).
|
|
1600
|
+
*/
|
|
1601
|
+
declare function verifySessionSecretDigest(digest: string, sessionSecret: string): boolean;
|
|
1528
1602
|
|
|
1529
1603
|
/** Холбоосын төрөл — апп гарын үсгийн `flowType`-д яг энэ утгыг зурна (authCode-оор хамгаалагдсан). */
|
|
1530
1604
|
type DeviceLinkType = "QR" | "Web2App" | "App2App";
|
|
@@ -1854,4 +1928,4 @@ declare function withReturnHint(callbackUrl: string, userAgent: string): string;
|
|
|
1854
1928
|
*/
|
|
1855
1929
|
declare function createEidLogin(opts: EidLoginOptions): EidLogin;
|
|
1856
1930
|
|
|
1857
|
-
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_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, 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, qrStatement, randomChallenge, registrationFromCompleted, resolveBaseUrl, sha256Base64, tokenAuthDigest, tokenLimitOf, userChallengeOf, verifyPayloadSignature, verifyPrehashedSignature, verifyQrPresentation, verifyTokenCertificates, withReturnHint };
|
|
1931
|
+
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_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 SealResult, 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 };
|