@smileid/usesmileid 12.1.1 → 12.2.1-SNAPSHOT.44

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.
Files changed (211) hide show
  1. package/CHANGELOG.md +4 -2
  2. package/README.md +67 -23
  3. package/dist/camera/bounding_box_metering_region.d.ts +10 -0
  4. package/dist/camera/bounding_box_metering_region.js +1 -0
  5. package/dist/camera/document_image_pipeline.d.ts +10 -1
  6. package/dist/camera/document_image_pipeline.js +1 -1
  7. package/dist/camera/imported_document_folder.d.ts +15 -0
  8. package/dist/camera/imported_document_folder.js +1 -0
  9. package/dist/camera/kamera_config_factory.d.ts +11 -1
  10. package/dist/camera/kamera_config_factory.js +1 -1
  11. package/dist/camera/use_smile_id_frame_stream.js +1 -1
  12. package/dist/camera/use_smile_id_kamera_camera_system.d.ts +52 -2
  13. package/dist/camera/use_smile_id_kamera_camera_system.js +1 -1
  14. package/dist/core/exception/invalid_job_type_screen_config_exception.js +1 -1
  15. package/dist/core/exception/missing_partner_config_exception.d.ts +2 -0
  16. package/dist/core/exception/missing_partner_config_exception.js +1 -1
  17. package/dist/core/exception/unused_job_params_exception.js +1 -1
  18. package/dist/core/exception/use_smile_id_error_code.d.ts +1 -0
  19. package/dist/core/exception/use_smile_id_error_code.js +1 -1
  20. package/dist/core/exception/use_smile_id_network_exception.d.ts +12 -4
  21. package/dist/core/exception/use_smile_id_network_exception.js +1 -1
  22. package/dist/core/is_development_build.d.ts +6 -0
  23. package/dist/core/is_development_build.js +1 -0
  24. package/dist/core/models/config.d.ts +6 -0
  25. package/dist/core/models/document_type.d.ts +1 -1
  26. package/dist/core/models/job_type.d.ts +5 -0
  27. package/dist/core/models/job_type.js +1 -1
  28. package/dist/core/models/ml_config.d.ts +1 -1
  29. package/dist/core/models/network_config.d.ts +6 -4
  30. package/dist/core/models/params.d.ts +18 -0
  31. package/dist/core/models/params.js +1 -1
  32. package/dist/core/models/result.d.ts +11 -0
  33. package/dist/core/models/result.js +1 -1
  34. package/dist/core/perf/capture_perf_trace.d.ts +90 -0
  35. package/dist/core/perf/capture_perf_trace.js +1 -0
  36. package/dist/data/api/interceptors/logging_interceptor.js +1 -1
  37. package/dist/data/api/interceptors/smile_auth_interceptor.js +1 -1
  38. package/dist/data/api/request_capture.d.ts +16 -0
  39. package/dist/data/api/request_capture.js +1 -0
  40. package/dist/data/api/smile_id_api.d.ts +7 -13
  41. package/dist/data/api/smile_id_api.js +1 -1
  42. package/dist/data/compression/compressible_asset.d.ts +9 -1
  43. package/dist/data/compression/compressible_asset.js +1 -1
  44. package/dist/data/compression/payload_compression_runner.d.ts +3 -0
  45. package/dist/data/compression/payload_compression_runner.js +1 -1
  46. package/dist/data/compression/payload_compressor.js +1 -1
  47. package/dist/data/factory/networking_factory.d.ts +5 -1
  48. package/dist/data/factory/networking_factory.js +1 -1
  49. package/dist/data/model/captured_job.d.ts +49 -0
  50. package/dist/data/model/captured_job.js +1 -0
  51. package/dist/data/model/job_request.d.ts +21 -2
  52. package/dist/data/model/sealed_job_request.d.ts +15 -0
  53. package/dist/data/model/sealed_job_request.js +1 -0
  54. package/dist/data/model/token_payload.d.ts +17 -1
  55. package/dist/data/model/token_payload.js +1 -1
  56. package/dist/data/repository/use_smile_id_repository.d.ts +7 -0
  57. package/dist/data/repository/use_smile_id_repository_impl.d.ts +29 -2
  58. package/dist/data/repository/use_smile_id_repository_impl.js +1 -1
  59. package/dist/data/security/job_package_crypto.d.ts +41 -0
  60. package/dist/data/security/job_package_crypto.js +1 -0
  61. package/dist/data/security/job_package_sealer.d.ts +35 -0
  62. package/dist/data/security/job_package_sealer.js +1 -0
  63. package/dist/data/security/signing_crypto.d.ts +34 -0
  64. package/dist/data/security/signing_crypto.js +1 -1
  65. package/dist/data/util/retry_util.d.ts +9 -6
  66. package/dist/data/util/retry_util.js +1 -1
  67. package/dist/debug/capture_debug_geometry.d.ts +29 -0
  68. package/dist/debug/capture_debug_geometry.js +1 -0
  69. package/dist/debug/document_preview_debug_geometry.d.ts +36 -0
  70. package/dist/debug/document_preview_debug_geometry.js +1 -0
  71. package/dist/debug/preview_debug_drawing.d.ts +51 -0
  72. package/dist/debug/preview_debug_drawing.js +1 -0
  73. package/dist/debug/selfie_preview_debug_geometry.d.ts +55 -0
  74. package/dist/debug/selfie_preview_debug_geometry.js +1 -0
  75. package/dist/debug/use_smile_id_debug.d.ts +84 -0
  76. package/dist/debug/use_smile_id_debug.js +1 -0
  77. package/dist/debug/use_smile_id_debug_tap.d.ts +25 -0
  78. package/dist/debug/use_smile_id_debug_tap.js +1 -0
  79. package/dist/debug/use_smile_id_document_capture_debug_overlay.d.ts +56 -0
  80. package/dist/debug/use_smile_id_document_capture_debug_overlay.js +1 -0
  81. package/dist/debug/use_smile_id_document_preview_debug_overlay.d.ts +32 -0
  82. package/dist/debug/use_smile_id_document_preview_debug_overlay.js +1 -0
  83. package/dist/debug/use_smile_id_selfie_capture_debug_overlay.d.ts +27 -0
  84. package/dist/debug/use_smile_id_selfie_capture_debug_overlay.js +1 -0
  85. package/dist/debug/use_smile_id_selfie_preview_debug_overlay.d.ts +64 -0
  86. package/dist/debug/use_smile_id_selfie_preview_debug_overlay.js +1 -0
  87. package/dist/index.d.ts +12 -2
  88. package/dist/index.js +1 -1
  89. package/dist/l10n/strings_en.d.ts +5 -4
  90. package/dist/l10n/strings_en.js +2 -2
  91. package/dist/l10n/use_smile_id_localizations.d.ts +6 -7
  92. package/dist/l10n/use_smile_id_localizations.js +1 -1
  93. package/dist/metadata/document_image_origin.d.ts +1 -0
  94. package/dist/metadata/document_image_origin.js +1 -1
  95. package/dist/metadata/metadata_configuration_mappers.d.ts +3 -5
  96. package/dist/metadata/metadata_configuration_mappers.js +1 -1
  97. package/dist/metadata/use_smile_id_metadata_factory.d.ts +4 -4
  98. package/dist/metadata/use_smile_id_metadata_factory.js +1 -1
  99. package/dist/presentation/assets/si_dark_lighting_animation.json +1 -927
  100. package/dist/presentation/assets/si_device_orientation_animation.json +1 -850
  101. package/dist/presentation/assets/si_document_green_book_hero_animation.json +1 -4740
  102. package/dist/presentation/assets/si_document_hero_animation.json +1 -4870
  103. package/dist/presentation/assets/si_document_hero_back_animation.json +1 -2122
  104. package/dist/presentation/assets/si_document_passport_hero_animation.json +1 -14540
  105. package/dist/presentation/assets/si_document_visa_hero_animation.json +1 -0
  106. package/dist/presentation/assets/si_ess_all_directions_hero_animation.json +1 -5906
  107. package/dist/presentation/assets/si_ess_animation_all_directions.json +1 -5906
  108. package/dist/presentation/assets/si_selfie_hero_animation.json +1 -1468
  109. package/dist/presentation/assets/si_smile_to_capture_animation.json +1 -1412
  110. package/dist/presentation/components/helpers/captured_image_uri.d.ts +11 -0
  111. package/dist/presentation/components/helpers/captured_image_uri.js +1 -0
  112. package/dist/presentation/components/helpers/captured_oval_region.d.ts +40 -0
  113. package/dist/presentation/components/helpers/captured_oval_region.js +1 -0
  114. package/dist/presentation/components/helpers/document_interior_crop.d.ts +54 -0
  115. package/dist/presentation/components/helpers/document_interior_crop.js +1 -0
  116. package/dist/presentation/components/helpers/enhanced_smart_selfie_animation_frames.d.ts +35 -29
  117. package/dist/presentation/components/helpers/enhanced_smart_selfie_animation_frames.js +1 -1
  118. package/dist/presentation/components/helpers/selfie_interior_crop.d.ts +60 -0
  119. package/dist/presentation/components/helpers/selfie_interior_crop.js +1 -0
  120. package/dist/presentation/components/use_smile_id_capture_content.d.ts +12 -3
  121. package/dist/presentation/components/use_smile_id_capture_content.js +1 -1
  122. package/dist/presentation/components/use_smile_id_captured_document_image.d.ts +16 -0
  123. package/dist/presentation/components/use_smile_id_captured_document_image.js +1 -1
  124. package/dist/presentation/components/use_smile_id_captured_image_oval.d.ts +18 -4
  125. package/dist/presentation/components/use_smile_id_captured_image_oval.js +1 -1
  126. package/dist/presentation/components/use_smile_id_document_overlay.d.ts +12 -1
  127. package/dist/presentation/components/use_smile_id_document_overlay.js +1 -1
  128. package/dist/presentation/components/use_smile_id_document_shimmer.d.ts +10 -5
  129. package/dist/presentation/components/use_smile_id_document_shimmer.js +1 -1
  130. package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_clip.d.ts +17 -7
  131. package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_clip.js +1 -1
  132. package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_direction_animation.d.ts +13 -14
  133. package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_direction_animation.js +1 -1
  134. package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_full_animation.js +1 -1
  135. package/dist/presentation/components/use_smile_id_face_oval_image.js +1 -1
  136. package/dist/presentation/flow/analytics/unsatisfied_reasons.d.ts +14 -0
  137. package/dist/presentation/flow/analytics/unsatisfied_reasons.js +1 -0
  138. package/dist/presentation/flow/analytics/use_smile_id_analytics_event.d.ts +12 -8
  139. package/dist/presentation/flow/analytics/use_smile_id_analytics_event.js +1 -1
  140. package/dist/presentation/flow/analytics/use_smile_id_analytics_event_kind.d.ts +98 -0
  141. package/dist/presentation/flow/analytics/use_smile_id_analytics_event_kind.js +1 -0
  142. package/dist/presentation/flow/config/flow_configuration_camera.d.ts +9 -0
  143. package/dist/presentation/flow/config/flow_configuration_camera.js +1 -0
  144. package/dist/presentation/flow/dsl/builder/config_builder.d.ts +6 -0
  145. package/dist/presentation/flow/dsl/builder/config_builder.js +1 -1
  146. package/dist/presentation/flow/dsl/builder/ml_builder.d.ts +1 -7
  147. package/dist/presentation/flow/dsl/builder/ml_builder.js +1 -1
  148. package/dist/presentation/flow/dsl/builder/screens_builder.d.ts +4 -2
  149. package/dist/presentation/flow/dsl/builder/screens_builder.js +1 -1
  150. package/dist/presentation/flow/dsl/use_smile_id_flow_builder.d.ts +17 -13
  151. package/dist/presentation/flow/dsl/use_smile_id_flow_builder.js +1 -1
  152. package/dist/presentation/flow/flow_navigation_manager.d.ts +72 -57
  153. package/dist/presentation/flow/flow_navigation_manager.js +1 -1
  154. package/dist/presentation/flow/flow_navigation_manager_analytics.d.ts +23 -0
  155. package/dist/presentation/flow/flow_navigation_manager_analytics.js +1 -0
  156. package/dist/presentation/flow/flow_navigation_manager_documents.d.ts +18 -0
  157. package/dist/presentation/flow/flow_navigation_manager_documents.js +1 -0
  158. package/dist/presentation/flow/flow_navigation_manager_job_request.d.ts +7 -0
  159. package/dist/presentation/flow/flow_navigation_manager_job_request.js +1 -0
  160. package/dist/presentation/flow/flow_navigation_manager_routing.d.ts +12 -0
  161. package/dist/presentation/flow/flow_navigation_manager_routing.js +1 -0
  162. package/dist/presentation/flow/flow_navigation_manager_submission.d.ts +17 -0
  163. package/dist/presentation/flow/flow_navigation_manager_submission.js +1 -0
  164. package/dist/presentation/flow/job_submission_state.d.ts +4 -0
  165. package/dist/presentation/flow/model/instructions_defaults.d.ts +1 -0
  166. package/dist/presentation/flow/model/instructions_defaults.js +1 -1
  167. package/dist/presentation/flow/screen/helpers/always_enabled_slot.d.ts +8 -0
  168. package/dist/presentation/flow/screen/helpers/always_enabled_slot.js +1 -0
  169. package/dist/presentation/flow/screen/helpers/face_session_config.d.ts +1 -1
  170. package/dist/presentation/flow/screen/helpers/failure_message.js +1 -1
  171. package/dist/presentation/flow/screen/orchestrated_capture_screen.js +1 -1
  172. package/dist/presentation/flow/screen/orchestrated_consent_screen.js +1 -1
  173. package/dist/presentation/flow/screen/orchestrated_instructions_screen.js +1 -1
  174. package/dist/presentation/flow/screen/orchestrated_preview_screen.js +1 -1
  175. package/dist/presentation/flow/screen/orchestrated_processing_screen.js +1 -1
  176. package/dist/presentation/flow/use_smile_id_flow.js +1 -1
  177. package/dist/presentation/flow/validation/flow_validator.d.ts +13 -12
  178. package/dist/presentation/flow/validation/flow_validator.js +1 -1
  179. package/dist/presentation/flow/validation/job_type_validator.d.ts +9 -1
  180. package/dist/presentation/flow/validation/job_type_validator.js +1 -1
  181. package/dist/presentation/screen/helpers/capture_screen_helpers.d.ts +0 -12
  182. package/dist/presentation/screen/helpers/capture_screen_helpers.js +1 -1
  183. package/dist/presentation/screen/helpers/capture_ui_state.d.ts +33 -6
  184. package/dist/presentation/screen/helpers/capture_ui_state.js +1 -1
  185. package/dist/presentation/screen/helpers/dropped_frames.d.ts +6 -0
  186. package/dist/presentation/screen/helpers/dropped_frames.js +1 -0
  187. package/dist/presentation/screen/helpers/ess_turn_haptics.d.ts +2 -0
  188. package/dist/presentation/screen/helpers/ess_turn_haptics.js +1 -1
  189. package/dist/presentation/screen/helpers/instructions_screen_helpers.d.ts +5 -1
  190. package/dist/presentation/screen/helpers/instructions_screen_helpers.js +1 -1
  191. package/dist/presentation/screen/helpers/use_capture_orientation_lock.d.ts +23 -1
  192. package/dist/presentation/screen/helpers/use_capture_orientation_lock.js +1 -1
  193. package/dist/presentation/screen/helpers/use_debounced_feedback_key.d.ts +1 -1
  194. package/dist/presentation/screen/helpers/use_debounced_feedback_key.js +1 -1
  195. package/dist/presentation/screen/use_smile_id_capture_screen.d.ts +9 -1
  196. package/dist/presentation/screen/use_smile_id_capture_screen.js +1 -1
  197. package/dist/presentation/screen/use_smile_id_consent_screen.js +1 -1
  198. package/dist/presentation/screen/use_smile_id_document_back_instructions.js +1 -1
  199. package/dist/presentation/screen/use_smile_id_document_preview_screen.d.ts +5 -0
  200. package/dist/presentation/screen/use_smile_id_document_preview_screen.js +1 -1
  201. package/dist/presentation/screen/use_smile_id_preview_screen.d.ts +3 -0
  202. package/dist/presentation/screen/use_smile_id_preview_screen.js +1 -1
  203. package/dist/presentation/screen/use_smile_id_processing_screen.d.ts +8 -0
  204. package/dist/presentation/screen/use_smile_id_processing_screen.js +1 -1
  205. package/dist/presentation/utils/locale_utils.d.ts +3 -6
  206. package/dist/presentation/utils/locale_utils.js +1 -1
  207. package/dist/testing/scenario_expectations.d.ts +7 -2
  208. package/dist/testing/scenario_expectations.js +1 -1
  209. package/dist/testing/scripted_scan_results.d.ts +2 -1
  210. package/dist/testing/scripted_scan_results.js +1 -1
  211. package/package.json +15 -15
