@smileid/usesmileid 12.0.0-beta01 → 12.0.1
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/CHANGELOG.md +15 -0
- package/README.md +701 -89
- package/dist/camera/camera_defaults.d.ts +14 -9
- package/dist/camera/camera_defaults.d.ts.map +1 -1
- package/dist/camera/camera_defaults.js +11 -9
- package/dist/camera/camera_defaults.js.map +1 -1
- package/dist/camera/orientation_degrees.d.ts +5 -6
- package/dist/camera/orientation_degrees.d.ts.map +1 -1
- package/dist/camera/orientation_degrees.js +5 -6
- package/dist/camera/orientation_degrees.js.map +1 -1
- package/dist/core/exception/agent_mode_with_enhanced_liveness_exception.d.ts +11 -0
- package/dist/core/exception/agent_mode_with_enhanced_liveness_exception.d.ts.map +1 -0
- package/dist/core/exception/agent_mode_with_enhanced_liveness_exception.js +17 -0
- package/dist/core/exception/agent_mode_with_enhanced_liveness_exception.js.map +1 -0
- package/dist/core/exception/capture_validation_exceptions.d.ts +1 -0
- package/dist/core/exception/capture_validation_exceptions.d.ts.map +1 -1
- package/dist/core/exception/capture_validation_exceptions.js +1 -0
- package/dist/core/exception/capture_validation_exceptions.js.map +1 -1
- package/dist/core/exception/index.d.ts +1 -0
- package/dist/core/exception/index.d.ts.map +1 -1
- package/dist/core/exception/index.js +1 -0
- package/dist/core/exception/index.js.map +1 -1
- package/dist/core/exception/use_smile_id_error_code.d.ts +1 -0
- package/dist/core/exception/use_smile_id_error_code.d.ts.map +1 -1
- package/dist/core/exception/use_smile_id_error_code.js +1 -0
- package/dist/core/exception/use_smile_id_error_code.js.map +1 -1
- package/dist/core/models/config.d.ts +19 -0
- package/dist/core/models/config.d.ts.map +1 -1
- package/dist/core/models/document_capture_mode.d.ts +8 -0
- package/dist/core/models/document_capture_mode.d.ts.map +1 -1
- package/dist/core/models/document_capture_mode.js +24 -0
- package/dist/core/models/document_capture_mode.js.map +1 -1
- package/dist/core/models/document_type.d.ts +2 -2
- package/dist/core/models/document_type.d.ts.map +1 -1
- package/dist/core/models/document_type.js +7 -5
- package/dist/core/models/document_type.js.map +1 -1
- package/dist/core/models/global_privacy_control.d.ts +36 -0
- package/dist/core/models/global_privacy_control.d.ts.map +1 -0
- package/dist/core/models/global_privacy_control.js +39 -0
- package/dist/core/models/global_privacy_control.js.map +1 -0
- package/dist/core/models/network_config.d.ts +2 -2
- package/dist/core/models/network_config.js +2 -2
- package/dist/core/models/result.d.ts +9 -8
- package/dist/core/models/result.d.ts.map +1 -1
- package/dist/core/models/result.js +5 -6
- package/dist/core/models/result.js.map +1 -1
- package/dist/data/api/interceptors/smile_auth_interceptor.d.ts.map +1 -1
- package/dist/data/api/interceptors/smile_auth_interceptor.js +3 -17
- package/dist/data/api/interceptors/smile_auth_interceptor.js.map +1 -1
- package/dist/data/api/interceptors/smile_integrity_interceptor.d.ts +11 -0
- package/dist/data/api/interceptors/smile_integrity_interceptor.d.ts.map +1 -1
- package/dist/data/api/interceptors/smile_integrity_interceptor.js +13 -0
- package/dist/data/api/interceptors/smile_integrity_interceptor.js.map +1 -1
- package/dist/data/api/interceptors/smile_request_mac_interceptor.d.ts +8 -0
- package/dist/data/api/interceptors/smile_request_mac_interceptor.d.ts.map +1 -1
- package/dist/data/api/interceptors/smile_request_mac_interceptor.js +11 -0
- package/dist/data/api/interceptors/smile_request_mac_interceptor.js.map +1 -1
- package/dist/data/api/smile_id_api.d.ts +1 -1
- package/dist/data/api/smile_id_api.d.ts.map +1 -1
- package/dist/data/compression/compressible_asset.d.ts +41 -0
- package/dist/data/compression/compressible_asset.d.ts.map +1 -0
- package/dist/data/compression/compressible_asset.js +34 -0
- package/dist/data/compression/compressible_asset.js.map +1 -0
- package/dist/data/compression/payload_compression_config.d.ts +36 -0
- package/dist/data/compression/payload_compression_config.d.ts.map +1 -0
- package/dist/data/compression/payload_compression_config.js +52 -0
- package/dist/data/compression/payload_compression_config.js.map +1 -0
- package/dist/data/compression/payload_compression_runner.d.ts +29 -0
- package/dist/data/compression/payload_compression_runner.d.ts.map +1 -0
- package/dist/data/compression/payload_compression_runner.js +55 -0
- package/dist/data/compression/payload_compression_runner.js.map +1 -0
- package/dist/data/compression/payload_compressor.d.ts +40 -0
- package/dist/data/compression/payload_compressor.d.ts.map +1 -0
- package/dist/data/compression/payload_compressor.js +126 -0
- package/dist/data/compression/payload_compressor.js.map +1 -0
- package/dist/data/compression/uri_compressible_asset.d.ts +23 -0
- package/dist/data/compression/uri_compressible_asset.d.ts.map +1 -0
- package/dist/data/compression/uri_compressible_asset.js +77 -0
- package/dist/data/compression/uri_compressible_asset.js.map +1 -0
- package/dist/data/dsl/builder/cache_config_builder.d.ts +2 -1
- package/dist/data/dsl/builder/cache_config_builder.d.ts.map +1 -1
- package/dist/data/dsl/builder/cache_config_builder.js +2 -1
- package/dist/data/dsl/builder/cache_config_builder.js.map +1 -1
- package/dist/data/dsl/builder/config_builder.d.ts +40 -14
- package/dist/data/dsl/builder/config_builder.d.ts.map +1 -1
- package/dist/data/dsl/builder/config_builder.js +40 -14
- package/dist/data/dsl/builder/config_builder.js.map +1 -1
- package/dist/data/dsl/builder/interceptor_config_builder.d.ts +9 -7
- package/dist/data/dsl/builder/interceptor_config_builder.d.ts.map +1 -1
- package/dist/data/dsl/builder/interceptor_config_builder.js +9 -7
- package/dist/data/dsl/builder/interceptor_config_builder.js.map +1 -1
- package/dist/data/dsl/builder/retry_config_builder.d.ts +19 -4
- package/dist/data/dsl/builder/retry_config_builder.d.ts.map +1 -1
- package/dist/data/dsl/builder/retry_config_builder.js +21 -6
- package/dist/data/dsl/builder/retry_config_builder.js.map +1 -1
- package/dist/data/dsl/builder/timeout_config_builder.d.ts +4 -0
- package/dist/data/dsl/builder/timeout_config_builder.d.ts.map +1 -1
- package/dist/data/dsl/builder/timeout_config_builder.js +4 -0
- package/dist/data/dsl/builder/timeout_config_builder.js.map +1 -1
- package/dist/data/dsl/use_smile_id_network_builder.d.ts +17 -0
- package/dist/data/dsl/use_smile_id_network_builder.d.ts.map +1 -1
- package/dist/data/dsl/use_smile_id_network_builder.js +17 -0
- package/dist/data/dsl/use_smile_id_network_builder.js.map +1 -1
- package/dist/data/factory/networking_factory.d.ts.map +1 -1
- package/dist/data/factory/networking_factory.js +11 -1
- package/dist/data/factory/networking_factory.js.map +1 -1
- package/dist/data/repository/use_smile_id_repository_impl.d.ts +6 -0
- package/dist/data/repository/use_smile_id_repository_impl.d.ts.map +1 -1
- package/dist/data/repository/use_smile_id_repository_impl.js +82 -8
- package/dist/data/repository/use_smile_id_repository_impl.js.map +1 -1
- package/dist/data/security/request_canonicalizer.d.ts.map +1 -1
- package/dist/data/security/request_canonicalizer.js +14 -2
- package/dist/data/security/request_canonicalizer.js.map +1 -1
- package/dist/data/security/security_policy.d.ts +43 -0
- package/dist/data/security/security_policy.d.ts.map +1 -0
- package/dist/data/security/security_policy.js +61 -0
- package/dist/data/security/security_policy.js.map +1 -0
- package/dist/data/smile_id_urls.d.ts +1 -1
- package/dist/data/smile_id_urls.js +1 -1
- package/dist/data/smile_id_urls.js.map +1 -1
- package/dist/data/util/retry_util.d.ts +2 -2
- package/dist/data/util/retry_util.d.ts.map +1 -1
- package/dist/data/util/retry_util.js +7 -1
- package/dist/data/util/retry_util.js.map +1 -1
- package/dist/data/util/use_smile_id_token_decoder.d.ts +22 -0
- package/dist/data/util/use_smile_id_token_decoder.d.ts.map +1 -1
- package/dist/data/util/use_smile_id_token_decoder.js +58 -24
- package/dist/data/util/use_smile_id_token_decoder.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/l10n/strings_en.d.ts +2 -1
- package/dist/l10n/strings_en.d.ts.map +1 -1
- package/dist/l10n/strings_en.js +2 -1
- package/dist/l10n/strings_en.js.map +1 -1
- package/dist/l10n/use_smile_id_localizations.d.ts +1 -0
- package/dist/l10n/use_smile_id_localizations.d.ts.map +1 -1
- package/dist/l10n/use_smile_id_localizations.js +3 -0
- package/dist/l10n/use_smile_id_localizations.js.map +1 -1
- package/dist/metadata/builder_configuration.d.ts +44 -0
- package/dist/metadata/builder_configuration.d.ts.map +1 -0
- package/dist/metadata/builder_configuration.js +35 -0
- package/dist/metadata/builder_configuration.js.map +1 -0
- package/dist/metadata/captured_image_properties.d.ts +11 -0
- package/dist/metadata/captured_image_properties.d.ts.map +1 -0
- package/dist/metadata/captured_image_properties.js +11 -0
- package/dist/metadata/captured_image_properties.js.map +1 -0
- package/dist/metadata/device_orientation_collector.d.ts +17 -0
- package/dist/metadata/device_orientation_collector.d.ts.map +1 -0
- package/dist/metadata/device_orientation_collector.js +66 -0
- package/dist/metadata/device_orientation_collector.js.map +1 -0
- package/dist/metadata/geolocation.d.ts +20 -0
- package/dist/metadata/geolocation.d.ts.map +1 -0
- package/dist/metadata/geolocation.js +40 -0
- package/dist/metadata/geolocation.js.map +1 -0
- package/dist/metadata/metadata_configuration_mappers.d.ts +47 -0
- package/dist/metadata/metadata_configuration_mappers.d.ts.map +1 -0
- package/dist/metadata/metadata_configuration_mappers.js +178 -0
- package/dist/metadata/metadata_configuration_mappers.js.map +1 -0
- package/dist/metadata/model_configuration.d.ts +41 -0
- package/dist/metadata/model_configuration.d.ts.map +1 -0
- package/dist/metadata/model_configuration.js +44 -0
- package/dist/metadata/model_configuration.js.map +1 -0
- package/dist/metadata/optional_native_modules.d.ts +79 -3
- package/dist/metadata/optional_native_modules.d.ts.map +1 -1
- package/dist/metadata/optional_native_modules.js +108 -3
- package/dist/metadata/optional_native_modules.js.map +1 -1
- package/dist/metadata/use_smile_id_metadata.d.ts +45 -7
- package/dist/metadata/use_smile_id_metadata.d.ts.map +1 -1
- package/dist/metadata/use_smile_id_metadata.js +85 -13
- package/dist/metadata/use_smile_id_metadata.js.map +1 -1
- package/dist/metadata/use_smile_id_metadata_factory.d.ts +37 -0
- package/dist/metadata/use_smile_id_metadata_factory.d.ts.map +1 -1
- package/dist/metadata/use_smile_id_metadata_factory.js +197 -16
- package/dist/metadata/use_smile_id_metadata_factory.js.map +1 -1
- package/dist/presentation/assets/svg/document_shimmer_strings.d.ts +14 -0
- package/dist/presentation/assets/svg/document_shimmer_strings.d.ts.map +1 -0
- package/dist/presentation/assets/svg/document_shimmer_strings.js +14 -0
- package/dist/presentation/assets/svg/document_shimmer_strings.js.map +1 -0
- package/dist/presentation/assets/svg/instruction_svg_strings.d.ts +12 -4
- package/dist/presentation/assets/svg/instruction_svg_strings.d.ts.map +1 -1
- package/dist/presentation/assets/svg/instruction_svg_strings.js +19 -8
- package/dist/presentation/assets/svg/instruction_svg_strings.js.map +1 -1
- package/dist/presentation/components/helpers/enhanced_smart_selfie_animation_frames.d.ts +0 -5
- package/dist/presentation/components/helpers/enhanced_smart_selfie_animation_frames.d.ts.map +1 -1
- package/dist/presentation/components/helpers/enhanced_smart_selfie_animation_frames.js +0 -5
- package/dist/presentation/components/helpers/enhanced_smart_selfie_animation_frames.js.map +1 -1
- package/dist/presentation/components/icons/index.d.ts +24 -8
- package/dist/presentation/components/icons/index.d.ts.map +1 -1
- package/dist/presentation/components/icons/index.js +31 -11
- package/dist/presentation/components/icons/index.js.map +1 -1
- package/dist/presentation/components/use_smile_id_attribution.d.ts +1 -1
- package/dist/presentation/components/use_smile_id_button.d.ts +2 -2
- package/dist/presentation/components/use_smile_id_button.js +4 -4
- package/dist/presentation/components/use_smile_id_button.js.map +1 -1
- package/dist/presentation/components/use_smile_id_capture_content.d.ts +13 -0
- package/dist/presentation/components/use_smile_id_capture_content.d.ts.map +1 -1
- package/dist/presentation/components/use_smile_id_capture_content.js +15 -9
- package/dist/presentation/components/use_smile_id_capture_content.js.map +1 -1
- package/dist/presentation/components/use_smile_id_captured_document_image.d.ts +2 -3
- package/dist/presentation/components/use_smile_id_captured_document_image.d.ts.map +1 -1
- package/dist/presentation/components/use_smile_id_captured_document_image.js +1 -3
- package/dist/presentation/components/use_smile_id_captured_document_image.js.map +1 -1
- package/dist/presentation/components/use_smile_id_document_capture_controls.d.ts +12 -6
- package/dist/presentation/components/use_smile_id_document_capture_controls.d.ts.map +1 -1
- package/dist/presentation/components/use_smile_id_document_capture_controls.js +59 -16
- package/dist/presentation/components/use_smile_id_document_capture_controls.js.map +1 -1
- package/dist/presentation/components/use_smile_id_document_overlay.d.ts +22 -5
- package/dist/presentation/components/use_smile_id_document_overlay.d.ts.map +1 -1
- package/dist/presentation/components/use_smile_id_document_overlay.js +80 -40
- package/dist/presentation/components/use_smile_id_document_overlay.js.map +1 -1
- package/dist/presentation/components/use_smile_id_document_shimmer.d.ts +15 -0
- package/dist/presentation/components/use_smile_id_document_shimmer.d.ts.map +1 -0
- package/dist/presentation/components/use_smile_id_document_shimmer.js +23 -0
- package/dist/presentation/components/use_smile_id_document_shimmer.js.map +1 -0
- package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_clip.d.ts +5 -2
- package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_clip.d.ts.map +1 -1
- package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_clip.js +9 -6
- package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_clip.js.map +1 -1
- package/dist/presentation/components/use_smile_id_guideline_thumbnail.d.ts.map +1 -1
- package/dist/presentation/components/use_smile_id_guideline_thumbnail.js +84 -1
- package/dist/presentation/components/use_smile_id_guideline_thumbnail.js.map +1 -1
- package/dist/presentation/components/use_smile_id_instructions_hero.d.ts +3 -1
- package/dist/presentation/components/use_smile_id_instructions_hero.d.ts.map +1 -1
- package/dist/presentation/components/use_smile_id_instructions_hero.js +25 -5
- package/dist/presentation/components/use_smile_id_instructions_hero.js.map +1 -1
- package/dist/presentation/components/use_smile_id_oval_border_palette.d.ts.map +1 -1
- package/dist/presentation/components/use_smile_id_oval_border_palette.js +7 -3
- package/dist/presentation/components/use_smile_id_oval_border_palette.js.map +1 -1
- package/dist/presentation/flow/dsl/builder/config_builder.d.ts +28 -0
- package/dist/presentation/flow/dsl/builder/config_builder.d.ts.map +1 -1
- package/dist/presentation/flow/dsl/builder/config_builder.js +30 -0
- package/dist/presentation/flow/dsl/builder/config_builder.js.map +1 -1
- package/dist/presentation/flow/dsl/builder/ml_builder.d.ts +13 -4
- package/dist/presentation/flow/dsl/builder/ml_builder.d.ts.map +1 -1
- package/dist/presentation/flow/dsl/builder/ml_builder.js +3 -2
- package/dist/presentation/flow/dsl/builder/ml_builder.js.map +1 -1
- package/dist/presentation/flow/dsl/builder/screens_builder.d.ts +110 -12
- package/dist/presentation/flow/dsl/builder/screens_builder.d.ts.map +1 -1
- package/dist/presentation/flow/dsl/builder/screens_builder.js +110 -12
- package/dist/presentation/flow/dsl/builder/screens_builder.js.map +1 -1
- package/dist/presentation/flow/dsl/builder/theme_builder.d.ts +15 -2
- package/dist/presentation/flow/dsl/builder/theme_builder.d.ts.map +1 -1
- package/dist/presentation/flow/dsl/builder/theme_builder.js +15 -2
- package/dist/presentation/flow/dsl/builder/theme_builder.js.map +1 -1
- package/dist/presentation/flow/dsl/use_smile_id_builder.d.ts +6 -4
- package/dist/presentation/flow/dsl/use_smile_id_builder.d.ts.map +1 -1
- package/dist/presentation/flow/dsl/use_smile_id_builder.js.map +1 -1
- package/dist/presentation/flow/dsl/use_smile_id_flow_builder.d.ts +62 -36
- package/dist/presentation/flow/dsl/use_smile_id_flow_builder.d.ts.map +1 -1
- package/dist/presentation/flow/dsl/use_smile_id_flow_builder.js +62 -36
- package/dist/presentation/flow/dsl/use_smile_id_flow_builder.js.map +1 -1
- package/dist/presentation/flow/flow_navigation_manager.d.ts +44 -5
- package/dist/presentation/flow/flow_navigation_manager.d.ts.map +1 -1
- package/dist/presentation/flow/flow_navigation_manager.js +148 -11
- package/dist/presentation/flow/flow_navigation_manager.js.map +1 -1
- package/dist/presentation/flow/model/instruction_guideline.d.ts +9 -0
- package/dist/presentation/flow/model/instruction_guideline.d.ts.map +1 -1
- package/dist/presentation/flow/model/instructions_defaults.d.ts +11 -2
- package/dist/presentation/flow/model/instructions_defaults.d.ts.map +1 -1
- package/dist/presentation/flow/model/instructions_defaults.js +74 -26
- package/dist/presentation/flow/model/instructions_defaults.js.map +1 -1
- package/dist/presentation/flow/screen/orchestrated_capture_screen.d.ts.map +1 -1
- package/dist/presentation/flow/screen/orchestrated_capture_screen.js +48 -14
- package/dist/presentation/flow/screen/orchestrated_capture_screen.js.map +1 -1
- package/dist/presentation/flow/screen/orchestrated_consent_screen.d.ts.map +1 -1
- package/dist/presentation/flow/screen/orchestrated_consent_screen.js +3 -1
- package/dist/presentation/flow/screen/orchestrated_consent_screen.js.map +1 -1
- package/dist/presentation/flow/screen/orchestrated_instructions_screen.js +1 -1
- package/dist/presentation/flow/screen/orchestrated_instructions_screen.js.map +1 -1
- package/dist/presentation/flow/screen/orchestrated_preview_screen.d.ts.map +1 -1
- package/dist/presentation/flow/screen/orchestrated_preview_screen.js +3 -9
- package/dist/presentation/flow/screen/orchestrated_preview_screen.js.map +1 -1
- package/dist/presentation/flow/screen/orchestrated_processing_screen.js +3 -3
- package/dist/presentation/flow/screen/orchestrated_processing_screen.js.map +1 -1
- package/dist/presentation/flow/use_smile_id_flow.d.ts.map +1 -1
- package/dist/presentation/flow/use_smile_id_flow.js +10 -4
- package/dist/presentation/flow/use_smile_id_flow.js.map +1 -1
- package/dist/presentation/flow/validation/flow_validator.d.ts.map +1 -1
- package/dist/presentation/flow/validation/flow_validator.js +42 -20
- package/dist/presentation/flow/validation/flow_validator.js.map +1 -1
- package/dist/presentation/flow/validation/job_type_validator.d.ts.map +1 -1
- package/dist/presentation/flow/validation/job_type_validator.js +14 -0
- package/dist/presentation/flow/validation/job_type_validator.js.map +1 -1
- package/dist/presentation/screen/helpers/capture_screen_helpers.d.ts.map +1 -1
- package/dist/presentation/screen/helpers/capture_screen_helpers.js +1 -0
- package/dist/presentation/screen/helpers/capture_screen_helpers.js.map +1 -1
- package/dist/presentation/screen/helpers/capture_ui_state.d.ts +6 -6
- package/dist/presentation/screen/helpers/capture_ui_state.d.ts.map +1 -1
- package/dist/presentation/screen/helpers/capture_ui_state.js +19 -19
- package/dist/presentation/screen/helpers/capture_ui_state.js.map +1 -1
- package/dist/presentation/screen/helpers/ess_turn_haptics.d.ts +2 -2
- package/dist/presentation/screen/helpers/ess_turn_haptics.d.ts.map +1 -1
- package/dist/presentation/screen/helpers/ess_turn_haptics.js +6 -6
- package/dist/presentation/screen/helpers/ess_turn_haptics.js.map +1 -1
- package/dist/presentation/screen/helpers/instructions_screen_helpers.d.ts +1 -0
- package/dist/presentation/screen/helpers/instructions_screen_helpers.d.ts.map +1 -1
- package/dist/presentation/screen/helpers/instructions_screen_helpers.js +6 -2
- package/dist/presentation/screen/helpers/instructions_screen_helpers.js.map +1 -1
- package/dist/presentation/screen/helpers/scan_state_to_overlay_state.d.ts +5 -5
- package/dist/presentation/screen/helpers/scan_state_to_overlay_state.d.ts.map +1 -1
- package/dist/presentation/screen/helpers/scan_state_to_overlay_state.js +14 -11
- package/dist/presentation/screen/helpers/scan_state_to_overlay_state.js.map +1 -1
- package/dist/presentation/screen/helpers/use_capture_orientation_lock.d.ts +13 -3
- package/dist/presentation/screen/helpers/use_capture_orientation_lock.d.ts.map +1 -1
- package/dist/presentation/screen/helpers/use_capture_orientation_lock.js +48 -6
- package/dist/presentation/screen/helpers/use_capture_orientation_lock.js.map +1 -1
- package/dist/presentation/screen/use_smile_id_capture_screen.d.ts +21 -3
- package/dist/presentation/screen/use_smile_id_capture_screen.d.ts.map +1 -1
- package/dist/presentation/screen/use_smile_id_capture_screen.js +188 -32
- package/dist/presentation/screen/use_smile_id_capture_screen.js.map +1 -1
- package/dist/presentation/screen/use_smile_id_consent_screen.d.ts +7 -0
- package/dist/presentation/screen/use_smile_id_consent_screen.d.ts.map +1 -1
- package/dist/presentation/screen/use_smile_id_consent_screen.js +6 -5
- package/dist/presentation/screen/use_smile_id_consent_screen.js.map +1 -1
- package/dist/presentation/screen/use_smile_id_document_back_instructions.d.ts.map +1 -1
- package/dist/presentation/screen/use_smile_id_document_back_instructions.js +5 -13
- package/dist/presentation/screen/use_smile_id_document_back_instructions.js.map +1 -1
- package/dist/presentation/screen/use_smile_id_document_preview_screen.d.ts +2 -3
- package/dist/presentation/screen/use_smile_id_document_preview_screen.d.ts.map +1 -1
- package/dist/presentation/screen/use_smile_id_document_preview_screen.js +17 -12
- package/dist/presentation/screen/use_smile_id_document_preview_screen.js.map +1 -1
- package/dist/presentation/screen/use_smile_id_instructions_screen.d.ts +2 -0
- package/dist/presentation/screen/use_smile_id_instructions_screen.d.ts.map +1 -1
- package/dist/presentation/screen/use_smile_id_instructions_screen.js +2 -1
- package/dist/presentation/screen/use_smile_id_instructions_screen.js.map +1 -1
- package/dist/presentation/screen/use_smile_id_preview_screen.d.ts +7 -26
- package/dist/presentation/screen/use_smile_id_preview_screen.d.ts.map +1 -1
- package/dist/presentation/screen/use_smile_id_preview_screen.js +10 -20
- package/dist/presentation/screen/use_smile_id_preview_screen.js.map +1 -1
- package/dist/presentation/screen/use_smile_id_processing_screen.d.ts +2 -3
- package/dist/presentation/screen/use_smile_id_processing_screen.d.ts.map +1 -1
- package/dist/presentation/screen/use_smile_id_processing_screen.js +4 -3
- package/dist/presentation/screen/use_smile_id_processing_screen.js.map +1 -1
- package/dist/presentation/theme/theme.d.ts +1 -1
- package/dist/presentation/theme/theme.d.ts.map +1 -1
- package/dist/presentation/theme/theme.js +20 -18
- package/dist/presentation/theme/theme.js.map +1 -1
- package/dist/presentation/utils/force_max_brightness.d.ts +4 -4
- package/dist/presentation/utils/locale_utils.d.ts +10 -4
- package/dist/presentation/utils/locale_utils.d.ts.map +1 -1
- package/dist/presentation/utils/locale_utils.js +13 -5
- package/dist/presentation/utils/locale_utils.js.map +1 -1
- package/dist/testing/fake_face_analyzer.d.ts +43 -0
- package/dist/testing/fake_face_analyzer.d.ts.map +1 -0
- package/dist/testing/fake_face_analyzer.js +52 -0
- package/dist/testing/fake_face_analyzer.js.map +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +7 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/scenario_expectations.d.ts +28 -0
- package/dist/testing/scenario_expectations.d.ts.map +1 -0
- package/dist/testing/scenario_expectations.js +65 -0
- package/dist/testing/scenario_expectations.js.map +1 -0
- package/dist/testing/scenario_loader.d.ts +11 -0
- package/dist/testing/scenario_loader.d.ts.map +1 -0
- package/dist/testing/scenario_loader.js +64 -0
- package/dist/testing/scenario_loader.js.map +1 -0
- package/dist/testing/scripted_scan_results.d.ts +17 -0
- package/dist/testing/scripted_scan_results.d.ts.map +1 -0
- package/dist/testing/scripted_scan_results.js +52 -0
- package/dist/testing/scripted_scan_results.js.map +1 -0
- package/package.json +34 -7
- package/src/__tests__/dsl.test.ts +51 -1
- package/src/__tests__/react_native_mock.tsx +8 -0
- package/src/__tests__/setup_react_native.ts +17 -2
- package/src/__tests__/snapshots/__snapshots__/screens_structural.test.tsx.snap +5261 -0
- package/src/__tests__/snapshots/screens_structural.test.tsx +230 -0
- package/src/camera/__tests__/use_smile_id_camera_system.test.ts +103 -0
- package/src/camera/camera_defaults.ts +11 -9
- package/src/camera/orientation_degrees.ts +5 -6
- package/src/core/exception/__tests__/builder_validation_exceptions.test.ts +67 -0
- package/src/core/exception/agent_mode_with_enhanced_liveness_exception.ts +20 -0
- package/src/core/exception/capture_validation_exceptions.ts +1 -0
- package/src/core/exception/index.ts +1 -0
- package/src/core/exception/use_smile_id_error_code.ts +1 -0
- package/src/core/models/__tests__/document_type.test.ts +7 -5
- package/src/core/models/__tests__/flow_models.test.ts +26 -0
- package/src/core/models/config.ts +22 -0
- package/src/core/models/document_capture_mode.ts +27 -0
- package/src/core/models/document_type.ts +7 -5
- package/src/core/models/global_privacy_control.ts +45 -0
- package/src/core/models/network_config.ts +2 -2
- package/src/core/models/result.ts +9 -8
- package/src/data/api/__tests__/smile_id_api.test.ts +1 -1
- package/src/data/api/interceptors/__tests__/gzip_interceptor.test.ts +83 -0
- package/src/data/api/interceptors/__tests__/smile_integrity_interceptor.test.ts +37 -1
- package/src/data/api/interceptors/__tests__/smile_request_mac_interceptor.test.ts +59 -1
- package/src/data/api/interceptors/smile_auth_interceptor.ts +3 -18
- package/src/data/api/interceptors/smile_integrity_interceptor.ts +20 -0
- package/src/data/api/interceptors/smile_request_mac_interceptor.ts +13 -0
- package/src/data/compression/__tests__/payload_compressor.test.ts +200 -0
- package/src/data/compression/__tests__/payload_compressor_real_jpeg.test.ts +226 -0
- package/src/data/compression/compressible_asset.ts +62 -0
- package/src/data/compression/payload_compression_config.ts +53 -0
- package/src/data/compression/payload_compression_runner.ts +102 -0
- package/src/data/compression/payload_compressor.ts +164 -0
- package/src/data/compression/uri_compressible_asset.ts +85 -0
- package/src/data/dsl/builder/__tests__/config_builders.test.ts +62 -0
- package/src/data/dsl/builder/cache_config_builder.ts +3 -1
- package/src/data/dsl/builder/config_builder.ts +45 -14
- package/src/data/dsl/builder/interceptor_config_builder.ts +9 -7
- package/src/data/dsl/builder/retry_config_builder.ts +27 -6
- package/src/data/dsl/builder/timeout_config_builder.ts +7 -0
- package/src/data/dsl/use_smile_id_network_builder.ts +17 -0
- package/src/data/factory/__tests__/retry_gzip_mac_composition.test.ts +163 -0
- package/src/data/factory/__tests__/signed_job_submission_headers.test.ts +1 -1
- package/src/data/factory/networking_factory.ts +14 -1
- package/src/data/repository/__tests__/network_retries.test.ts +117 -0
- package/src/data/repository/__tests__/use_smile_id_repository.test.ts +1 -1
- package/src/data/repository/use_smile_id_repository_impl.ts +96 -9
- package/src/data/security/__tests__/request_canonicalizer.test.ts +132 -0
- package/src/data/security/__tests__/security_policy.test.ts +96 -0
- package/src/data/security/__tests__/smile_id_crypto_manager.test.ts +18 -0
- package/src/data/security/request_canonicalizer.ts +15 -2
- package/src/data/security/security_policy.ts +70 -0
- package/src/data/smile_id_urls.ts +1 -1
- package/src/data/util/__tests__/retry_util.test.ts +25 -0
- package/src/data/util/__tests__/use_smile_id_token_decoder.test.ts +57 -1
- package/src/data/util/retry_util.ts +12 -3
- package/src/data/util/use_smile_id_token_decoder.ts +76 -28
- package/src/index.ts +6 -4
- package/src/l10n/strings_en.ts +2 -1
- package/src/l10n/use_smile_id_localizations.ts +3 -0
- package/src/metadata/__tests__/device_orientation_collector.test.ts +15 -0
- package/src/metadata/__tests__/metadata_configuration_mappers.test.ts +254 -0
- package/src/metadata/__tests__/metadata_configuration_objects.test.ts +86 -0
- package/src/metadata/__tests__/metadata_device_context.test.ts +147 -0
- package/src/metadata/__tests__/metadata_device_os_android.test.ts +18 -0
- package/src/metadata/__tests__/metadata_golden_fixture.json +13 -0
- package/src/metadata/__tests__/metadata_payload_golden.test.ts +193 -0
- package/src/metadata/__tests__/use_smile_id_metadata.test.ts +19 -25
- package/src/metadata/builder_configuration.ts +69 -0
- package/src/metadata/captured_image_properties.ts +10 -0
- package/src/metadata/device_orientation_collector.ts +75 -0
- package/src/metadata/geolocation.ts +46 -0
- package/src/metadata/metadata_configuration_mappers.ts +248 -0
- package/src/metadata/model_configuration.ts +68 -0
- package/src/metadata/optional_native_modules.ts +157 -3
- package/src/metadata/use_smile_id_metadata.ts +140 -17
- package/src/metadata/use_smile_id_metadata_factory.ts +211 -16
- package/src/presentation/assets/si_document_green_book_hero_animation.json +1 -4668
- package/src/presentation/assets/si_document_hero_animation.json +1 -4799
- package/src/presentation/assets/si_document_hero_back_animation.json +1 -2039
- package/src/presentation/assets/si_document_passport_hero_animation.json +1 -14491
- package/src/presentation/assets/si_ess_all_directions_hero_animation.json +1 -0
- package/src/presentation/assets/si_ess_animation_all_directions.json +1 -5575
- package/src/presentation/assets/si_selfie_hero_animation.json +1 -1439
- package/src/presentation/assets/si_smile_to_capture_animation.json +1 -1439
- package/src/presentation/assets/svg/document_shimmer_strings.ts +17 -0
- package/src/presentation/assets/svg/instruction_svg_strings.ts +34 -12
- package/src/presentation/components/__tests__/enhanced_smart_selfie_animation_frames.test.ts +1 -3
- package/src/presentation/components/__tests__/use_smile_id_enhanced_smart_selfie_clip.test.tsx +12 -8
- package/src/presentation/components/__tests__/use_smile_id_guideline_thumbnail.test.tsx +34 -1
- package/src/presentation/components/__tests__/use_smile_id_instructions_hero.test.tsx +71 -0
- package/src/presentation/components/__tests__/use_smile_id_oval_border_palette.test.ts +7 -5
- package/src/presentation/components/helpers/enhanced_smart_selfie_animation_frames.ts +0 -6
- package/src/presentation/components/icons/index.tsx +65 -18
- package/src/presentation/components/use_smile_id_attribution.tsx +1 -1
- package/src/presentation/components/use_smile_id_button.tsx +4 -4
- package/src/presentation/components/use_smile_id_capture_content.tsx +36 -12
- package/src/presentation/components/use_smile_id_captured_document_image.tsx +3 -8
- package/src/presentation/components/use_smile_id_document_capture_controls.tsx +103 -39
- package/src/presentation/components/use_smile_id_document_overlay.tsx +134 -44
- package/src/presentation/components/use_smile_id_document_shimmer.tsx +51 -0
- package/src/presentation/components/use_smile_id_enhanced_smart_selfie_clip.tsx +9 -6
- package/src/presentation/components/use_smile_id_guideline_thumbnail.tsx +131 -2
- package/src/presentation/components/use_smile_id_instructions_hero.tsx +111 -60
- package/src/presentation/components/use_smile_id_oval_border_palette.ts +7 -3
- package/src/presentation/flow/__tests__/document_flow_navigation.test.ts +203 -4
- package/src/presentation/flow/__tests__/flow_navigation_manager.test.ts +49 -0
- package/src/presentation/flow/dsl/builder/__tests__/config_builder.test.ts +25 -0
- package/src/presentation/flow/dsl/builder/config_builder.ts +35 -0
- package/src/presentation/flow/dsl/builder/ml_builder.ts +13 -4
- package/src/presentation/flow/dsl/builder/screens_builder.ts +110 -12
- package/src/presentation/flow/dsl/builder/theme_builder.ts +19 -2
- package/src/presentation/flow/dsl/use_smile_id_builder.tsx +6 -4
- package/src/presentation/flow/dsl/use_smile_id_flow_builder.ts +62 -36
- package/src/presentation/flow/flow_navigation_manager.ts +185 -14
- package/src/presentation/flow/model/instruction_guideline.ts +6 -0
- package/src/presentation/flow/model/instructions_defaults.ts +104 -26
- package/src/presentation/flow/screen/orchestrated_capture_screen.tsx +60 -12
- package/src/presentation/flow/screen/orchestrated_consent_screen.tsx +5 -0
- package/src/presentation/flow/screen/orchestrated_instructions_screen.tsx +1 -0
- package/src/presentation/flow/screen/orchestrated_preview_screen.tsx +4 -14
- package/src/presentation/flow/screen/orchestrated_processing_screen.tsx +3 -3
- package/src/presentation/flow/use_smile_id_flow.tsx +11 -4
- package/src/presentation/flow/validation/__tests__/flow_validator.test.ts +61 -1
- package/src/presentation/flow/validation/__tests__/job_type_validator.test.ts +64 -0
- package/src/presentation/flow/validation/flow_validator.ts +55 -26
- package/src/presentation/flow/validation/job_type_validator.ts +24 -0
- package/src/presentation/screen/__tests__/capture_ui_state.test.ts +66 -47
- package/src/presentation/screen/__tests__/ess_turn_haptics.test.ts +15 -11
- package/src/presentation/screen/__tests__/instructions_screen_helpers.test.ts +15 -3
- package/src/presentation/screen/__tests__/scan_state_to_overlay_state.test.ts +47 -27
- package/src/presentation/screen/__tests__/use_smile_id_capture_screen.test.tsx +182 -18
- package/src/presentation/screen/__tests__/use_smile_id_document_back_instructions.test.tsx +1 -1
- package/src/presentation/screen/__tests__/use_smile_id_preview_screen.test.tsx +10 -40
- package/src/presentation/screen/helpers/__tests__/use_capture_orientation_lock.test.tsx +212 -0
- package/src/presentation/screen/helpers/capture_screen_helpers.ts +1 -0
- package/src/presentation/screen/helpers/capture_ui_state.ts +27 -27
- package/src/presentation/screen/helpers/ess_turn_haptics.ts +9 -9
- package/src/presentation/screen/helpers/instructions_screen_helpers.ts +7 -2
- package/src/presentation/screen/helpers/scan_state_to_overlay_state.ts +16 -13
- package/src/presentation/screen/helpers/use_capture_orientation_lock.ts +69 -7
- package/src/presentation/screen/use_smile_id_capture_screen.tsx +280 -54
- package/src/presentation/screen/use_smile_id_consent_screen.tsx +16 -5
- package/src/presentation/screen/use_smile_id_document_back_instructions.tsx +14 -23
- package/src/presentation/screen/use_smile_id_document_preview_screen.tsx +33 -23
- package/src/presentation/screen/use_smile_id_instructions_screen.tsx +4 -0
- package/src/presentation/screen/use_smile_id_preview_screen.tsx +21 -53
- package/src/presentation/screen/use_smile_id_processing_screen.tsx +8 -8
- package/src/presentation/theme/theme.ts +21 -19
- package/src/presentation/utils/__tests__/locale_utils.test.ts +46 -5
- package/src/presentation/utils/force_max_brightness.tsx +4 -4
- package/src/presentation/utils/locale_utils.ts +13 -4
- package/src/testing/__tests__/fake_face_analyzer.test.ts +42 -0
- package/src/testing/__tests__/scenario_expectations.test.ts +110 -0
- package/src/testing/__tests__/scenario_loader.test.ts +64 -0
- package/src/testing/fake_face_analyzer.ts +82 -0
- package/src/testing/index.ts +15 -0
- package/src/testing/scenario_expectations.ts +87 -0
- package/src/testing/scenario_loader.ts +83 -0
- package/src/testing/scripted_scan_results.ts +66 -0
- package/dist/camera/frame_processor_plugin.d.ts +0 -28
- package/dist/camera/frame_processor_plugin.d.ts.map +0 -1
- package/dist/camera/frame_processor_plugin.js +0 -21
- package/dist/camera/frame_processor_plugin.js.map +0 -1
- package/dist/camera/use_smile_id_frame_processor.d.ts +0 -38
- package/dist/camera/use_smile_id_frame_processor.d.ts.map +0 -1
- package/dist/camera/use_smile_id_frame_processor.js +0 -2
- package/dist/camera/use_smile_id_frame_processor.js.map +0 -1
- package/dist/presentation/components/use_smile_id_document_frame_glyph.d.ts +0 -17
- package/dist/presentation/components/use_smile_id_document_frame_glyph.d.ts.map +0 -1
- package/dist/presentation/components/use_smile_id_document_frame_glyph.js +0 -17
- package/dist/presentation/components/use_smile_id_document_frame_glyph.js.map +0 -1
- package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_animation.d.ts +0 -24
- package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_animation.d.ts.map +0 -1
- package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_animation.js +0 -91
- package/dist/presentation/components/use_smile_id_enhanced_smart_selfie_animation.js.map +0 -1
- package/dist/presentation/components/use_smile_id_face_silhouette_overlay.d.ts +0 -15
- package/dist/presentation/components/use_smile_id_face_silhouette_overlay.d.ts.map +0 -1
- package/dist/presentation/components/use_smile_id_face_silhouette_overlay.js +0 -19
- package/dist/presentation/components/use_smile_id_face_silhouette_overlay.js.map +0 -1
- package/dist/presentation/components/use_smile_id_instruction_card.d.ts +0 -31
- package/dist/presentation/components/use_smile_id_instruction_card.d.ts.map +0 -1
- package/dist/presentation/components/use_smile_id_instruction_card.js +0 -43
- package/dist/presentation/components/use_smile_id_instruction_card.js.map +0 -1
- package/dist/presentation/screen/helpers/use_document_orientation_lock.d.ts +0 -24
- package/dist/presentation/screen/helpers/use_document_orientation_lock.d.ts.map +0 -1
- package/dist/presentation/screen/helpers/use_document_orientation_lock.js +0 -47
- package/dist/presentation/screen/helpers/use_document_orientation_lock.js.map +0 -1
- package/src/presentation/components/use_smile_id_document_frame_glyph.tsx +0 -162
- package/src/presentation/components/use_smile_id_face_silhouette_overlay.tsx +0 -27
|
@@ -20,6 +20,14 @@ declare function atob(data: string): string;
|
|
|
20
20
|
*/
|
|
21
21
|
export type DecodedToken = {
|
|
22
22
|
readonly sdkConfig?: SdkConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Canonical `partner_id` from the top-level JWT claim (server-padded form,
|
|
25
|
+
* e.g. `"002"`), which can differ from the partner-supplied config string
|
|
26
|
+
* (`"2"`). The Smile EXIF tagger keys its HMAC/AES derivation on this so the
|
|
27
|
+
* stamped value matches the partner_id the backend validates against.
|
|
28
|
+
* `undefined` when the claim is absent.
|
|
29
|
+
*/
|
|
30
|
+
readonly partnerId?: string;
|
|
23
31
|
};
|
|
24
32
|
|
|
25
33
|
/**
|
|
@@ -40,6 +48,73 @@ export type DecodedToken = {
|
|
|
40
48
|
* This function never throws — all failure paths return a value.
|
|
41
49
|
*/
|
|
42
50
|
export function decodeSmileIDToken(token: string): DecodedToken | undefined {
|
|
51
|
+
const payloadObject = parseJwtPayloadObject(token);
|
|
52
|
+
if (payloadObject === undefined) return undefined;
|
|
53
|
+
|
|
54
|
+
// Canonical partner_id — a TOP-LEVEL claim (server-padded form, e.g. "002"), a sibling of
|
|
55
|
+
// `sdk_config`. The EXIF tagger keys on this so the stamped value matches the backend. Spread
|
|
56
|
+
// in only when present so `exactOptionalPropertyTypes` isn't violated by an explicit undefined.
|
|
57
|
+
const rawPartnerId = payloadObject["partner_id"];
|
|
58
|
+
const partnerIdField =
|
|
59
|
+
typeof rawPartnerId === "string" ? { partnerId: rawPartnerId } : {};
|
|
60
|
+
|
|
61
|
+
const rawClaim = payloadObject["sdk_config"];
|
|
62
|
+
|
|
63
|
+
if (rawClaim === undefined || rawClaim === null) {
|
|
64
|
+
// No claim present — defaults apply throughout the flow.
|
|
65
|
+
return { ...partnerIdField };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (typeof rawClaim !== "object" || Array.isArray(rawClaim)) {
|
|
69
|
+
// Claim exists but is not an object — treat as absent.
|
|
70
|
+
return { ...partnerIdField };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const parseResult = sdkConfigSchema.safeParse(rawClaim);
|
|
74
|
+
if (!parseResult.success) {
|
|
75
|
+
// Zod rejected the claim shape — degrade to defaults.
|
|
76
|
+
if (!(parseResult.error instanceof ZodError)) {
|
|
77
|
+
// Unreachable in practice (safeParse always gives ZodError on
|
|
78
|
+
// failure), but degrade gracefully to preserve the never-throws
|
|
79
|
+
// contract rather than surfacing an unexpected error type.
|
|
80
|
+
return { ...partnerIdField };
|
|
81
|
+
}
|
|
82
|
+
return { ...partnerIdField };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return { sdkConfig: parseResult.data, ...partnerIdField };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Extract the server-driven security policy bit-code from the token's **top-level** `policy` claim
|
|
90
|
+
* (a sibling of `sdk_config`, not nested inside it — mirroring the backend and the v11
|
|
91
|
+
* `/v1/auth_smile` response).
|
|
92
|
+
*
|
|
93
|
+
* Internal-only: deliberately NOT re-exported from the package entrypoint (`src/index.ts`), so the
|
|
94
|
+
* policy never widens the partner-facing API. It rides here — alongside the decoder — rather than
|
|
95
|
+
* on the exported {@link DecodedToken} for the same reason. See `SecurityPolicy` and
|
|
96
|
+
* `docs/Policy.md`.
|
|
97
|
+
*
|
|
98
|
+
* Returns `undefined` when the token is unparseable or carries no numeric top-level `policy`. The
|
|
99
|
+
* caller treats `undefined` as fail-secure (every behaviour active), so this never throws.
|
|
100
|
+
*/
|
|
101
|
+
export function decodeSecurityPolicyBitCode(token: string): number | undefined {
|
|
102
|
+
const payloadObject = parseJwtPayloadObject(token);
|
|
103
|
+
if (payloadObject === undefined) return undefined;
|
|
104
|
+
|
|
105
|
+
const policy = payloadObject["policy"];
|
|
106
|
+
return typeof policy === "number" ? policy : undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Parse the JWT payload (middle segment) into a JSON object, or `undefined` when the token is
|
|
111
|
+
* structurally invalid (not exactly three `.`-delimited segments, non-base64url payload, or a
|
|
112
|
+
* non-object JSON payload). Shared by {@link decodeSmileIDToken} and
|
|
113
|
+
* {@link decodeSecurityPolicyBitCode} so both read the payload the same way.
|
|
114
|
+
*/
|
|
115
|
+
function parseJwtPayloadObject(
|
|
116
|
+
token: string,
|
|
117
|
+
): Record<string, unknown> | undefined {
|
|
43
118
|
const segments = token.split(".");
|
|
44
119
|
if (segments.length !== 3) return undefined;
|
|
45
120
|
|
|
@@ -74,34 +149,7 @@ export function decodeSmileIDToken(token: string): DecodedToken | undefined {
|
|
|
74
149
|
return undefined;
|
|
75
150
|
}
|
|
76
151
|
|
|
77
|
-
|
|
78
|
-
// empty DecodedToken (sdkConfig unset) rather than returning undefined.
|
|
79
|
-
const payloadObject = payload as Record<string, unknown>;
|
|
80
|
-
const rawClaim = payloadObject["sdk_config"];
|
|
81
|
-
|
|
82
|
-
if (rawClaim === undefined || rawClaim === null) {
|
|
83
|
-
// No claim present — defaults apply throughout the flow.
|
|
84
|
-
return {};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (typeof rawClaim !== "object" || Array.isArray(rawClaim)) {
|
|
88
|
-
// Claim exists but is not an object — treat as absent.
|
|
89
|
-
return {};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const parseResult = sdkConfigSchema.safeParse(rawClaim);
|
|
93
|
-
if (!parseResult.success) {
|
|
94
|
-
// Zod rejected the claim shape — degrade to defaults.
|
|
95
|
-
if (!(parseResult.error instanceof ZodError)) {
|
|
96
|
-
// Unreachable in practice (safeParse always gives ZodError on
|
|
97
|
-
// failure), but degrade gracefully to preserve the never-throws
|
|
98
|
-
// contract rather than surfacing an unexpected error type.
|
|
99
|
-
return {};
|
|
100
|
-
}
|
|
101
|
-
return {};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return { sdkConfig: parseResult.data };
|
|
152
|
+
return payload as Record<string, unknown>;
|
|
105
153
|
}
|
|
106
154
|
|
|
107
155
|
/**
|
package/src/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ export {
|
|
|
27
27
|
// subclass holds a stable `errorCode` and `severity` so partner
|
|
28
28
|
// tooling can pivot on either without parsing the message text.
|
|
29
29
|
export {
|
|
30
|
+
AgentModeWithEnhancedLivenessException,
|
|
30
31
|
BuilderValidationException,
|
|
31
32
|
ConsentDeniedException,
|
|
32
33
|
DuplicateScreenTypeException,
|
|
@@ -225,6 +226,11 @@ export {
|
|
|
225
226
|
type UseSmileIDResult,
|
|
226
227
|
} from "./core/models/result";
|
|
227
228
|
export type { ConfigOptions } from "./core/models/config";
|
|
229
|
+
export {
|
|
230
|
+
GlobalPrivacyControl,
|
|
231
|
+
GLOBAL_PRIVACY_CONTROL_WIRE_KEY,
|
|
232
|
+
globalPrivacyControlFromWire,
|
|
233
|
+
} from "./core/models/global_privacy_control";
|
|
228
234
|
export { LogLevel } from "./core/models/network_config";
|
|
229
235
|
export type {
|
|
230
236
|
CacheConfig,
|
|
@@ -374,10 +380,6 @@ export {
|
|
|
374
380
|
UseSmileIDDocumentOverlay,
|
|
375
381
|
type UseSmileIDDocumentOverlayProps,
|
|
376
382
|
} from "./presentation/components/use_smile_id_document_overlay";
|
|
377
|
-
export {
|
|
378
|
-
UseSmileIDFaceSilhouetteOverlay,
|
|
379
|
-
type UseSmileIDFaceSilhouetteOverlayProps,
|
|
380
|
-
} from "./presentation/components/use_smile_id_face_silhouette_overlay";
|
|
381
383
|
export {
|
|
382
384
|
UseSmileIDInstructionsHero,
|
|
383
385
|
type UseSmileIDInstructionsHeroProps,
|
package/src/l10n/strings_en.ts
CHANGED
|
@@ -160,6 +160,7 @@ export const enStrings = {
|
|
|
160
160
|
si_ess_look_left: "Turn your head to the left",
|
|
161
161
|
si_ess_look_right: "Turn your head to the right",
|
|
162
162
|
si_ess_look_up: "Turn your head slightly upwards",
|
|
163
|
+
si_ess_look_at_camera: "Look at the camera",
|
|
163
164
|
si_ess_capture_initial_instruction:
|
|
164
165
|
"Centre your face in the frame and turn your head in the direction of the arrow.",
|
|
165
166
|
si_ess_hold_still: "Hold still…",
|
|
@@ -168,4 +169,4 @@ export const enStrings = {
|
|
|
168
169
|
export type SiKey = keyof typeof enStrings;
|
|
169
170
|
|
|
170
171
|
/** Total canonical key count — pinned in tests to catch a missed addition/deletion at PR time. */
|
|
171
|
-
export const CANONICAL_KEY_COUNT =
|
|
172
|
+
export const CANONICAL_KEY_COUNT = 119 as const;
|
|
@@ -676,6 +676,9 @@ export class UseSmileIDLocalizations {
|
|
|
676
676
|
get siEssLookUp(): string {
|
|
677
677
|
return this._s("si_ess_look_up", enStrings.si_ess_look_up);
|
|
678
678
|
}
|
|
679
|
+
get siEssLookAtCamera(): string {
|
|
680
|
+
return this._s("si_ess_look_at_camera", enStrings.si_ess_look_at_camera);
|
|
681
|
+
}
|
|
679
682
|
get siEssCaptureInitialInstruction(): string {
|
|
680
683
|
return this._s(
|
|
681
684
|
"si_ess_capture_initial_instruction",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { DeviceOrientationCollector } from "../device_orientation_collector";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Regression guard: with no accelerometer samples, `device_movement_detected` must be absent
|
|
7
|
+
* (`null`) and `device_positions` empty — never a sentinel. Mirrored across all four SDKs.
|
|
8
|
+
*/
|
|
9
|
+
describe("DeviceOrientationCollector", () => {
|
|
10
|
+
it("omits movement (null) and positions when no samples were collected", () => {
|
|
11
|
+
const collector = new DeviceOrientationCollector();
|
|
12
|
+
expect(collector.deviceMovementDetected).toBeNull();
|
|
13
|
+
expect(collector.devicePositions).toHaveLength(0);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AnalyzerFactoryKey,
|
|
3
|
+
faceConfigSchema,
|
|
4
|
+
} from "@smileid/usesmileid_bridge";
|
|
5
|
+
import { describe, expect, it } from "vitest";
|
|
6
|
+
|
|
7
|
+
import { DocumentCaptureMode } from "../../core/models/document_capture_mode";
|
|
8
|
+
import { CaptureType } from "../../core/models/ml_config";
|
|
9
|
+
import type { FlowConfiguration } from "../../presentation/flow/config/flow_configuration";
|
|
10
|
+
import { ScreensBuilder } from "../../presentation/flow/dsl/builder/screens_builder";
|
|
11
|
+
import {
|
|
12
|
+
ModelProvider,
|
|
13
|
+
MODEL_DESCRIPTOR_UNKNOWN,
|
|
14
|
+
} from "../model_configuration";
|
|
15
|
+
import { GlobalPrivacyControl } from "../../core/models/global_privacy_control";
|
|
16
|
+
import {
|
|
17
|
+
flowConfigurationToBuilderConfiguration,
|
|
18
|
+
flowConfigurationToModelConfiguration,
|
|
19
|
+
flowConfigurationToSelfieLivenessTelemetry,
|
|
20
|
+
} from "../metadata_configuration_mappers";
|
|
21
|
+
|
|
22
|
+
function flow(
|
|
23
|
+
buildScreens: (screens: ScreensBuilder) => void,
|
|
24
|
+
ml?: FlowConfiguration["ml"],
|
|
25
|
+
): FlowConfiguration {
|
|
26
|
+
const screensBuilder = new ScreensBuilder();
|
|
27
|
+
buildScreens(screensBuilder);
|
|
28
|
+
return {
|
|
29
|
+
screens: screensBuilder.build(),
|
|
30
|
+
...(ml ? { ml } : {}),
|
|
31
|
+
onResult: () => {},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
describe("flowConfigurationToBuilderConfiguration", () => {
|
|
36
|
+
it("reflects the consent screen", () => {
|
|
37
|
+
const config = flowConfigurationToBuilderConfiguration(
|
|
38
|
+
flow((screens) => {
|
|
39
|
+
screens.consent((consent) => {
|
|
40
|
+
consent.partnerIcon = "icon";
|
|
41
|
+
consent.showAttribution = false;
|
|
42
|
+
});
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
expect(config.consentScreenUsed).toBe(true);
|
|
46
|
+
expect(config.consentIconProvided).toBe(true);
|
|
47
|
+
// A React Native consent icon is a ReactNode with no measurable pixel size.
|
|
48
|
+
expect(config.consentIconDimensions).toBeNull();
|
|
49
|
+
expect(config.consentAttributionShown).toBe(false);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("reports consent absent when there is no consent screen", () => {
|
|
53
|
+
const config = flowConfigurationToBuilderConfiguration(
|
|
54
|
+
flow((screens) => screens.instructions()),
|
|
55
|
+
);
|
|
56
|
+
expect(config.consentScreenUsed).toBe(false);
|
|
57
|
+
expect(config.consentIconProvided).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("maps selfie capture flags", () => {
|
|
61
|
+
const config = flowConfigurationToBuilderConfiguration(
|
|
62
|
+
flow((screens) => {
|
|
63
|
+
screens.capture((capture) => {
|
|
64
|
+
capture.captureType = CaptureType.selfie;
|
|
65
|
+
capture.selfie((selfie) => {
|
|
66
|
+
selfie.allowAgentMode = true;
|
|
67
|
+
selfie.enableEnhancedLiveness = true;
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
screens.preview();
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
73
|
+
expect(config.allowAgentMode).toBe(true);
|
|
74
|
+
expect(config.enhancedLivenessEnabled).toBe(true);
|
|
75
|
+
expect(config.selfiePreviewEnabled).toBe(true);
|
|
76
|
+
expect(config.documentPreviewEnabled).toBe(false);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("maps document capture flags and capture mode", () => {
|
|
80
|
+
const config = flowConfigurationToBuilderConfiguration(
|
|
81
|
+
flow((screens) => {
|
|
82
|
+
screens.capture((capture) => {
|
|
83
|
+
capture.captureType = CaptureType.document;
|
|
84
|
+
capture.document((document) => {
|
|
85
|
+
document.captureMode = DocumentCaptureMode.ManualCapture;
|
|
86
|
+
document.allowGalleryUpload = true;
|
|
87
|
+
document.captureBothSides = false;
|
|
88
|
+
document.allowSkipBack = true;
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
screens.preview();
|
|
92
|
+
}),
|
|
93
|
+
);
|
|
94
|
+
expect(config.autoCaptureEnabled).toBe("manual");
|
|
95
|
+
expect(config.allowGalleryUpload).toBe(true);
|
|
96
|
+
expect(config.captureBothSides).toBe(false);
|
|
97
|
+
expect(config.allowSkipBack).toBe(true);
|
|
98
|
+
expect(config.documentPreviewEnabled).toBe(true);
|
|
99
|
+
expect(config.selfiePreviewEnabled).toBe(false);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("maps each document capture mode to the wire enum", () => {
|
|
103
|
+
const modeFor = (captureMode: DocumentCaptureMode): string =>
|
|
104
|
+
flowConfigurationToBuilderConfiguration(
|
|
105
|
+
flow((screens) => {
|
|
106
|
+
screens.capture((capture) => {
|
|
107
|
+
capture.captureType = CaptureType.document;
|
|
108
|
+
capture.document((document) => {
|
|
109
|
+
document.captureMode = captureMode;
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}),
|
|
113
|
+
).autoCaptureEnabled;
|
|
114
|
+
|
|
115
|
+
expect(modeFor(DocumentCaptureMode.AutoCapture)).toBe("auto_capture_only");
|
|
116
|
+
expect(modeFor(DocumentCaptureMode.ManualCapture)).toBe("manual");
|
|
117
|
+
expect(modeFor(DocumentCaptureMode.AutoCaptureWithManualFallback())).toBe(
|
|
118
|
+
"autocapture_default",
|
|
119
|
+
);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("reports submission skipped without a processing screen", () => {
|
|
123
|
+
const selfieOnly = (screens: ScreensBuilder) =>
|
|
124
|
+
screens.capture((capture) => {
|
|
125
|
+
capture.captureType = CaptureType.selfie;
|
|
126
|
+
});
|
|
127
|
+
expect(
|
|
128
|
+
flowConfigurationToBuilderConfiguration(flow(selfieOnly))
|
|
129
|
+
.submissionSkipped,
|
|
130
|
+
).toBe(true);
|
|
131
|
+
expect(
|
|
132
|
+
flowConfigurationToBuilderConfiguration(
|
|
133
|
+
flow((screens) => {
|
|
134
|
+
selfieOnly(screens);
|
|
135
|
+
screens.processing();
|
|
136
|
+
}),
|
|
137
|
+
).submissionSkipped,
|
|
138
|
+
).toBe(false);
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
describe("flowConfigurationToModelConfiguration", () => {
|
|
143
|
+
it("maps the face backend key with the noop document fallback", () => {
|
|
144
|
+
const config = flow(
|
|
145
|
+
(screens) =>
|
|
146
|
+
screens.capture((capture) => {
|
|
147
|
+
capture.captureType = CaptureType.selfie;
|
|
148
|
+
}),
|
|
149
|
+
{
|
|
150
|
+
analyzers: {
|
|
151
|
+
selfieConfig: faceConfigSchema.parse({
|
|
152
|
+
analyzerFactoryKey: AnalyzerFactoryKey.MLKitFace,
|
|
153
|
+
}),
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
);
|
|
157
|
+
const model = flowConfigurationToModelConfiguration(config);
|
|
158
|
+
expect(model.faceModel.provider).toBe(ModelProvider.Google);
|
|
159
|
+
expect(model.faceModel.name).toBe("play-services-mlkit-face-detection");
|
|
160
|
+
expect(model.documentModel.provider).toBe(ModelProvider.Smile);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("falls back to unknown for an ML-free flow", () => {
|
|
164
|
+
const model = flowConfigurationToModelConfiguration(
|
|
165
|
+
flow((screens) =>
|
|
166
|
+
screens.capture((capture) => {
|
|
167
|
+
capture.captureType = CaptureType.selfie;
|
|
168
|
+
}),
|
|
169
|
+
),
|
|
170
|
+
);
|
|
171
|
+
expect(model.faceModel).toEqual(MODEL_DESCRIPTOR_UNKNOWN);
|
|
172
|
+
expect(model.documentModel.provider).toBe(ModelProvider.Smile);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
describe("flowConfigurationToSelfieLivenessTelemetry", () => {
|
|
177
|
+
it("reports smile for a standard selfie flow", () => {
|
|
178
|
+
const telemetry = flowConfigurationToSelfieLivenessTelemetry(
|
|
179
|
+
flow((screens) =>
|
|
180
|
+
screens.capture((capture) => {
|
|
181
|
+
capture.captureType = CaptureType.selfie;
|
|
182
|
+
capture.selfie(() => {});
|
|
183
|
+
}),
|
|
184
|
+
),
|
|
185
|
+
);
|
|
186
|
+
expect(telemetry.activeLivenessType).toBe("smile");
|
|
187
|
+
expect(telemetry.activeLivenessVersion).toBe("2.0.0");
|
|
188
|
+
expect(telemetry.selfieImageOrigin).toBe("front_camera");
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it("reports head_pose when enhanced liveness is on", () => {
|
|
192
|
+
const telemetry = flowConfigurationToSelfieLivenessTelemetry(
|
|
193
|
+
flow((screens) =>
|
|
194
|
+
screens.capture((capture) => {
|
|
195
|
+
capture.captureType = CaptureType.selfie;
|
|
196
|
+
capture.selfie((selfie) => {
|
|
197
|
+
selfie.enableEnhancedLiveness = true;
|
|
198
|
+
});
|
|
199
|
+
}),
|
|
200
|
+
),
|
|
201
|
+
);
|
|
202
|
+
expect(telemetry.activeLivenessType).toBe("head_pose");
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it("reports back_camera in agent mode", () => {
|
|
206
|
+
const telemetry = flowConfigurationToSelfieLivenessTelemetry(
|
|
207
|
+
flow((screens) =>
|
|
208
|
+
screens.capture((capture) => {
|
|
209
|
+
capture.captureType = CaptureType.selfie;
|
|
210
|
+
capture.selfie((selfie) => {
|
|
211
|
+
selfie.allowAgentMode = true;
|
|
212
|
+
});
|
|
213
|
+
}),
|
|
214
|
+
),
|
|
215
|
+
);
|
|
216
|
+
expect(telemetry.selfieImageOrigin).toBe("back_camera");
|
|
217
|
+
expect(telemetry.activeLivenessType).toBe("smile");
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it("is all-null for a document-only flow", () => {
|
|
221
|
+
const telemetry = flowConfigurationToSelfieLivenessTelemetry(
|
|
222
|
+
flow((screens) =>
|
|
223
|
+
screens.capture((capture) => {
|
|
224
|
+
capture.captureType = CaptureType.document;
|
|
225
|
+
}),
|
|
226
|
+
),
|
|
227
|
+
);
|
|
228
|
+
expect(telemetry.activeLivenessType).toBeNull();
|
|
229
|
+
expect(telemetry.selfieImageOrigin).toBeNull();
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it("global privacy control lands in the configuration metadata", () => {
|
|
233
|
+
// Default posture: a snapshot without a config block reports the
|
|
234
|
+
// opt-out baseline.
|
|
235
|
+
expect(
|
|
236
|
+
flowConfigurationToBuilderConfiguration(flow(() => {}))
|
|
237
|
+
.globalPrivacyControl,
|
|
238
|
+
).toBe("opt-out");
|
|
239
|
+
|
|
240
|
+
// Explicit legacy posture flows through the config snapshot.
|
|
241
|
+
const optIn: FlowConfiguration = {
|
|
242
|
+
...flow(() => {}),
|
|
243
|
+
config: {
|
|
244
|
+
enableCrashReporting: true,
|
|
245
|
+
enableDebugMode: false,
|
|
246
|
+
allowOfflineMode: false,
|
|
247
|
+
globalPrivacyControl: GlobalPrivacyControl.OptIn,
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
expect(
|
|
251
|
+
flowConfigurationToBuilderConfiguration(optIn).globalPrivacyControl,
|
|
252
|
+
).toBe("opt-in");
|
|
253
|
+
});
|
|
254
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type BuilderConfiguration,
|
|
5
|
+
builderConfigurationToJson,
|
|
6
|
+
} from "../builder_configuration";
|
|
7
|
+
import {
|
|
8
|
+
type ModelConfiguration,
|
|
9
|
+
ModelProvider,
|
|
10
|
+
modelConfigurationToJson,
|
|
11
|
+
} from "../model_configuration";
|
|
12
|
+
|
|
13
|
+
const builderConfiguration: BuilderConfiguration = {
|
|
14
|
+
consentScreenUsed: true,
|
|
15
|
+
consentIconProvided: true,
|
|
16
|
+
consentIconDimensions: { width: 120, height: 80 },
|
|
17
|
+
consentAttributionShown: true,
|
|
18
|
+
instructionsScreenUsed: true,
|
|
19
|
+
selfiePreviewEnabled: true,
|
|
20
|
+
documentPreviewEnabled: false,
|
|
21
|
+
submissionSkipped: false,
|
|
22
|
+
allowAgentMode: true,
|
|
23
|
+
enhancedLivenessEnabled: false,
|
|
24
|
+
autoCaptureEnabled: "autocapture_default",
|
|
25
|
+
allowGalleryUpload: true,
|
|
26
|
+
captureBothSides: true,
|
|
27
|
+
allowSkipBack: false,
|
|
28
|
+
globalPrivacyControl: "opt-out",
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const modelConfiguration: ModelConfiguration = {
|
|
32
|
+
faceModel: {
|
|
33
|
+
provider: ModelProvider.Google,
|
|
34
|
+
name: "play-services-mlkit-face-detection",
|
|
35
|
+
version: "17.1.0",
|
|
36
|
+
bundled: false,
|
|
37
|
+
},
|
|
38
|
+
documentModel: {
|
|
39
|
+
provider: ModelProvider.Smile,
|
|
40
|
+
name: "noop_document_detector",
|
|
41
|
+
version: "12.0.1",
|
|
42
|
+
bundled: true,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
describe("builder_configuration_object", () => {
|
|
47
|
+
it("serialises the full schema with snake_case keys", () => {
|
|
48
|
+
const json = builderConfigurationToJson(builderConfiguration);
|
|
49
|
+
expect(json.consent_screen_used).toBe(true);
|
|
50
|
+
expect(json.consent_icon_provided).toBe(true);
|
|
51
|
+
expect(json.consent_icon_dimensions).toEqual({ width: 120, height: 80 });
|
|
52
|
+
expect(json.auto_capture_enabled).toBe("autocapture_default");
|
|
53
|
+
expect(json.allow_gallery_upload).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("emits consent_icon_dimensions as null when absent", () => {
|
|
57
|
+
const json = builderConfigurationToJson({
|
|
58
|
+
...builderConfiguration,
|
|
59
|
+
consentIconProvided: false,
|
|
60
|
+
consentIconDimensions: null,
|
|
61
|
+
});
|
|
62
|
+
expect(json.consent_icon_dimensions).toBeNull();
|
|
63
|
+
// round-trips through JSON.stringify as an explicit null, not an omitted key
|
|
64
|
+
const reparsed = JSON.parse(JSON.stringify(json)) as Record<
|
|
65
|
+
string,
|
|
66
|
+
unknown
|
|
67
|
+
>;
|
|
68
|
+
expect("consent_icon_dimensions" in reparsed).toBe(true);
|
|
69
|
+
expect(reparsed.consent_icon_dimensions).toBeNull();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe("model_configuration_object", () => {
|
|
74
|
+
it("serialises both model descriptors", () => {
|
|
75
|
+
const json = modelConfigurationToJson(modelConfiguration);
|
|
76
|
+
const face = json.face_model as Record<string, unknown>;
|
|
77
|
+
expect(face.provider).toBe("google");
|
|
78
|
+
expect(face.name).toBe("play-services-mlkit-face-detection");
|
|
79
|
+
expect(face.version).toBe("17.1.0");
|
|
80
|
+
expect(face.bundled).toBe(false);
|
|
81
|
+
|
|
82
|
+
const document = json.document_model as Record<string, unknown>;
|
|
83
|
+
expect(document.provider).toBe("smile");
|
|
84
|
+
expect(document.bundled).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
UseSmileIDMetadata,
|
|
5
|
+
type UseSmileIDMetadataFields,
|
|
6
|
+
} from "../use_smile_id_metadata";
|
|
7
|
+
|
|
8
|
+
function fields(
|
|
9
|
+
overrides: Partial<UseSmileIDMetadataFields> = {},
|
|
10
|
+
): UseSmileIDMetadataFields {
|
|
11
|
+
return {
|
|
12
|
+
sdkVersion: "12.0.1",
|
|
13
|
+
sdk: "react-native-expo",
|
|
14
|
+
deviceOs: "Android 14",
|
|
15
|
+
deviceModel: "",
|
|
16
|
+
appName: "TestApp",
|
|
17
|
+
sessionId: "session",
|
|
18
|
+
clientIp: "",
|
|
19
|
+
networkConnection: "",
|
|
20
|
+
carrierInfo: "",
|
|
21
|
+
proxy: false,
|
|
22
|
+
timezone: "",
|
|
23
|
+
locale: "",
|
|
24
|
+
screenResolution: "",
|
|
25
|
+
memoryInfoMb: 0,
|
|
26
|
+
deviceOrientation: "",
|
|
27
|
+
systemArchitecture: "",
|
|
28
|
+
numberOfCameras: 0,
|
|
29
|
+
hostApplication: "",
|
|
30
|
+
proximitySensor: false,
|
|
31
|
+
securityPolicyVersion: "",
|
|
32
|
+
sdkConfigSource: "default",
|
|
33
|
+
imageWidth: 0,
|
|
34
|
+
imageHeight: 0,
|
|
35
|
+
livenessImageWidth: 0,
|
|
36
|
+
livenessImageHeight: 0,
|
|
37
|
+
...overrides,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function value(name: string, fieldsValue: UseSmileIDMetadataFields) {
|
|
42
|
+
return new UseSmileIDMetadata(fieldsValue)
|
|
43
|
+
.toEntries()
|
|
44
|
+
.find((entry) => entry.name === name)?.value;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
describe("device-context keys (62-key parity)", () => {
|
|
48
|
+
it("omits the new keys at their defaults", () => {
|
|
49
|
+
const names = new UseSmileIDMetadata(fields())
|
|
50
|
+
.toEntries()
|
|
51
|
+
.map((entry) => entry.name);
|
|
52
|
+
for (const key of [
|
|
53
|
+
"build_brand",
|
|
54
|
+
"build_device",
|
|
55
|
+
"build_fingerprint",
|
|
56
|
+
"build_product",
|
|
57
|
+
"local_time_of_enrolment",
|
|
58
|
+
"battery_status",
|
|
59
|
+
]) {
|
|
60
|
+
expect(names).not.toContain(key);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("emits build + carrier + local time when present", () => {
|
|
65
|
+
const populated = fields({
|
|
66
|
+
buildBrand: "google",
|
|
67
|
+
buildDevice: "husky",
|
|
68
|
+
buildFingerprint: "google/husky:14",
|
|
69
|
+
buildProduct: "husky",
|
|
70
|
+
carrierInfo: "MTN",
|
|
71
|
+
localTimeOfEnrolment: "2026-06-24T10:00:00.000+03:00",
|
|
72
|
+
});
|
|
73
|
+
expect(value("build_brand", populated)).toBe("google");
|
|
74
|
+
expect(value("build_device", populated)).toBe("husky");
|
|
75
|
+
expect(value("build_fingerprint", populated)).toBe("google/husky:14");
|
|
76
|
+
expect(value("build_product", populated)).toBe("husky");
|
|
77
|
+
expect(value("carrier_info", populated)).toBe("MTN");
|
|
78
|
+
expect(value("local_time_of_enrolment", populated)).toBe(
|
|
79
|
+
"2026-06-24T10:00:00.000+03:00",
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("emits battery_status including the meaningful on-battery value", () => {
|
|
84
|
+
expect(value("battery_status", fields({ batteryStatus: 0 }))).toBe("0");
|
|
85
|
+
expect(value("battery_status", fields({ batteryStatus: 1 }))).toBe("1");
|
|
86
|
+
expect(value("battery_status", fields({ batteryStatus: -1 }))).toBe("-1");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("emits wrapper identity when present and omits it when blank", () => {
|
|
90
|
+
const populated = fields({
|
|
91
|
+
wrapperName: "react_native_expo",
|
|
92
|
+
wrapperVersion: "12.0.1",
|
|
93
|
+
});
|
|
94
|
+
expect(value("wrapper_name", populated)).toBe("react_native_expo");
|
|
95
|
+
expect(value("wrapper_version", populated)).toBe("12.0.1");
|
|
96
|
+
|
|
97
|
+
const names = new UseSmileIDMetadata(fields())
|
|
98
|
+
.toEntries()
|
|
99
|
+
.map((entry) => entry.name);
|
|
100
|
+
expect(names).not.toContain("wrapper_name");
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("emits sdk_launch_count when positive and omits it when zero/undefined", () => {
|
|
104
|
+
expect(value("sdk_launch_count", fields({ sdkLaunchCount: 9 }))).toBe("9");
|
|
105
|
+
const zero = new UseSmileIDMetadata(fields({ sdkLaunchCount: 0 }))
|
|
106
|
+
.toEntries()
|
|
107
|
+
.map((entry) => entry.name);
|
|
108
|
+
expect(zero).not.toContain("sdk_launch_count");
|
|
109
|
+
const absent = new UseSmileIDMetadata(fields())
|
|
110
|
+
.toEntries()
|
|
111
|
+
.map((entry) => entry.name);
|
|
112
|
+
expect(absent).not.toContain("sdk_launch_count");
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("emits privileges verbatim and omits it when absent", () => {
|
|
116
|
+
const raw = '{"1":"100010","8":"100100"}';
|
|
117
|
+
expect(value("privileges", fields({ privileges: raw }))).toBe(raw);
|
|
118
|
+
const absent = new UseSmileIDMetadata(fields())
|
|
119
|
+
.toEntries()
|
|
120
|
+
.map((entry) => entry.name);
|
|
121
|
+
expect(absent).not.toContain("privileges");
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it("emits geolocation as a JSON-object string and omits it when absent", () => {
|
|
125
|
+
const raw = value(
|
|
126
|
+
"geolocation",
|
|
127
|
+
fields({
|
|
128
|
+
geolocation: {
|
|
129
|
+
latitude: 1.5,
|
|
130
|
+
longitude: -2.5,
|
|
131
|
+
accuracy: "precise",
|
|
132
|
+
source: "gps",
|
|
133
|
+
},
|
|
134
|
+
}),
|
|
135
|
+
);
|
|
136
|
+
expect(JSON.parse(raw!)).toEqual({
|
|
137
|
+
latitude: 1.5,
|
|
138
|
+
longitude: -2.5,
|
|
139
|
+
accuracy: "precise",
|
|
140
|
+
source: "gps",
|
|
141
|
+
});
|
|
142
|
+
const absent = new UseSmileIDMetadata(fields())
|
|
143
|
+
.toEntries()
|
|
144
|
+
.map((entry) => entry.name);
|
|
145
|
+
expect(absent).not.toContain("geolocation");
|
|
146
|
+
});
|
|
147
|
+
});
|