@koraidv/core 1.7.1 → 1.7.3
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/dist/index.d.mts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +50 -4
- package/dist/index.mjs +50 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -532,7 +532,22 @@ declare class ApiClient {
|
|
|
532
532
|
private readonly baseDelay;
|
|
533
533
|
constructor(configuration: Configuration);
|
|
534
534
|
/**
|
|
535
|
-
* Get supported countries and their document types
|
|
535
|
+
* Get supported countries and their document types.
|
|
536
|
+
*
|
|
537
|
+
* Backend has no dedicated /supported-countries endpoint — the
|
|
538
|
+
* countries catalog is bundled into the /document-types response
|
|
539
|
+
* alongside the per-type metadata. We fetch that bundled payload,
|
|
540
|
+
* then project it onto the SDK's `SupportedCountry` shape:
|
|
541
|
+
* - `id` ← `code` (ISO-3166 alpha-2)
|
|
542
|
+
* - `flagEmoji` derived from the ISO code
|
|
543
|
+
* - `documentTypes` filtered from the bundled types list by country
|
|
544
|
+
*
|
|
545
|
+
* Mirrors the iOS / Android pattern (SessionManager.fetchSupported-
|
|
546
|
+
* Countries on iOS, ApiService.getDocumentTypes on Android). The
|
|
547
|
+
* previous standalone /supported-countries call had been silently
|
|
548
|
+
* 404-ing since the Web SDK shipped — surfaced 2026-05-29 by
|
|
549
|
+
* Luckycat's integration, hot on the heels of the v1.7.1
|
|
550
|
+
* wire-format pass.
|
|
536
551
|
*/
|
|
537
552
|
getSupportedCountries(): Promise<SupportedCountry[]>;
|
|
538
553
|
/**
|
|
@@ -590,6 +605,22 @@ declare class ApiClient {
|
|
|
590
605
|
submitLivenessChallenge(verificationId: string, challenge: LivenessChallenge, imageData: Blob): Promise<LivenessChallengeResponse>;
|
|
591
606
|
/**
|
|
592
607
|
* Check document quality before uploading.
|
|
608
|
+
*
|
|
609
|
+
* Outlier endpoint: backend's `CheckDocumentQualityRequest` is the
|
|
610
|
+
* one struct in identity-service still using snake_case JSON tags
|
|
611
|
+
* (`document_front_base64`, `document_type`). Every other request
|
|
612
|
+
* body on this client is camelCase. The v1.7.1 wire-format pass
|
|
613
|
+
* blanket-converted this one too and broke it with a 400 from
|
|
614
|
+
* gin's `binding:"required"` validator — fixed in v1.7.3 by
|
|
615
|
+
* sending snake_case for just this one endpoint. The response
|
|
616
|
+
* decoder still goes through transformResponse() which converts
|
|
617
|
+
* snake_case → camelCase, so DocumentQualityResponse on the SDK
|
|
618
|
+
* surface is unchanged.
|
|
619
|
+
*
|
|
620
|
+
* If the backend is ever unified onto camelCase, this can revert
|
|
621
|
+
* to the standard camelCase body — but Android currently sends
|
|
622
|
+
* snake_case via @SerializedName, so any backend change there
|
|
623
|
+
* needs an Android coordination first.
|
|
593
624
|
*/
|
|
594
625
|
checkDocumentQuality(imageData: Blob, documentType: string): Promise<DocumentQualityResponse>;
|
|
595
626
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -532,7 +532,22 @@ declare class ApiClient {
|
|
|
532
532
|
private readonly baseDelay;
|
|
533
533
|
constructor(configuration: Configuration);
|
|
534
534
|
/**
|
|
535
|
-
* Get supported countries and their document types
|
|
535
|
+
* Get supported countries and their document types.
|
|
536
|
+
*
|
|
537
|
+
* Backend has no dedicated /supported-countries endpoint — the
|
|
538
|
+
* countries catalog is bundled into the /document-types response
|
|
539
|
+
* alongside the per-type metadata. We fetch that bundled payload,
|
|
540
|
+
* then project it onto the SDK's `SupportedCountry` shape:
|
|
541
|
+
* - `id` ← `code` (ISO-3166 alpha-2)
|
|
542
|
+
* - `flagEmoji` derived from the ISO code
|
|
543
|
+
* - `documentTypes` filtered from the bundled types list by country
|
|
544
|
+
*
|
|
545
|
+
* Mirrors the iOS / Android pattern (SessionManager.fetchSupported-
|
|
546
|
+
* Countries on iOS, ApiService.getDocumentTypes on Android). The
|
|
547
|
+
* previous standalone /supported-countries call had been silently
|
|
548
|
+
* 404-ing since the Web SDK shipped — surfaced 2026-05-29 by
|
|
549
|
+
* Luckycat's integration, hot on the heels of the v1.7.1
|
|
550
|
+
* wire-format pass.
|
|
536
551
|
*/
|
|
537
552
|
getSupportedCountries(): Promise<SupportedCountry[]>;
|
|
538
553
|
/**
|
|
@@ -590,6 +605,22 @@ declare class ApiClient {
|
|
|
590
605
|
submitLivenessChallenge(verificationId: string, challenge: LivenessChallenge, imageData: Blob): Promise<LivenessChallengeResponse>;
|
|
591
606
|
/**
|
|
592
607
|
* Check document quality before uploading.
|
|
608
|
+
*
|
|
609
|
+
* Outlier endpoint: backend's `CheckDocumentQualityRequest` is the
|
|
610
|
+
* one struct in identity-service still using snake_case JSON tags
|
|
611
|
+
* (`document_front_base64`, `document_type`). Every other request
|
|
612
|
+
* body on this client is camelCase. The v1.7.1 wire-format pass
|
|
613
|
+
* blanket-converted this one too and broke it with a 400 from
|
|
614
|
+
* gin's `binding:"required"` validator — fixed in v1.7.3 by
|
|
615
|
+
* sending snake_case for just this one endpoint. The response
|
|
616
|
+
* decoder still goes through transformResponse() which converts
|
|
617
|
+
* snake_case → camelCase, so DocumentQualityResponse on the SDK
|
|
618
|
+
* surface is unchanged.
|
|
619
|
+
*
|
|
620
|
+
* If the backend is ever unified onto camelCase, this can revert
|
|
621
|
+
* to the standard camelCase body — but Android currently sends
|
|
622
|
+
* snake_case via @SerializedName, so any backend change there
|
|
623
|
+
* needs an Android coordination first.
|
|
593
624
|
*/
|
|
594
625
|
checkDocumentQuality(imageData: Blob, documentType: string): Promise<DocumentQualityResponse>;
|
|
595
626
|
/**
|
package/dist/index.js
CHANGED
|
@@ -538,10 +538,31 @@ var ApiClient = class {
|
|
|
538
538
|
this.baseUrl = environmentUrls[configuration.environment];
|
|
539
539
|
}
|
|
540
540
|
/**
|
|
541
|
-
* Get supported countries and their document types
|
|
541
|
+
* Get supported countries and their document types.
|
|
542
|
+
*
|
|
543
|
+
* Backend has no dedicated /supported-countries endpoint — the
|
|
544
|
+
* countries catalog is bundled into the /document-types response
|
|
545
|
+
* alongside the per-type metadata. We fetch that bundled payload,
|
|
546
|
+
* then project it onto the SDK's `SupportedCountry` shape:
|
|
547
|
+
* - `id` ← `code` (ISO-3166 alpha-2)
|
|
548
|
+
* - `flagEmoji` derived from the ISO code
|
|
549
|
+
* - `documentTypes` filtered from the bundled types list by country
|
|
550
|
+
*
|
|
551
|
+
* Mirrors the iOS / Android pattern (SessionManager.fetchSupported-
|
|
552
|
+
* Countries on iOS, ApiService.getDocumentTypes on Android). The
|
|
553
|
+
* previous standalone /supported-countries call had been silently
|
|
554
|
+
* 404-ing since the Web SDK shipped — surfaced 2026-05-29 by
|
|
555
|
+
* Luckycat's integration, hot on the heels of the v1.7.1
|
|
556
|
+
* wire-format pass.
|
|
542
557
|
*/
|
|
543
558
|
async getSupportedCountries() {
|
|
544
|
-
|
|
559
|
+
const response = await this.request("/document-types");
|
|
560
|
+
return response.countries.map((c) => ({
|
|
561
|
+
id: c.code,
|
|
562
|
+
name: c.name,
|
|
563
|
+
flagEmoji: countryCodeToFlagEmoji(c.code),
|
|
564
|
+
documentTypes: response.documentTypes.filter((dt) => dt.country === c.code).map((dt) => dt.type)
|
|
565
|
+
})).filter((country) => country.documentTypes.length > 0);
|
|
545
566
|
}
|
|
546
567
|
/**
|
|
547
568
|
* Create a new verification
|
|
@@ -671,14 +692,30 @@ var ApiClient = class {
|
|
|
671
692
|
}
|
|
672
693
|
/**
|
|
673
694
|
* Check document quality before uploading.
|
|
695
|
+
*
|
|
696
|
+
* Outlier endpoint: backend's `CheckDocumentQualityRequest` is the
|
|
697
|
+
* one struct in identity-service still using snake_case JSON tags
|
|
698
|
+
* (`document_front_base64`, `document_type`). Every other request
|
|
699
|
+
* body on this client is camelCase. The v1.7.1 wire-format pass
|
|
700
|
+
* blanket-converted this one too and broke it with a 400 from
|
|
701
|
+
* gin's `binding:"required"` validator — fixed in v1.7.3 by
|
|
702
|
+
* sending snake_case for just this one endpoint. The response
|
|
703
|
+
* decoder still goes through transformResponse() which converts
|
|
704
|
+
* snake_case → camelCase, so DocumentQualityResponse on the SDK
|
|
705
|
+
* surface is unchanged.
|
|
706
|
+
*
|
|
707
|
+
* If the backend is ever unified onto camelCase, this can revert
|
|
708
|
+
* to the standard camelCase body — but Android currently sends
|
|
709
|
+
* snake_case via @SerializedName, so any backend change there
|
|
710
|
+
* needs an Android coordination first.
|
|
674
711
|
*/
|
|
675
712
|
async checkDocumentQuality(imageData, documentType) {
|
|
676
713
|
const documentFrontBase64 = await blobToBase64(imageData);
|
|
677
714
|
return this.request("/kyc/document-quality", {
|
|
678
715
|
method: "POST",
|
|
679
716
|
body: JSON.stringify({
|
|
680
|
-
documentFrontBase64,
|
|
681
|
-
documentType
|
|
717
|
+
document_front_base64: documentFrontBase64,
|
|
718
|
+
document_type: documentType
|
|
682
719
|
})
|
|
683
720
|
});
|
|
684
721
|
}
|
|
@@ -839,6 +876,15 @@ function instructionForChallengeType(type) {
|
|
|
839
876
|
return "Follow the on-screen prompt";
|
|
840
877
|
}
|
|
841
878
|
}
|
|
879
|
+
function countryCodeToFlagEmoji(code) {
|
|
880
|
+
if (!code || code.length !== 2) return "";
|
|
881
|
+
const upper = code.toUpperCase();
|
|
882
|
+
const a = upper.charCodeAt(0);
|
|
883
|
+
const b = upper.charCodeAt(1);
|
|
884
|
+
if (a < 65 || a > 90 || b < 65 || b > 90) return "";
|
|
885
|
+
const offset = 127462 - 65;
|
|
886
|
+
return String.fromCodePoint(a + offset, b + offset);
|
|
887
|
+
}
|
|
842
888
|
|
|
843
889
|
// src/KoraIDV.ts
|
|
844
890
|
var KoraIDV = class {
|
package/dist/index.mjs
CHANGED
|
@@ -494,10 +494,31 @@ var ApiClient = class {
|
|
|
494
494
|
this.baseUrl = environmentUrls[configuration.environment];
|
|
495
495
|
}
|
|
496
496
|
/**
|
|
497
|
-
* Get supported countries and their document types
|
|
497
|
+
* Get supported countries and their document types.
|
|
498
|
+
*
|
|
499
|
+
* Backend has no dedicated /supported-countries endpoint — the
|
|
500
|
+
* countries catalog is bundled into the /document-types response
|
|
501
|
+
* alongside the per-type metadata. We fetch that bundled payload,
|
|
502
|
+
* then project it onto the SDK's `SupportedCountry` shape:
|
|
503
|
+
* - `id` ← `code` (ISO-3166 alpha-2)
|
|
504
|
+
* - `flagEmoji` derived from the ISO code
|
|
505
|
+
* - `documentTypes` filtered from the bundled types list by country
|
|
506
|
+
*
|
|
507
|
+
* Mirrors the iOS / Android pattern (SessionManager.fetchSupported-
|
|
508
|
+
* Countries on iOS, ApiService.getDocumentTypes on Android). The
|
|
509
|
+
* previous standalone /supported-countries call had been silently
|
|
510
|
+
* 404-ing since the Web SDK shipped — surfaced 2026-05-29 by
|
|
511
|
+
* Luckycat's integration, hot on the heels of the v1.7.1
|
|
512
|
+
* wire-format pass.
|
|
498
513
|
*/
|
|
499
514
|
async getSupportedCountries() {
|
|
500
|
-
|
|
515
|
+
const response = await this.request("/document-types");
|
|
516
|
+
return response.countries.map((c) => ({
|
|
517
|
+
id: c.code,
|
|
518
|
+
name: c.name,
|
|
519
|
+
flagEmoji: countryCodeToFlagEmoji(c.code),
|
|
520
|
+
documentTypes: response.documentTypes.filter((dt) => dt.country === c.code).map((dt) => dt.type)
|
|
521
|
+
})).filter((country) => country.documentTypes.length > 0);
|
|
501
522
|
}
|
|
502
523
|
/**
|
|
503
524
|
* Create a new verification
|
|
@@ -627,14 +648,30 @@ var ApiClient = class {
|
|
|
627
648
|
}
|
|
628
649
|
/**
|
|
629
650
|
* Check document quality before uploading.
|
|
651
|
+
*
|
|
652
|
+
* Outlier endpoint: backend's `CheckDocumentQualityRequest` is the
|
|
653
|
+
* one struct in identity-service still using snake_case JSON tags
|
|
654
|
+
* (`document_front_base64`, `document_type`). Every other request
|
|
655
|
+
* body on this client is camelCase. The v1.7.1 wire-format pass
|
|
656
|
+
* blanket-converted this one too and broke it with a 400 from
|
|
657
|
+
* gin's `binding:"required"` validator — fixed in v1.7.3 by
|
|
658
|
+
* sending snake_case for just this one endpoint. The response
|
|
659
|
+
* decoder still goes through transformResponse() which converts
|
|
660
|
+
* snake_case → camelCase, so DocumentQualityResponse on the SDK
|
|
661
|
+
* surface is unchanged.
|
|
662
|
+
*
|
|
663
|
+
* If the backend is ever unified onto camelCase, this can revert
|
|
664
|
+
* to the standard camelCase body — but Android currently sends
|
|
665
|
+
* snake_case via @SerializedName, so any backend change there
|
|
666
|
+
* needs an Android coordination first.
|
|
630
667
|
*/
|
|
631
668
|
async checkDocumentQuality(imageData, documentType) {
|
|
632
669
|
const documentFrontBase64 = await blobToBase64(imageData);
|
|
633
670
|
return this.request("/kyc/document-quality", {
|
|
634
671
|
method: "POST",
|
|
635
672
|
body: JSON.stringify({
|
|
636
|
-
documentFrontBase64,
|
|
637
|
-
documentType
|
|
673
|
+
document_front_base64: documentFrontBase64,
|
|
674
|
+
document_type: documentType
|
|
638
675
|
})
|
|
639
676
|
});
|
|
640
677
|
}
|
|
@@ -795,6 +832,15 @@ function instructionForChallengeType(type) {
|
|
|
795
832
|
return "Follow the on-screen prompt";
|
|
796
833
|
}
|
|
797
834
|
}
|
|
835
|
+
function countryCodeToFlagEmoji(code) {
|
|
836
|
+
if (!code || code.length !== 2) return "";
|
|
837
|
+
const upper = code.toUpperCase();
|
|
838
|
+
const a = upper.charCodeAt(0);
|
|
839
|
+
const b = upper.charCodeAt(1);
|
|
840
|
+
if (a < 65 || a > 90 || b < 65 || b > 90) return "";
|
|
841
|
+
const offset = 127462 - 65;
|
|
842
|
+
return String.fromCodePoint(a + offset, b + offset);
|
|
843
|
+
}
|
|
798
844
|
|
|
799
845
|
// src/KoraIDV.ts
|
|
800
846
|
var KoraIDV = class {
|