@@ -13,6 +13,11 @@ export declare const JobType: {
13
13
  readonly documentVerification: 6;
14
14
  readonly bvn: 7;
15
15
  readonly enhancedDocumentVerification: 11;
16
+ /**
17
+ * Residency Document Verification — a primary passport capture followed by
18
+ * a mandatory supporting visa capture, submitted as one job.
19
+ */
20
+ readonly residencyDocumentVerification: 16;
16
21
  /**
17
22
  * Sentinel used when no job type has been configured, or when the
18
23
  * server returns a value not recognised by this SDK version. Update
@@ -1 +1 @@
1
- "use strict";export const JobType={biometricKyc:1,smartSelfieAuthentication:2,smartSelfieEnrollment:4,enhancedKyc:5,documentVerification:6,bvn:7,enhancedDocumentVerification:11,unknown:-1};export function jobTypeFromValue(e){return Object.values(JobType).find(n=>n===e)??JobType.unknown}export function requiresSelfie(e){return e===JobType.biometricKyc||e===JobType.smartSelfieAuthentication||e===JobType.smartSelfieEnrollment}export function requiresDocument(e){return e===JobType.biometricKyc||e===JobType.documentVerification||e===JobType.enhancedDocumentVerification}
1
+ "use strict";export const JobType={biometricKyc:1,smartSelfieAuthentication:2,smartSelfieEnrollment:4,enhancedKyc:5,documentVerification:6,bvn:7,enhancedDocumentVerification:11,residencyDocumentVerification:16,unknown:-1};export function jobTypeFromValue(e){return Object.values(JobType).find(n=>n===e)??JobType.unknown}export function requiresSelfie(e){return e===JobType.biometricKyc||e===JobType.smartSelfieAuthentication||e===JobType.smartSelfieEnrollment}export function requiresDocument(e){return e===JobType.biometricKyc||e===JobType.documentVerification||e===JobType.enhancedDocumentVerification||e===JobType.residencyDocumentVerification}
@@ -29,7 +29,7 @@ export type AnalyzerRegistry = {
29
29
  readonly selfie?: FaceAnalyzer;
30
30
  /**
31
31
  * Wire-shape `FaceConfig` built from the DSL scope (analyzer key,
32
- * ScanPerformanceProfile, FaceDetectorConfig). Falls back to native
32
+ * FaceDetectorConfig). Falls back to native
33
33
  * platform defaults when omitted.
34
34
  */
35
35
  readonly selfieConfig?: FaceConfig;
@@ -24,7 +24,10 @@ export declare enum LogLevel {
24
24
  basic = "basic",
25
25
  /** `basic` + request/response headers (pre-redaction applied). */
26
26
  headers = "headers",
27
- /** `headers` + request/response bodies. Verbose — partner-debug only. */
27
+ /**
28
+ * `headers` + request/response bodies, in a development build (`__DEV__`) only. A job's body
29
+ * carries the images, consent and device metadata, so any other build logs `headers`.
30
+ */
28
31
  body = "body"
29
32
  }
30
33
  export type NetworkLoggingConfig = {
@@ -42,9 +45,8 @@ export type NetworkLoggingConfig = {
42
45
  export type PartnerConfig = {
43
46
  readonly partnerId: string;
44
47
  /**
45
- * Partner webhook endpoint. Sent as the `callback-url` HTTP header
46
- * on every request and, when non-empty, as the `callback_url`
47
- * multipart form part on Enhanced/Biometric KYC submissions.
48
+ * Sent as the `callback_url` part on every product when non-empty; blank uses
49
+ * the account's default for that environment.
48
50
  */
49
51
  readonly callbackUrl: string;
50
52
  readonly useSandbox: boolean;
@@ -89,3 +89,21 @@ export type EnhancedDocumentVerificationParams = {
89
89
  /** Document type. Required — drives the ID-authority cross-check. */
90
90
  readonly idType: string;
91
91
  };
92
+ /**
93
+ * The only `idType` `/v3/residency_document_verification` accepts.
94
+ *
95
+ * A South African visa is issued into a passport and nothing else can carry one, so the backend
96
+ * pins the field rather than classifying the document.
97
+ */
98
+ export declare const RESIDENCY_ID_TYPE = "PASSPORT";
99
+ /**
100
+ * Identity fields for a Residency Document Verification job — a passport data
101
+ * page plus a mandatory visa page. `userDetails` rides on the top-level builder
102
+ * via `b.userDetails = ...`, not on this type.
103
+ */
104
+ export type ResidencyDocumentVerificationParams = {
105
+ /** ISO 3166-1 alpha-2 country code (e.g. `"AE"`). */
106
+ readonly country: string;
107
+ /** Document type. Required — drives the ID-authority cross-check. */
108
+ readonly idType: string;
109
+ };
@@ -1 +1 @@
1
- "use strict";export{};
1
+ "use strict";export const RESIDENCY_ID_TYPE="PASSPORT";
@@ -1,3 +1,4 @@
1
+ import type { CapturedJob } from "../../data/model/captured_job";
1
2
  /**
2
3
  * The outcome of an SDK operation: success with a value, failure with an
3
4
  * error, or cancellation when the user exits the flow. Surfaced to
@@ -16,6 +17,15 @@ export type UseSmileIDResult<T> = {
16
17
  readonly error: unknown;
17
18
  } | {
18
19
  readonly status: "cancelled";
20
+ }
21
+ /**
22
+ * The flow captured everything the job needs and stopped short of
23
+ * submitting it, because `c.skipApiSubmission = true`. `job` holds the
24
+ * files and metadata to forward.
25
+ */
26
+ | {
27
+ readonly status: "captured";
28
+ readonly job: CapturedJob;
19
29
  };
20
30
  /** A successful outcome carrying the resulting value. */
21
31
  export declare function success<T>(value: T): UseSmileIDResult<T>;
@@ -27,3 +37,4 @@ export declare function failure<T>(error: unknown): UseSmileIDResult<T>;
27
37
  * so cancellation can be handled separately.
28
38
  */
29
39
  export declare function cancelled<T>(): UseSmileIDResult<T>;
40
+ export declare function captured<T>(job: CapturedJob): UseSmileIDResult<T>;
@@ -1 +1 @@
1
- "use strict";export function success(t){return{status:"success",value:t}}export function failure(t){return{status:"failure",error:t}}export function cancelled(){return{status:"cancelled"}}
1
+ "use strict";export function success(t){return{status:"success",value:t}}export function failure(t){return{status:"failure",error:t}}export function cancelled(){return{status:"cancelled"}}export function captured(t){return{status:"captured",job:t}}
@@ -0,0 +1,90 @@
1
+ import type { KameraMetric } from "@smileid/kamera";
2
+ /**
3
+ * The points a capture passes, in order, each timed from the capture screen
4
+ * appearing. The names are the log's, so a run on any platform reads the same.
5
+ */
6
+ export declare const CapturePerfMark: {
7
+ /** The capture screen appeared: the trace's zero. */
8
+ readonly screenShown: "screen_shown";
9
+ /** The screen asked the camera to start. */
10
+ readonly cameraStartRequested: "camera_start_requested";
11
+ /** The camera's start resolved. */
12
+ readonly cameraRunning: "camera_running";
13
+ /** kamera delivered its first frame. */
14
+ readonly firstFrame: "first_frame";
15
+ /** Analysis began: as the camera runs, or on a retry's Start tap. */
16
+ readonly streamingStarted: "streaming_started";
17
+ /** The first frame analysis came back. */
18
+ readonly firstScanResult: "first_scan_result";
19
+ /** The capture reached its terminal captured state. */
20
+ readonly captureComplete: "capture_complete";
21
+ /** The captured images are ready to hand off. */
22
+ readonly filesReady: "files_ready";
23
+ };
24
+ export type CapturePerfMark = (typeof CapturePerfMark)[keyof typeof CapturePerfMark];
25
+ /**
26
+ * How a capture attempt ended, as the log line names it. After `failed`, `retake` or `timeout`, the
27
+ * next attempt gets its own line.
28
+ */
29
+ export type CapturePerfOutcome = "captured" | "gallery" | "failed" | "retake" | "timeout" | "abandoned";
30
+ /** Whether the user can follow `outcome` with another attempt, which gets a fresh trace. */
31
+ export declare function capturePerfOutcomeContinues(outcome: CapturePerfOutcome): boolean;
32
+ /** Median and 95th percentile of some milliseconds, over `count` samples. */
33
+ export type CapturePerfStat = {
34
+ readonly count: number;
35
+ readonly p50Ms: number;
36
+ readonly p95Ms: number;
37
+ };
38
+ /** What one capture measured. */
39
+ export type CapturePerfSnapshot = {
40
+ /** Each mark reached, in milliseconds from `screen_shown`. */
41
+ readonly marks: Readonly<Partial<Record<CapturePerfMark, number>>>;
42
+ /** kamera's own start-to-first-frame, and whether it paid the camera stack's first start. */
43
+ readonly timeToFirstFrameMs?: number;
44
+ readonly coldStart?: boolean;
45
+ /** Take-to-close per analysed frame. */
46
+ readonly analysis?: CapturePerfStat;
47
+ /** How long each analysed frame waited in the frame hub before it was taken. */
48
+ readonly wait?: CapturePerfStat;
49
+ /** The last still's capture-to-result latency. */
50
+ readonly captureLatencyMs?: number;
51
+ };
52
+ /**
53
+ * What one capture attempt measured, as `UseSmileIDDebug.setPerfTraceListener` hands it over: the
54
+ * same as its log line, typed.
55
+ */
56
+ export type CapturePerfReport = CapturePerfSnapshot & {
57
+ /** The capture timed: `selfie`, or `document` and its side (`document front`). */
58
+ readonly capture: string;
59
+ /** How the attempt ended. */
60
+ readonly outcome: CapturePerfOutcome;
61
+ /** The log line: `[UseSmileID perf] <capture> <outcome> mark=ms …`. */
62
+ readonly line: string;
63
+ };
64
+ /**
65
+ * Times one capture screen: the marks it passes plus kamera's metrics. Pure: the
66
+ * screen feeds it and reads {@link CapturePerfTrace.summaryLine} back.
67
+ */
68
+ export declare class CapturePerfTrace {
69
+ private readonly _now;
70
+ private readonly _startedAt;
71
+ private readonly _marks;
72
+ private readonly _analysisMs;
73
+ private readonly _waitMs;
74
+ private _timeToFirstFrameMs;
75
+ private _coldStart;
76
+ private _captureLatencyMs;
77
+ constructor(now?: () => number);
78
+ /** Records `mark` the first time it is reached; a repeat keeps the first. */
79
+ mark(mark: CapturePerfMark): void;
80
+ /** Folds in one kamera metric. */
81
+ onMetric(metric: KameraMetric): void;
82
+ snapshot(): CapturePerfSnapshot;
83
+ /** The attempt's report for `capture` ending with `outcome`, its log line included. */
84
+ report(capture: string, outcome: CapturePerfOutcome): CapturePerfReport;
85
+ /**
86
+ * One log line: `[UseSmileID perf] <label> mark=ms … analysis=p50/p95ms(n) …`, the marks in
87
+ * capture order and only those reached.
88
+ */
89
+ summaryLine(label: string): string;
90
+ }
@@ -0,0 +1 @@
1
+ "use strict";export const CapturePerfMark={screenShown:"screen_shown",cameraStartRequested:"camera_start_requested",cameraRunning:"camera_running",firstFrame:"first_frame",streamingStarted:"streaming_started",firstScanResult:"first_scan_result",captureComplete:"capture_complete",filesReady:"files_ready"};const u=[CapturePerfMark.screenShown,CapturePerfMark.cameraStartRequested,CapturePerfMark.cameraRunning,CapturePerfMark.firstFrame,CapturePerfMark.streamingStarted,CapturePerfMark.firstScanResult,CapturePerfMark.captureComplete,CapturePerfMark.filesReady];export function capturePerfOutcomeContinues(e){return e==="failed"||e==="retake"||e==="timeout"}export class CapturePerfTrace{_now;_startedAt;_marks={};_analysisMs=[];_waitMs=[];_timeToFirstFrameMs;_coldStart;_captureLatencyMs;constructor(t=m){this._now=t,this._startedAt=t(),this._marks[CapturePerfMark.screenShown]=0}mark(t){this._marks[t]===void 0&&(this._marks[t]=Math.max(0,Math.round(this._now()-this._startedAt)))}onMetric(t){switch(t.name){case"firstFrame":if(this._timeToFirstFrameMs!==void 0)return;this.mark(CapturePerfMark.firstFrame),this._timeToFirstFrameMs=t.timeToFirstFrameMs,this._coldStart=t.coldStart;break;case"frameAnalyzed":if(this._marks[CapturePerfMark.streamingStarted]===void 0||this._marks[CapturePerfMark.captureComplete]!==void 0)return;this._analysisMs.push(t.analysisMs),this._waitMs.push(t.waitMs);break;case"captureCompleted":this._captureLatencyMs=t.latencyMs;break}}snapshot(){return{marks:{...this._marks},...this._timeToFirstFrameMs!==void 0?{timeToFirstFrameMs:this._timeToFirstFrameMs}:{},...this._coldStart!==void 0?{coldStart:this._coldStart}:{},...this._analysisMs.length>0?{analysis:n(this._analysisMs)}:{},...this._waitMs.length>0?{wait:n(this._waitMs)}:{},...this._captureLatencyMs!==void 0?{captureLatencyMs:this._captureLatencyMs}:{}}}report(t,s){return{...this.snapshot(),capture:t,outcome:s,line:this.summaryLine(`${t} ${s}`)}}summaryLine(t){const s=this.snapshot(),a=u.filter(r=>s.marks[r]!==void 0).map(r=>`${r}=${s.marks[r]}ms`);return s.timeToFirstFrameMs!==void 0&&a.push(`kamera_first_frame=${s.timeToFirstFrameMs}ms${s.coldStart?"(cold)":""}`),s.analysis&&a.push(`analysis=${c(s.analysis)}`),s.wait&&a.push(`wait=${c(s.wait)}`),s.captureLatencyMs!==void 0&&a.push(`still=${s.captureLatencyMs}ms`),`[UseSmileID perf] ${t} ${a.join(" ")}`}}function m(){const e=globalThis.performance;return e?e.now():Date.now()}function n(e){const t=[...e].sort((s,a)=>s-a);return{count:t.length,p50Ms:i(t,.5),p95Ms:i(t,.95)}}function i(e,t){const s=Math.ceil(t*e.length);return e[Math.min(e.length,Math.max(1,s))-1]??0}function c(e){return`${Math.round(e.p50Ms)}/${Math.round(e.p95Ms)}ms(${e.count})`}
@@ -1 +1 @@
1
- "use strict";import{LogLevel as u}from"../../../core/models/network_config";import{ALWAYS_REDACT as i,ALWAYS_REDACT_BODY_KEYS as p}from"./sensitive_headers";export function attachLoggingInterceptor(e,t){if(!t.enabled||t.level===u.none){const o=e.interceptors.request.use(l=>l),a=e.interceptors.response.use(l=>l);return{request:o,response:a}}const s=new Set(t.redactHeaders.map(o=>o.toLowerCase())),r=e.interceptors.request.use(o=>(m(o,t.level,s),o)),n=e.interceptors.response.use(o=>(b(o,t.level),o),o=>(y(o,t.level),Promise.reject(o)));return{request:r,response:n}}const d=/^([a-z][a-z\d+\-.]*:)?\/\//i;function f(e){const t=e.baseURL??"",s=e.url??"";return!t||d.test(s)?s:s?`${t.replace(/\/+$/,"")}/${s.replace(/^\/+/,"")}`:t}function m(e,t,s){const r=(e.method??"GET").toUpperCase(),n=f(e);if(console.log(`[UseSmileID] \u2192 ${r} ${n}`),t===u.headers||t===u.body){const o=D(e.headers,s);console.log("[UseSmileID] headers:",o)}}function b(e,t){console.log(`[UseSmileID] \u2190 ${e.status} ${e.statusText} ${e.config.url??""}`),t===u.body&&console.log("[UseSmileID] body:",c(e.data))}function y(e,t){const s=e.response?.status??"no-response";console.warn(`[UseSmileID] \u2717 ${s} ${e.config?.url??""} \u2014 ${e.message}`),t===u.body&&e.response&&console.warn("[UseSmileID] body:",c(e.response.data))}const A=6;function c(e,t=0){if(t>=A)return"<depth-limit>";if(Array.isArray(e))return e.map(s=>c(s,t+1));if(e!==null&&typeof e=="object"){const s={};for(const[r,n]of Object.entries(e))s[r]=p.has(r.toLowerCase())?"<redacted>":c(n,t+1);return s}return e}function D(e,t){const s={};for(const[r,n]of Object.entries(e??{})){const o=r.toLowerCase();i.has(o)||t.has(o)?s[r]="<redacted>":s[r]=n}return s}
1
+ "use strict";import{LogLevel as u}from"../../../core/models/network_config";import{ALWAYS_REDACT as d,ALWAYS_REDACT_BODY_KEYS as p}from"./sensitive_headers";import{isDevelopmentBuild as f}from"../../../core/is_development_build";export function attachLoggingInterceptor(e,t){if(!t.enabled||t.level===u.none){const r=e.interceptors.request.use(a=>a),i=e.interceptors.response.use(a=>a);return{request:r,response:i}}const s=new Set(t.redactHeaders.map(r=>r.toLowerCase())),o=t.level===u.body&&!f()?u.headers:t.level,n=e.interceptors.request.use(r=>(y(r,o,s),r)),c=e.interceptors.response.use(r=>(D(r,o),r),r=>(A(r,o),Promise.reject(r)));return{request:n,response:c}}const m=/^([a-z][a-z\d+\-.]*:)?\/\//i;function b(e){const t=e.baseURL??"",s=e.url??"";return!t||m.test(s)?s:s?`${t.replace(/\/+$/,"")}/${s.replace(/^\/+/,"")}`:t}function y(e,t,s){const o=(e.method??"GET").toUpperCase(),n=b(e);if(console.log(`[UseSmileID] \u2192 ${o} ${n}`),t===u.headers||t===u.body){const c=S(e.headers,s);console.log("[UseSmileID] headers:",c)}}function D(e,t){console.log(`[UseSmileID] \u2190 ${e.status} ${e.statusText} ${e.config.url??""}`),t===u.body&&console.log("[UseSmileID] body:",l(e.data))}function A(e,t){const s=e.response?.status??"no-response";console.warn(`[UseSmileID] \u2717 ${s} ${e.config?.url??""} \u2014 ${e.message}`),t===u.body&&e.response&&console.warn("[UseSmileID] body:",l(e.response.data))}const L=6;function l(e,t=0){if(t>=L)return"<depth-limit>";if(Array.isArray(e))return e.map(s=>l(s,t+1));if(e!==null&&typeof e=="object"){const s={};for(const[o,n]of Object.entries(e))s[o]=p.has(o.toLowerCase())?"<redacted>":l(n,t+1);return s}return e}function S(e,t){const s={};for(const[o,n]of Object.entries(e??{})){const c=o.toLowerCase();d.has(c)||t.has(c)?s[o]="<redacted>":s[o]=n}return s}
@@ -1 +1 @@
1
- "use strict";import{sourceSdkIdentifier as t}from"@smileid/usesmileid_bridge";import{currentRequestTimestamp as s}from"../../security/request_timestamp";const n="12.1.1";export class SmileAuthInterceptor{_partnerConfig;_tokenHolder;constructor(e){this._partnerConfig=e.partnerConfig,this._tokenHolder=e.tokenHolder}attach(e){return{request:e.interceptors.request.use(async r=>this._onRequest(r))}}async _onRequest(e){return e.headers.set("smileid-token",this._tokenHolder.current),e.headers.set("smileid-source-sdk",t()),e.headers.set("smileid-source-sdk-version",n),e.headers.set("smileid-partner-id",this._partnerConfig.partnerId),this._partnerConfig.callbackUrl&&e.headers.set("callback-url",this._partnerConfig.callbackUrl),e.headers.set("smileid-request-timestamp",s()),e}}
1
+ "use strict";import{sourceSdkIdentifier as t}from"@smileid/usesmileid_bridge";import{currentRequestTimestamp as s}from"../../security/request_timestamp";const n="12.2.0";export class SmileAuthInterceptor{_partnerConfig;_tokenHolder;constructor(e){this._partnerConfig=e.partnerConfig,this._tokenHolder=e.tokenHolder}attach(e){return{request:e.interceptors.request.use(async r=>this._onRequest(r))}}async _onRequest(e){return e.headers.set("smileid-token",this._tokenHolder.current),e.headers.set("smileid-source-sdk",t()),e.headers.set("smileid-source-sdk-version",n),e.headers.set("smileid-partner-id",this._partnerConfig.partnerId),e.headers.set("smileid-request-timestamp",s()),e}}
@@ -0,0 +1,16 @@
1
+ import type { AxiosAdapter, InternalAxiosRequestConfig } from "axios";
2
+ /**
3
+ * The request the capture client stopped: its config as it would have gone to
4
+ * the wire, after every request interceptor (auth, request-MAC, integrity) ran.
5
+ */
6
+ export declare class CapturedRequest extends Error {
7
+ readonly config: InternalAxiosRequestConfig;
8
+ constructor(config: InternalAxiosRequestConfig);
9
+ }
10
+ /**
11
+ * The capture client's adapter: axios calls it once the request interceptors
12
+ * have run, so it rejects with the signed request instead of sending it. A
13
+ * skipped submission seals its request through this client, so the request it
14
+ * seals is signed exactly as a submission is and never leaves the device.
15
+ */
16
+ export declare const captureAdapter: AxiosAdapter;
@@ -0,0 +1 @@
1
+ "use strict";export class CapturedRequest extends Error{config;constructor(t){super("The request was captured for sealing, not sent"),this.name="CapturedRequest",this.config=t}}export const captureAdapter=e=>Promise.reject(new CapturedRequest(e));
@@ -1,6 +1,6 @@
1
1
  import { type AxiosInstance } from "axios";
2
2
  import type { NetworkConfig, PartnerConfig } from "../../core/models/network_config";
3
- import type { BiometricKycRequest, DocumentVerificationRequest, EnhancedDocumentVerificationRequest, EnhancedKycRequest, SmartSelfieAuthenticationRequest, SmartSelfieEnrollmentRequest } from "../model/job_request";
3
+ import type { BiometricKycRequest, DocumentVerificationRequest, EnhancedDocumentVerificationRequest, ResidencyDocumentVerificationRequest, EnhancedKycRequest, SmartSelfieAuthenticationRequest, SmartSelfieEnrollmentRequest } from "../model/job_request";
4
4
  import { SmileAuthInterceptor } from "./interceptors/smile_auth_interceptor";
5
5
  import { attachLoggingInterceptor } from "./interceptors/logging_interceptor";
6
6
  import type { JobSubmissionResponse } from "../model/job_submission_response";
@@ -54,6 +54,7 @@ export declare class SmileIDAPI {
54
54
  biometricKyc(request: BiometricKycRequest): Promise<JobSubmissionResponse>;
55
55
  documentVerification(request: DocumentVerificationRequest): Promise<JobSubmissionResponse>;
56
56
  enhancedDocumentVerification(request: EnhancedDocumentVerificationRequest): Promise<JobSubmissionResponse>;
57
+ residencyDocumentVerification(request: ResidencyDocumentVerificationRequest): Promise<JobSubmissionResponse>;
57
58
  private _postDocumentVerification;
58
59
  /**
59
60
  * Build the selfie + liveness portion of a multipart form. No
@@ -65,7 +66,7 @@ export declare class SmileIDAPI {
65
66
  *
66
67
  * `expectedLivenessCount` is the expected number of liveness frames
67
68
  * for this submission — derived from the decoded `sdk_config` claim
68
- * when present, otherwise the `ScanPerformanceProfile` default (7).
69
+ * when present, otherwise the native default (7).
69
70
  */
70
71
  private _buildSelfieFormData;
71
72
  /**
@@ -83,20 +84,13 @@ export declare class SmileIDAPI {
83
84
  * `id_number`, `country`). PII fields move into the `user_details`
84
85
  * JSON part; partner-supplied per-job overrides (`callback_url`,
85
86
  * `partner_params`, `use_enrolled_image`) are appended by the
86
- * endpoint-specific path.
87
+ * endpoint-specific path. A blank field is one the token binds:
88
+ * assembly blanked it, so its part is omitted and the server injects it.
87
89
  */
88
90
  private _appendIdFields;
89
91
  /**
90
- * Append the partner-config-level `callback_url` + `partner_params`
91
- * multipart parts on Enhanced KYC submissions. Biometric KYC has its
92
- * own per-job override path that already prefers `request.params.*`
93
- * over the partner config and is handled inline; this helper covers
94
- * the no-per-job-override case for Enhanced KYC.
95
- *
96
- * `callback_url` rides as a string part; `partner_params` as a JSON
97
- * part. The `callback-url` HTTP header (attached by
98
- * `SmileAuthInterceptor`) is independent and is preserved on every
99
- * request regardless of this helper.
92
+ * Append the partner-config-level `callback_url` + `partner_params` parts.
93
+ * Called on every product; a blank `callbackUrl` omits its part.
100
94
  */
101
95
  private _appendPartnerConfigParts;
102
96
  /**
@@ -1 +1 @@
1
- "use strict";import u from"axios";import{SmileIDUrls as d}from"../smile_id_urls";import{userDetailsPayloadToWire as g}from"../model/user_details_payload";import{SmileAuthInterceptor as h}from"./interceptors/smile_auth_interceptor";import{attachLoggingInterceptor as y}from"./interceptors/logging_interceptor";import{REQUEST_MAC_OPT_IN_KEY as b}from"./interceptors/smile_request_mac_interceptor";import{ATTESTATION_OPT_IN_KEY as S}from"./interceptors/smile_integrity_interceptor";import{NetworkResponseParseException as m}from"../../core/exception";import{LivenessFrameCountException as C}from"../../core/exception";const l=d.production,_=d.sandbox,P={[b]:!0,[S]:!0};export class SmileIDAPI{_client;_partnerConfig;constructor(t,n){this._client=t,this._partnerConfig=n}async smartSelfieEnrollment(t){const n=this._buildSelfieFormData(t);return r(n,t),this._appendPartnerConfigParts(n),this._appendConsentAndMetadata(n,t.consent,t.metadata),this._postMultipart("/v3/registration",n)}async smartSelfieAuthentication(t){const n=this._buildSelfieFormData(t);return i(n,"user_id",t.userId),r(n,t),this._appendPartnerConfigParts(n),this._appendConsentAndMetadata(n,t.consent,t.metadata),this._postMultipart("/v3/authentication",n)}async enhancedKyc(t){const n=new FormData;return this._appendIdFields(n,t.params),r(n,t),t.params.bankCode&&i(n,"bank_code",t.params.bankCode),t.params.mobileOperator&&i(n,"operator",t.params.mobileOperator),this._appendPartnerConfigParts(n),this._appendConsentAndMetadata(n,t.consent,t.metadata),this._postMultipart("/v3/enhanced_kyc",n)}async biometricKyc(t){const n=t.params.useEnrolledImage,e=this._buildSelfieFormData(t);return this._appendIdFields(e,t.params),r(e,t),n&&i(e,"use_enrolled_image","true"),this._appendPartnerConfigParts(e),this._appendConsentAndMetadata(e,t.consent,t.metadata),this._postMultipart("/v3/biometric_kyc",e)}async documentVerification(t){return this._postDocumentVerification(t,"/v3/document_verification")}async enhancedDocumentVerification(t){return this._postDocumentVerification(t,"/v3/enhanced_document_verification")}async _postDocumentVerification(t,n){const e=this._buildSelfieFormData(t);return p(e,"document",t.frontDocument),t.backDocument&&p(e,"document_back",t.backDocument),i(e,"country",t.country),t.idType&&i(e,"id_type",t.idType),r(e,t),this._appendPartnerConfigParts(e),this._appendConsentAndMetadata(e,t.consent,t.metadata),this._postMultipart(n,e)}_buildSelfieFormData(t){SmileIDAPI._validateLivenessCount(t.livenessImages,t.expectedLivenessImageCount);const n=new FormData;p(n,"selfie_image",t.selfieImage);for(const e of t.livenessImages)p(n,"liveness_images",e);return n}static _validateLivenessCount(t,n){if(t.length!==n)throw new C({expected:n,actual:t.length})}_appendIdFields(t,n){i(t,"id_type",n.idType),i(t,"id_number",n.idNumber),i(t,"country",n.country)}_appendPartnerConfigParts(t){const n=this._partnerConfig.callbackUrl;n&&i(t,"callback_url",n);const e=this._partnerConfig.partnerParams;e&&s(t,"partner_params",e)}_appendConsentAndMetadata(t,n,e){n!==void 0&&s(t,"consent",{granted:n.granted,granted_at:n.grantedAt,notice_language:n.noticeLanguage,notice_privacy_policy_url:n.noticePrivacyPolicyUrl}),s(t,"metadata",e.toEntries())}async _postMultipart(t,n){const e=await this._client.post(t,n,{headers:{"Content-Type":"multipart/form-data"},...P});return D(e.data)}}function D(a){if(a==null||typeof a!="object"||Array.isArray(a))throw new m({message:"SmileIDAPI: server returned an empty or non-object response body."});const t=a,n=(c,f)=>{if(typeof c!="string")throw new m({message:`SmileIDAPI: response is missing the required string field '${f}'.`});return c},e={jobId:n(t.job_id??t.jobId,"job_id"),userId:n(t.user_id??t.userId,"user_id"),status:n(t.status,"status"),message:n(t.message,"message")},o=t.created_at??t.createdAt;return typeof o=="string"&&o.length>0?{...e,createdAt:o}:e}function r(a,t){const n=t.userDetails;if(n===void 0)return;const e=g(n);Object.keys(e).length!==0&&s(a,"user_details",e)}function i(a,t,n){a.append(t,n)}function s(a,t,n){const e=JSON.stringify(n);a.append(t,e)}function p(a,t,n){const e=n.split("/").pop()??`${t}.jpg`;a.append(t,{uri:n,name:e,type:"image/jpeg"})}export function buildAxiosClient(a){const e=a.config?.partnerConfig?.useSandbox??!0?_:l,o=a.timeouts?.call??120;return u.create({baseURL:e,timeout:o*1e3})}export{h as SmileAuthInterceptor,y as attachLoggingInterceptor,l as PROD_BASE_URL,_ as SANDBOX_BASE_URL};
1
+ "use strict";import u from"axios";import{SmileIDUrls as d}from"../smile_id_urls";import{userDetailsPayloadToWire as g}from"../model/user_details_payload";import{SmileAuthInterceptor as h}from"./interceptors/smile_auth_interceptor";import{attachLoggingInterceptor as y}from"./interceptors/logging_interceptor";import{REQUEST_MAC_OPT_IN_KEY as b}from"./interceptors/smile_request_mac_interceptor";import{ATTESTATION_OPT_IN_KEY as D}from"./interceptors/smile_integrity_interceptor";import{NetworkResponseParseException as m}from"../../core/exception";import{LivenessFrameCountException as S}from"../../core/exception";const l=d.production,_=d.sandbox,C={[b]:!0,[D]:!0};export class SmileIDAPI{_client;_partnerConfig;constructor(t,n){this._client=t,this._partnerConfig=n}async smartSelfieEnrollment(t){const n=this._buildSelfieFormData(t);return r(n,t),this._appendPartnerConfigParts(n),this._appendConsentAndMetadata(n,t.consent,t.metadata),this._postMultipart("/v3/registration",n)}async smartSelfieAuthentication(t){const n=this._buildSelfieFormData(t);return i(n,"user_id",t.userId),r(n,t),this._appendPartnerConfigParts(n),this._appendConsentAndMetadata(n,t.consent,t.metadata),this._postMultipart("/v3/authentication",n)}async enhancedKyc(t){const n=new FormData;return this._appendIdFields(n,t.params),r(n,t),t.params.bankCode&&i(n,"bank_code",t.params.bankCode),t.params.mobileOperator&&i(n,"operator",t.params.mobileOperator),this._appendPartnerConfigParts(n),this._appendConsentAndMetadata(n,t.consent,t.metadata),this._postMultipart("/v3/enhanced_kyc",n)}async biometricKyc(t){const n=t.params.useEnrolledImage,e=this._buildSelfieFormData(t);return this._appendIdFields(e,t.params),r(e,t),n&&i(e,"use_enrolled_image","true"),this._appendPartnerConfigParts(e),this._appendConsentAndMetadata(e,t.consent,t.metadata),this._postMultipart("/v3/biometric_kyc",e)}async documentVerification(t){return this._postDocumentVerification(t,"/v3/document_verification")}async enhancedDocumentVerification(t){return this._postDocumentVerification(t,"/v3/enhanced_document_verification")}async residencyDocumentVerification(t){return this._postDocumentVerification(t,"/v3/residency_document_verification")}async _postDocumentVerification(t,n){const e=this._buildSelfieFormData(t);return s(e,"document",t.frontDocument),"backDocument"in t&&t.backDocument&&s(e,"document_back",t.backDocument),"visaDocument"in t&&s(e,"visa",t.visaDocument),t.country&&i(e,"country",t.country),t.idType&&i(e,"id_type",t.idType),r(e,t),this._appendPartnerConfigParts(e),this._appendConsentAndMetadata(e,t.consent,t.metadata),this._postMultipart(n,e)}_buildSelfieFormData(t){SmileIDAPI._validateLivenessCount(t.livenessImages,t.expectedLivenessImageCount);const n=new FormData;s(n,"selfie_image",t.selfieImage);for(const e of t.livenessImages)s(n,"liveness_images",e);return n}static _validateLivenessCount(t,n){if(t.length!==n)throw new S({expected:n,actual:t.length})}_appendIdFields(t,n){n.idType&&i(t,"id_type",n.idType),n.idNumber&&i(t,"id_number",n.idNumber),n.country&&i(t,"country",n.country)}_appendPartnerConfigParts(t){const n=this._partnerConfig.callbackUrl;n&&i(t,"callback_url",n);const e=this._partnerConfig.partnerParams;e&&Object.keys(e).length>0&&c(t,"partner_params",e)}_appendConsentAndMetadata(t,n,e){n!==void 0&&c(t,"consent",{granted:n.granted,granted_at:n.grantedAt,notice_language:n.noticeLanguage,notice_privacy_policy_url:n.noticePrivacyPolicyUrl}),c(t,"metadata",e.toEntries())}async _postMultipart(t,n){const e=await this._client.post(t,n,{headers:{"Content-Type":"multipart/form-data"},...C});return P(e.data)}}function P(a){if(a==null||typeof a!="object"||Array.isArray(a))throw new m({message:"SmileIDAPI: server returned an empty or non-object response body."});const t=a,n=(p,f)=>{if(typeof p!="string")throw new m({message:`SmileIDAPI: response is missing the required string field '${f}'.`});return p},e={jobId:n(t.job_id??t.jobId,"job_id"),userId:n(t.user_id??t.userId,"user_id"),status:n(t.status,"status"),message:n(t.message,"message")},o=t.created_at??t.createdAt;return typeof o=="string"&&o.length>0?{...e,createdAt:o}:e}function r(a,t){const n=t.userDetails;if(n===void 0)return;const e=g(n);Object.keys(e).length!==0&&c(a,"user_details",e)}function i(a,t,n){a.append(t,n)}function c(a,t,n){const e=JSON.stringify(n);a.append(t,e)}function s(a,t,n){const e=n.split("/").pop()??`${t}.jpg`;a.append(t,{uri:n,name:e,type:"image/jpeg"})}export function buildAxiosClient(a){const e=a.config?.partnerConfig?.useSandbox??!0?_:l,o=a.timeouts?.call??120;return u.create({baseURL:e,timeout:o*1e3})}export{h as SmileAuthInterceptor,y as attachLoggingInterceptor,l as PROD_BASE_URL,_ as SANDBOX_BASE_URL};
@@ -27,14 +27,22 @@ export declare class CompressibleAssets {
27
27
  readonly liveness: readonly CompressibleAsset[];
28
28
  readonly documentFront: CompressibleAsset | undefined;
29
29
  readonly documentBack: CompressibleAsset | undefined;
30
+ /** Supporting visa page; a submission carries a back or a visa image, never both. */
31
+ readonly documentVisa: CompressibleAsset | undefined;
30
32
  constructor(args: {
31
33
  selfie?: CompressibleAsset | undefined;
32
34
  liveness?: readonly CompressibleAsset[] | undefined;
33
35
  documentFront?: CompressibleAsset | undefined;
34
36
  documentBack?: CompressibleAsset | undefined;
37
+ documentVisa?: CompressibleAsset | undefined;
35
38
  });
36
39
  /** All present assets, in submission order. */
37
40
  all(): CompressibleAsset[];
38
- /** Combined size of the front + back document images (0 when neither is present). */
41
+ /** Combined size of every document image in the submission (0 when none is present). */
39
42
  documentCombinedSize(): number;
43
+ /**
44
+ * The submission's secondary document image — the back side or the visa page.
45
+ * Compression reduces it before the primary front page.
46
+ */
47
+ get documentSupporting(): CompressibleAsset | undefined;
40
48
  }
@@ -1 +1 @@
1
- "use strict";export class CompressibleAssets{selfie;liveness;documentFront;documentBack;constructor(e){this.selfie=e.selfie,this.liveness=e.liveness??[],this.documentFront=e.documentFront,this.documentBack=e.documentBack}all(){const e=[];return this.selfie&&e.push(this.selfie),e.push(...this.liveness),this.documentFront&&e.push(this.documentFront),this.documentBack&&e.push(this.documentBack),e}documentCombinedSize(){return(this.documentFront?.encodedSize()??0)+(this.documentBack?.encodedSize()??0)}}
1
+ "use strict";export class CompressibleAssets{selfie;liveness;documentFront;documentBack;documentVisa;constructor(e){this.selfie=e.selfie,this.liveness=e.liveness??[],this.documentFront=e.documentFront,this.documentBack=e.documentBack,this.documentVisa=e.documentVisa}all(){const e=[];return this.selfie&&e.push(this.selfie),e.push(...this.liveness),this.documentFront&&e.push(this.documentFront),this.documentBack&&e.push(this.documentBack),this.documentVisa&&e.push(this.documentVisa),e}documentCombinedSize(){return(this.documentFront?.encodedSize()??0)+(this.documentBack?.encodedSize()??0)+(this.documentVisa?.encodedSize()??0)}get documentSupporting(){return this.documentBack??this.documentVisa}}
@@ -17,6 +17,8 @@ export interface PayloadCompressionSizes {
17
17
  readonly frontFinalMb?: number | undefined;
18
18
  readonly backOriginalMb?: number | undefined;
19
19
  readonly backFinalMb?: number | undefined;
20
+ readonly visaOriginalMb?: number | undefined;
21
+ readonly visaFinalMb?: number | undefined;
20
22
  }
21
23
  /**
22
24
  * Builds `CompressibleAssets` from a submission's captured JPEG URIs and runs `PayloadCompressor`
@@ -30,6 +32,7 @@ export declare const PayloadCompressionRunner: {
30
32
  livenessImages?: readonly string[] | undefined;
31
33
  frontDocument?: string | undefined;
32
34
  backDocument?: string | undefined;
35
+ visaDocument?: string | undefined;
33
36
  metadataBytes: number;
34
37
  sdkConfig?: SdkConfig | undefined;
35
38
  }): Promise<PayloadCompressionSizes>;
@@ -1 +1 @@
1
- "use strict";import{File as u}from"expo-file-system";import{ImageType as n}from"@smileid/usesmileid_bridge";import{CameraDefaults as l}from"../../camera/camera_defaults";import{resolveJpegQuality as r}from"../model/sdk_config_capture";import{CompressibleAssets as a}from"./compressible_asset";import{PayloadCompressor as d}from"./payload_compressor";import{UriCompressibleAsset as s}from"./uri_compressible_asset";const p=.95,b=.8;export function resolveCaptureQuality(e,o){const[m,c]=o===n.Selfie?[e?.selfie,p]:o===n.Liveness?[e?.liveness,b]:[e?.document,l.documentJpegQuality],i=r(m);return i===void 0?c:i/100}const D=1024*1024;function t(e){if(e===void 0)return;const o=new u(e).size??0;return o>0?o/D:void 0}export const PayloadCompressionRunner={async compress(e){const o=t(e.selfieImage),m=t(e.frontDocument),c=t(e.backDocument),i=new a({selfie:e.selfieImage?new s(n.Selfie,e.selfieImage,resolveCaptureQuality(e.sdkConfig,n.Selfie)):void 0,liveness:(e.livenessImages??[]).map(f=>new s(n.Liveness,f,resolveCaptureQuality(e.sdkConfig,n.Liveness))),documentFront:e.frontDocument?new s(n.DocumentFront,e.frontDocument,resolveCaptureQuality(e.sdkConfig,n.DocumentFront)):void 0,documentBack:e.backDocument?new s(n.DocumentBack,e.backDocument,resolveCaptureQuality(e.sdkConfig,n.DocumentBack)):void 0});return await d.prepareBundleForTransmission(i,e.metadataBytes),{selfieOriginalMb:o,selfieFinalMb:t(e.selfieImage),frontOriginalMb:m,frontFinalMb:t(e.frontDocument),backOriginalMb:c,backFinalMb:t(e.backDocument)}}};
1
+ "use strict";import{File as l}from"expo-file-system";import{ImageType as n}from"@smileid/usesmileid_bridge";import{CameraDefaults as a}from"../../camera/camera_defaults";import{resolveJpegQuality as r}from"../model/sdk_config_capture";import{CompressibleAssets as d}from"./compressible_asset";import{PayloadCompressor as p}from"./payload_compressor";import{UriCompressibleAsset as i}from"./uri_compressible_asset";const b=.95,D=.8;export function resolveCaptureQuality(e,t){const[s,c]=t===n.Selfie?[e?.selfie,b]:t===n.Liveness?[e?.liveness,D]:[e?.document,a.documentJpegQuality],m=r(s);return m===void 0?c:m/100}const v=1024*1024;function o(e){if(e===void 0)return;const t=new l(e).size??0;return t>0?t/v:void 0}export const PayloadCompressionRunner={async compress(e){const t=o(e.selfieImage),s=o(e.frontDocument),c=o(e.backDocument),m=o(e.visaDocument),u=new d({selfie:e.selfieImage?new i(n.Selfie,e.selfieImage,resolveCaptureQuality(e.sdkConfig,n.Selfie)):void 0,liveness:(e.livenessImages??[]).map(f=>new i(n.Liveness,f,resolveCaptureQuality(e.sdkConfig,n.Liveness))),documentFront:e.frontDocument?new i(n.DocumentFront,e.frontDocument,resolveCaptureQuality(e.sdkConfig,n.DocumentFront)):void 0,documentBack:e.backDocument?new i(n.DocumentBack,e.backDocument,resolveCaptureQuality(e.sdkConfig,n.DocumentBack)):void 0,documentVisa:e.visaDocument?new i(n.DocumentVisa,e.visaDocument,resolveCaptureQuality(e.sdkConfig,n.DocumentVisa)):void 0});return await p.prepareBundleForTransmission(u,e.metadataBytes),{selfieOriginalMb:t,selfieFinalMb:o(e.selfieImage),frontOriginalMb:s,frontFinalMb:o(e.frontDocument),backOriginalMb:c,backFinalMb:o(e.backDocument),visaOriginalMb:m,visaFinalMb:o(e.visaDocument)}}};
@@ -1 +1 @@
1
- "use strict";import{base64Len as d,PayloadCompressionConfig as i}from"./payload_compression_config";export const PayloadCompressor={rawBundleSize(e,o){return e.all().reduce((n,r)=>n+r.encodedSize(),0)+o},projectedEncodedSize(e,o){return e.all().reduce((n,r)=>n+d(r.encodedSize()),0)+o+i.structuralOverheadBytes},buildCompressionPlan(e){const o=[],n=e.selfie?.encodedSize()??0,r=e.documentCombinedSize();if(e.selfie&&n>i.selfieTrigger){o.push([e.selfie,i.faceMinQ]);for(const c of e.liveness)o.push([c,i.faceMinQ]);e.documentBack&&o.push([e.documentBack,i.docMinQ]),e.documentFront&&o.push([e.documentFront,i.docMinQ])}else if(r>i.docCombinedTrigger){e.documentBack&&o.push([e.documentBack,i.docMinQ]),e.documentFront&&o.push([e.documentFront,i.docMinQ]),e.selfie&&o.push([e.selfie,i.faceMinQ]);for(const c of e.liveness)o.push([c,i.faceMinQ])}else{e.selfie&&o.push([e.selfie,i.faceMinQ]);for(const c of e.liveness)o.push([c,i.faceMinQ]);e.documentBack&&o.push([e.documentBack,i.docMinQ]),e.documentFront&&o.push([e.documentFront,i.docMinQ])}return o},async prepareBundleForTransmission(e,o){if(!(this.projectedEncodedSize(e,o)<=i.hardEncodedCap&&this.rawBundleSize(e,o)<=i.rawTarget)){if(e.documentCombinedSize()>i.docCombinedTrigger){const n=[e.documentBack,e.documentFront].filter(r=>r!==void 0);await this._compressGroupToTarget(n,i.docMinQ,i.docCombinedTarget,()=>e.documentCombinedSize())}for(const[n,r]of this.buildCompressionPlan(e)){for(;this.rawBundleSize(e,o)>i.rawTarget&&n.quality()>r;)await n.recompress(Math.max(r,n.quality()-i.qualityStep));if(this.rawBundleSize(e,o)<=i.rawTarget)return}for(const[n]of this.buildCompressionPlan(e)){for(;this._overRelaxedCap(e,o)&&n.quality()>i.absoluteMinQ;)await n.recompress(Math.max(i.absoluteMinQ,n.quality()-i.qualityStep));if(!this._overRelaxedCap(e,o))return}}},_overRelaxedCap(e,o){return this.rawBundleSize(e,o)>i.rawFallback||this.projectedEncodedSize(e,o)>i.hardEncodedCap},async _compressGroupToTarget(e,o,n,r){for(const c of e){for(;r()>n&&c.quality()>o;)await c.recompress(Math.max(o,c.quality()-i.qualityStep));if(r()<=n)return}}};
1
+ "use strict";import{base64Len as d,PayloadCompressionConfig as i}from"./payload_compression_config";export const PayloadCompressor={rawBundleSize(o,e){return o.all().reduce((n,r)=>n+r.encodedSize(),0)+e},projectedEncodedSize(o,e){return o.all().reduce((n,r)=>n+d(r.encodedSize()),0)+e+i.structuralOverheadBytes},buildCompressionPlan(o){const e=[],n=o.selfie?.encodedSize()??0,r=o.documentCombinedSize();if(o.selfie&&n>i.selfieTrigger){e.push([o.selfie,i.faceMinQ]);for(const u of o.liveness)e.push([u,i.faceMinQ]);o.documentSupporting&&e.push([o.documentSupporting,i.docMinQ]),o.documentFront&&e.push([o.documentFront,i.docMinQ])}else if(r>i.docCombinedTrigger){o.documentSupporting&&e.push([o.documentSupporting,i.docMinQ]),o.documentFront&&e.push([o.documentFront,i.docMinQ]),o.selfie&&e.push([o.selfie,i.faceMinQ]);for(const u of o.liveness)e.push([u,i.faceMinQ])}else{o.selfie&&e.push([o.selfie,i.faceMinQ]);for(const u of o.liveness)e.push([u,i.faceMinQ]);o.documentSupporting&&e.push([o.documentSupporting,i.docMinQ]),o.documentFront&&e.push([o.documentFront,i.docMinQ])}return e},async prepareBundleForTransmission(o,e){if(!(this.projectedEncodedSize(o,e)<=i.hardEncodedCap&&this.rawBundleSize(o,e)<=i.rawTarget)){if(o.documentCombinedSize()>i.docCombinedTrigger){const n=[o.documentSupporting,o.documentFront].filter(r=>r!==void 0);await this._compressGroupToTarget(n,i.docMinQ,i.docCombinedTarget,()=>o.documentCombinedSize())}for(const[n,r]of this.buildCompressionPlan(o)){for(;this.rawBundleSize(o,e)>i.rawTarget&&n.quality()>r;)await n.recompress(Math.max(r,n.quality()-i.qualityStep));if(this.rawBundleSize(o,e)<=i.rawTarget)return}for(const[n]of this.buildCompressionPlan(o)){for(;this._overRelaxedCap(o,e)&&n.quality()>i.absoluteMinQ;)await n.recompress(Math.max(i.absoluteMinQ,n.quality()-i.qualityStep));if(!this._overRelaxedCap(o,e))return}}},_overRelaxedCap(o,e){return this.rawBundleSize(o,e)>i.rawFallback||this.projectedEncodedSize(o,e)>i.hardEncodedCap},async _compressGroupToTarget(o,e,n,r){for(const u of o){for(;r()>n&&u.quality()>e;)await u.recompress(Math.max(e,u.quality()-i.qualityStep));if(r()<=n)return}}};
@@ -45,8 +45,12 @@ import type { MetadataProvider } from "../../metadata/use_smile_id_metadata_fact
45
45
  * the request-path order so the LIFO unwind lands on the canonical
46
46
  * order described above.
47
47
  */
48
- export declare function makeNetworkingFactory(config: NetworkConfig, signingSecret?: () => string): {
48
+ export declare function makeNetworkingFactory(config: NetworkConfig, signingSecret?: () => string, options?: {
49
+ readonly capturing?: boolean;
50
+ }): {
49
51
  readonly api: SmileIDAPI;
50
52
  readonly client: AxiosInstance;
51
53
  readonly metadata: MetadataProvider;
52
54
  };
55
+ /** Mirrors the server's resolver: blank, a callback ID, or an absolute http(s) URL with a host. */
56
+ export declare function isResolvableCallbackUrl(value: string): boolean;
@@ -1 +1 @@
1
- "use strict";import{SmileIDAPI as I,buildAxiosClient as l,SmileAuthInterceptor as u,attachLoggingInterceptor as d}from"../api/smile_id_api";import{createGzipInterceptor as k}from"../api/interceptors/gzip_interceptor";import{SmileRequestMacInterceptor as y}from"../api/interceptors/smile_request_mac_interceptor";import{SmileIntegrityInterceptor as w}from"../api/interceptors/smile_integrity_interceptor";import{TokenRefreshInterceptor as S}from"../api/interceptors/token_refresh_interceptor";import{TokenHolder as C}from"../api/auth/token_holder";import{SmileIDCryptoManager as P}from"../security/smile_id_crypto_manager";import{SecurityPolicy as M}from"../security/security_policy";import{decodeSecurityPolicyBitCode as A}from"../util/use_smile_id_token_decoder";import{Attestation as T}from"@smileid/usesmileid_bridge";import{SigningSecretProvider as x}from"@smileid/usesmileid_bridge/internal";import{MissingPartnerConfigException as n}from"../../core/exception";import{UseSmileIDMetadataFactory as F}from"../../metadata/use_smile_id_metadata_factory";export function makeNetworkingFactory(t,m=()=>x.signingSecret()){const r=t.config?.partnerConfig;if(!r||r.partnerId.trim()==="")throw n.missingPartnerId();if(!t.config?.token||t.config.token.trim()==="")throw n.missingAuthToken();const i=/[\u0000-\u001F\u007F-\u009F]/;if(i.test(r.partnerId))throw n.controlCharacterPartnerId();if(i.test(t.config.token))throw n.controlCharacterAuthToken();const e=l(t),s=new F,f=new I(e,r);T.warmUp().catch(()=>{});const c=new C(t.config?.token??""),a=M.fromBitCode(A(t.config?.token??""));k().attach(e);const p=t.config?.logging;p&&d(e,p),new w({securityPolicy:a}).attach(e);const g=new P(m());if(new y({cryptoManager:g,securityPolicy:a}).attach(e),new u({partnerConfig:r,tokenHolder:c}).attach(e),new S({tokenHolder:c,onTokenExpired:t.config?.onTokenExpired}).attach(e),t.interceptors)for(const h of t.interceptors){const o=h;typeof o=="function"?o(e):typeof o?.attach=="function"&&o.attach(e)}return{api:f,client:e,metadata:s}}
1
+ "use strict";import{SmileIDAPI as I,buildAxiosClient as d,SmileAuthInterceptor as k,attachLoggingInterceptor as y}from"../api/smile_id_api";import{createGzipInterceptor as w}from"../api/interceptors/gzip_interceptor";import{captureAdapter as C}from"../api/request_capture";import{SmileRequestMacInterceptor as S}from"../api/interceptors/smile_request_mac_interceptor";import{SmileIntegrityInterceptor as A}from"../api/interceptors/smile_integrity_interceptor";import{TokenRefreshInterceptor as P}from"../api/interceptors/token_refresh_interceptor";import{TokenHolder as F}from"../api/auth/token_holder";import{SmileIDCryptoManager as T}from"../security/smile_id_crypto_manager";import{SecurityPolicy as b}from"../security/security_policy";import{decodeSecurityPolicyBitCode as x}from"../util/use_smile_id_token_decoder";import{Attestation as M}from"@smileid/usesmileid_bridge";import{SigningSecretProvider as R}from"@smileid/usesmileid_bridge/internal";import{MissingPartnerConfigException as c}from"../../core/exception";import{UseSmileIDMetadataFactory as E}from"../../metadata/use_smile_id_metadata_factory";export function makeNetworkingFactory(t,o=()=>R.signingSecret(),a={}){const e=t.config?.partnerConfig;if(!e||e.partnerId.trim()==="")throw c.missingPartnerId();if(!t.config?.token||t.config.token.trim()==="")throw c.missingAuthToken();const n=/[\u0000-\u001F\u007F-\u009F]/;if(n.test(e.partnerId))throw c.controlCharacterPartnerId();if(n.test(t.config.token))throw c.controlCharacterAuthToken();if(!isResolvableCallbackUrl(e.callbackUrl??""))throw c.unresolvableCallbackUrl();const i=a.capturing===!0,r=d(t);i&&(r.defaults.adapter=C);const u=new E,h=new I(r,e);i||M.warmUp().catch(()=>{});const p=new F(t.config?.token??""),f=b.fromBitCode(x(t.config?.token??""));i||w().attach(r);const m=t.config?.logging;m&&!i&&y(r,m),new A({securityPolicy:f}).attach(r);const g=new T(o());if(new S({cryptoManager:g,securityPolicy:f}).attach(r),new k({partnerConfig:e,tokenHolder:p}).attach(r),new P({tokenHolder:p,onTokenExpired:t.config?.onTokenExpired}).attach(r),t.interceptors&&!i)for(const l of t.interceptors){const s=l;typeof s=="function"?s(r):typeof s?.attach=="function"&&s.attach(r)}return{api:h,client:r,metadata:u}}const U=/^callback_[0-9a-hjkmnp-tv-z]{26}$/;export function isResolvableCallbackUrl(t){if(t===""||U.test(t))return!0;const o=t.indexOf("://");if(o<=0)return!1;const a=t.slice(0,o).toLowerCase();if(a!=="http"&&a!=="https")return!1;const n=((t.slice(o+3).split(/[/?#]/)[0]??"").split("@").pop()??"").split(":")[0]??"";return n!==""&&!/[\s\u0000-\u001F\u007F-\u009F]/.test(n)}
@@ -0,0 +1,49 @@
1
+ import type { JobRequest } from "./job_request";
2
+ import type { SealedJobRequest } from "./sealed_job_request";
3
+ /**
4
+ * Everything the flow captured for a job that was handed back instead of
5
+ * submitted (`c.skipApiSubmission = true`). Forward it to Smile ID from your
6
+ * own backend: send the job type's `/v3` request with `headers` as request
7
+ * headers, the images as their usual form parts, and `encryptedPackage`,
8
+ * `packageNonce` and `packageTag` as the `encrypted_package`, `package_nonce`
9
+ * and `package_tag` form fields.
10
+ *
11
+ * Everything else the SDK would have sent (the consent record, the metadata,
12
+ * the signature and the other `smileid-*` headers) travels inside
13
+ * `encryptedPackage`, encrypted for Smile ID: forward it as is, since the
14
+ * server rejects a package that was changed. The image files must
15
+ * reach the server byte-for-byte too, since they carry an integrity seal that
16
+ * a re-encode invalidates. The SDK deletes neither the files nor
17
+ * `sessionDirectory` in this mode: once the job has been forwarded, delete
18
+ * every file it lists, then `sessionDirectory` and everything left in it.
19
+ * `sessionDirectory` is the SDK's session folder holding every listed file,
20
+ * and absent when they don't share one (the capture sessions can store them
21
+ * apart), the folder isn't one of the SDK's own, or the job captured no files
22
+ * (Enhanced KYC). A document imported from the gallery or taken with the manual
23
+ * shutter lives in the app's cache, which the OS may clear under storage
24
+ * pressure, so forward such a job promptly.
25
+ */
26
+ export type CapturedJob = {
27
+ readonly jobType: JobRequest["jobType"];
28
+ readonly sessionId: string;
29
+ readonly sessionDirectory?: string;
30
+ readonly selfieImage?: string;
31
+ readonly livenessImages: readonly string[];
32
+ readonly frontDocument?: string;
33
+ readonly backDocument?: string;
34
+ /** The visa page of a Residency Document Verification job, sent as the `visa` part. */
35
+ readonly visaDocument?: string;
36
+ /** `smileid-token`, `smileid-source-sdk` and `smileid-source-sdk-version`, to send as they are. */
37
+ readonly headers: Readonly<Record<string, string>>;
38
+ /** The sealed request, hex-encoded; the `encrypted_package` form field. */
39
+ readonly encryptedPackage: string;
40
+ /** The package's AES-GCM nonce, hex-encoded; the `package_nonce` form field. */
41
+ readonly packageNonce: string;
42
+ /** The package's AES-GCM authentication tag, hex-encoded; the `package_tag` form field. */
43
+ readonly packageTag: string;
44
+ };
45
+ /**
46
+ * The partner-facing hand-over of `request`: the files its legs produced and
47
+ * the `sealed` request, with nothing the partner supplied echoed back.
48
+ */
49
+ export declare function capturedJobFrom(request: JobRequest, sessionId: string, sealed: SealedJobRequest): CapturedJob;
@@ -0,0 +1 @@
1
+ "use strict";import{JobType as t}from"../../core/models/job_type";export function capturedJobFrom(e,a,c){const n=m(e),i=r([n.selfieImage,...n.livenessImages,n.frontDocument,n.backDocument,n.visaDocument]);return Object.freeze({jobType:e.jobType,sessionId:a,...i!==void 0?{sessionDirectory:i}:{},...n.selfieImage!==void 0?{selfieImage:n.selfieImage}:{},livenessImages:Object.freeze([...n.livenessImages]),...n.frontDocument!==void 0?{frontDocument:n.frontDocument}:{},...n.backDocument!==void 0?{backDocument:n.backDocument}:{},...n.visaDocument!==void 0?{visaDocument:n.visaDocument}:{},headers:c.headers,encryptedPackage:c.encryptedPackage,packageNonce:c.packageNonce,packageTag:c.packageTag})}function m(e){switch(e.jobType){case t.smartSelfieEnrollment:case t.smartSelfieAuthentication:case t.biometricKyc:return{selfieImage:e.selfieImage,livenessImages:e.livenessImages};case t.documentVerification:case t.enhancedDocumentVerification:return{selfieImage:e.selfieImage,livenessImages:e.livenessImages,frontDocument:e.frontDocument,...e.backDocument!==void 0?{backDocument:e.backDocument}:{}};case t.residencyDocumentVerification:return{selfieImage:e.selfieImage,livenessImages:e.livenessImages,frontDocument:e.frontDocument,visaDocument:e.visaDocument};case t.enhancedKyc:case t.bvn:return{livenessImages:[]}}}function o(e){const a=e.lastIndexOf("/");if(a<=0)return;const c=e.slice(0,a);return/^[a-z][a-z0-9+.-]*:\/*$/i.test(c)?void 0:c}const f="UseSmileID";function r(e){const a=new Set(e.filter(s=>s!==void 0).map(o));if(a.size!==1)return;const[c]=a;if(c===void 0)return;const n=o(c);return n?.slice(n.lastIndexOf("/")+1)===f?c:void 0}
@@ -48,7 +48,7 @@ export type SmartSelfieEnrollmentRequest = BaseJobRequest & {
48
48
  * from the `sdk_config` JWT claim's `livenessImageCount` when
49
49
  * present (`livenessImageCount` maps to `numSamples = count + 1`,
50
50
  * so `expectedLivenessImageCount = count`); otherwise the
51
- * `ScanPerformanceProfile` default minus one (`numSamples - 1`).
51
+ * native default (`FaceCaptureDefaults.numSamples`) minus one (`numSamples - 1`).
52
52
  * For Enhanced Smart Selfie this is always
53
53
  * `EnhancedSmartSelfieConfig.EXPECTED_LIVENESS_IMAGE_COUNT` (7).
54
54
  *
@@ -141,4 +141,23 @@ export type EnhancedDocumentVerificationRequest = BaseJobRequest & {
141
141
  /** See `SmartSelfieEnrollmentRequest.expectedLivenessImageCount`. */
142
142
  readonly expectedLivenessImageCount: number;
143
143
  };
144
- export type JobRequest = SmartSelfieEnrollmentRequest | SmartSelfieAuthenticationRequest | EnhancedKycRequest | BvnRequest | BiometricKycRequest | DocumentVerificationRequest | EnhancedDocumentVerificationRequest;
144
+ /**
145
+ * Residency Document Verification: a passport data page plus a mandatory
146
+ * supporting visa page. Dispatches through `/v3/residency_document_verification`.
147
+ */
148
+ export type ResidencyDocumentVerificationRequest = BaseJobRequest & {
149
+ readonly jobType: typeof JobType.residencyDocumentVerification;
150
+ readonly selfieImage: string;
151
+ readonly livenessImages: readonly string[];
152
+ /** Passport data page. Sent as the `document` part. */
153
+ readonly frontDocument: string;
154
+ /** Supporting visa page. Sent as the `visa` part; the flow has no skip path for it. */
155
+ readonly visaDocument: string;
156
+ readonly country: string;
157
+ readonly idType: string;
158
+ /** Omitted when the token binds every required field, or reduced to the unbound remainder. */
159
+ readonly userDetails?: UserDetailsPayload;
160
+ /** See `SmartSelfieEnrollmentRequest.expectedLivenessImageCount`. */
161
+ readonly expectedLivenessImageCount: number;
162
+ };
163
+ export type JobRequest = SmartSelfieEnrollmentRequest | SmartSelfieAuthenticationRequest | EnhancedKycRequest | BvnRequest | BiometricKycRequest | DocumentVerificationRequest | EnhancedDocumentVerificationRequest | ResidencyDocumentVerificationRequest;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A job request signed and sealed for the partner to forward
3
+ * (`c.skipApiSubmission = true`), produced by `JobPackageSealer`. The images
4
+ * travel beside it, unencrypted.
5
+ *
6
+ * `headers` go on the forwarded request as they are; `encryptedPackage`,
7
+ * `packageNonce` and `packageTag` are hex strings sent as the
8
+ * `encrypted_package`, `package_nonce` and `package_tag` form fields.
9
+ */
10
+ export type SealedJobRequest = {
11
+ readonly headers: Readonly<Record<string, string>>;
12
+ readonly encryptedPackage: string;
13
+ readonly packageNonce: string;
14
+ readonly packageTag: string;
15
+ };
@@ -0,0 +1 @@
1
+ "use strict";export{};
@@ -9,6 +9,9 @@ export declare const tokenPayloadSchema: z.ZodObject<{
9
9
  last_name: z.ZodCatch<z.ZodOptional<z.ZodString>>;
10
10
  email: z.ZodCatch<z.ZodOptional<z.ZodString>>;
11
11
  phone_number: z.ZodCatch<z.ZodOptional<z.ZodString>>;
12
+ country: z.ZodCatch<z.ZodOptional<z.ZodString>>;
13
+ id_type: z.ZodCatch<z.ZodOptional<z.ZodString>>;
14
+ id_number: z.ZodCatch<z.ZodOptional<z.ZodString>>;
12
15
  consent: z.ZodCatch<z.ZodOptional<z.ZodObject<{
13
16
  granted: z.ZodCatch<z.ZodOptional<z.ZodLiteral<true>>>;
14
17
  granted_at: z.ZodCatch<z.ZodOptional<z.ZodString>>;
@@ -37,7 +40,8 @@ export type TokenConsent = {
37
40
  * Presence flags for the identity fields the token binds, parsed from
38
41
  * the `payload` claim. A flag is `true` iff the claim carries the key
39
42
  * with a non-empty string value (the value itself is an opaque vault
40
- * reference — the server injects the real value at submission).
43
+ * reference — the server injects the real value at submission, and
44
+ * rejects a request whose body contradicts it).
41
45
  */
42
46
  export type TokenPayload = {
43
47
  readonly hasGivenNames: boolean;
@@ -45,6 +49,10 @@ export type TokenPayload = {
45
49
  readonly hasEmail: boolean;
46
50
  readonly hasPhoneNumber: boolean;
47
51
  readonly consent?: TokenConsent;
52
+ /** Absent reads as not bound, as does `false`. */
53
+ readonly hasCountry?: boolean;
54
+ readonly hasIdType?: boolean;
55
+ readonly hasIdNumber?: boolean;
48
56
  };
49
57
  /**
50
58
  * Parse a raw `payload` claim value into a `TokenPayload`, or
@@ -53,6 +61,14 @@ export type TokenPayload = {
53
61
  * unknown keys, and degrades wrong-typed fields to absent.
54
62
  */
55
63
  export declare function parseTokenPayload(rawClaim: unknown): TokenPayload | undefined;
64
+ /** The params key of an ID field a token can bind. */
65
+ export type TokenBoundIdField = "country" | "idType" | "idNumber";
66
+ /**
67
+ * Whether the token binds the ID field named by its params key. The one
68
+ * rule both validation (a bound field may be blank) and request assembly
69
+ * (a bound field is never sent) read, so the two cannot disagree.
70
+ */
71
+ export declare function isIdFieldBoundByToken(payload: TokenPayload | undefined, field: TokenBoundIdField): boolean;
56
72
  /**
57
73
  * Token consent is COMPLETE when `granted` is `true` and every other
58
74
  * subfield is non-blank. A complete binding — granted with every
@@ -1 +1 @@
1
- "use strict";import{z as t}from"zod";const u=t.object({granted:t.literal(!0).optional().catch(void 0),granted_at:t.string().optional().catch(void 0),notice_language:t.string().optional().catch(void 0),notice_privacy_policy_url:t.string().optional().catch(void 0)});export const tokenPayloadSchema=t.object({given_names:t.string().optional().catch(void 0),last_name:t.string().optional().catch(void 0),email:t.string().optional().catch(void 0),phone_number:t.string().optional().catch(void 0),consent:u.optional().catch(void 0)});export function parseTokenPayload(n){if(n===null||typeof n!="object"||Array.isArray(n))return;const e=tokenPayloadSchema.safeParse(n);if(!e.success)return;const i=e.data,a=s(i.consent);return{hasGivenNames:r(i.given_names),hasLastName:r(i.last_name),hasEmail:r(i.email),hasPhoneNumber:r(i.phone_number),...a!==void 0?{consent:a}:{}}}export function isTokenConsentComplete(n){return n!==void 0&&tokenConsentMissingSubfields(n).length===0}export function tokenConsentMissingSubfields(n){const e=[];return n.granted!==!0&&e.push("granted"),o(n.grantedAt)||e.push("granted_at"),o(n.noticeLanguage)||e.push("notice_language"),o(n.noticePrivacyPolicyUrl)||e.push("notice_privacy_policy_url"),e}export function bindsRequiredUserDetails(n){return n===void 0?!1:n.hasGivenNames&&n.hasLastName&&(n.hasEmail||n.hasPhoneNumber)}function s(n){if(n===void 0)return;const e={...n.granted===!0?{granted:!0}:{},...n.granted_at!==void 0?{grantedAt:n.granted_at}:{},...n.notice_language!==void 0?{noticeLanguage:n.notice_language}:{},...n.notice_privacy_policy_url!==void 0?{noticePrivacyPolicyUrl:n.notice_privacy_policy_url}:{}};return Object.keys(e).length>0?e:void 0}function r(n){return n!==void 0&&n.length>0}function o(n){return n!==void 0&&n.trim().length>0}
1
+ "use strict";import{z as t}from"zod";const a=t.object({granted:t.literal(!0).optional().catch(void 0),granted_at:t.string().optional().catch(void 0),notice_language:t.string().optional().catch(void 0),notice_privacy_policy_url:t.string().optional().catch(void 0)});export const tokenPayloadSchema=t.object({given_names:t.string().optional().catch(void 0),last_name:t.string().optional().catch(void 0),email:t.string().optional().catch(void 0),phone_number:t.string().optional().catch(void 0),country:t.string().optional().catch(void 0),id_type:t.string().optional().catch(void 0),id_number:t.string().optional().catch(void 0),consent:a.optional().catch(void 0)});export function parseTokenPayload(n){if(n===null||typeof n!="object"||Array.isArray(n))return;const e=tokenPayloadSchema.safeParse(n);if(!e.success)return;const i=e.data,u=s(i.consent);return{hasGivenNames:r(i.given_names),hasLastName:r(i.last_name),hasEmail:r(i.email),hasPhoneNumber:r(i.phone_number),...u!==void 0?{consent:u}:{},hasCountry:r(i.country),hasIdType:r(i.id_type),hasIdNumber:r(i.id_number)}}export function isIdFieldBoundByToken(n,e){switch(e){case"country":return n?.hasCountry===!0;case"idType":return n?.hasIdType===!0;case"idNumber":return n?.hasIdNumber===!0}}export function isTokenConsentComplete(n){return n!==void 0&&tokenConsentMissingSubfields(n).length===0}export function tokenConsentMissingSubfields(n){const e=[];return n.granted!==!0&&e.push("granted"),o(n.grantedAt)||e.push("granted_at"),o(n.noticeLanguage)||e.push("notice_language"),o(n.noticePrivacyPolicyUrl)||e.push("notice_privacy_policy_url"),e}export function bindsRequiredUserDetails(n){return n===void 0?!1:n.hasGivenNames&&n.hasLastName&&(n.hasEmail||n.hasPhoneNumber)}function s(n){if(n===void 0)return;const e={...n.granted===!0?{granted:!0}:{},...n.granted_at!==void 0?{grantedAt:n.granted_at}:{},...n.notice_language!==void 0?{noticeLanguage:n.notice_language}:{},...n.notice_privacy_policy_url!==void 0?{noticePrivacyPolicyUrl:n.notice_privacy_policy_url}:{}};return Object.keys(e).length>0?e:void 0}function r(n){return n!==void 0&&n.length>0}function o(n){return n!==void 0&&n.trim().length>0}