> For the complete documentation index, see [llms.txt](https://docs.mosip.io/compliance-tool-kit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mosip.io/compliance-tool-kit/developer-guides/ctk-validators.md).

# CTK Validators

### SBI Validators

| Name                              | Description                                                                                                        | Test with Mock SBI                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SchemaValidator`                 | Validates the response for mandatory attributes and correct values.                                                |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `SignatureValidator`              | Validates the response signature.                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `ResponseMisMatchValidator`       | Validates the response to check if bioCount, exceptions, segments and transactionId match the ones set in request. |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `KeyRotationValidator`            | Validator to validate the device key rotation.                                                                     | <p>To verify Key Rotation testcases, we have to generate 3 set of device certificates <code>device.p12</code>.<br>• To generate device.p12 certificate, please follow the instructions given in <a href="https://mosip.atlassian.net/l/cp/9u8PqrGi">link</a><br>• In Compliance Tool kit, create a collection only with Key Rotation test case and Run Mock MDS.<br>• In CTK select respective device by performing <code>Scan Device</code> operation and run <code>key rotation</code> testcase.<br>• Stop the Mock MDS and rotate/change second Device.p12 in Keys folder.<br>• Relaunch mock MDS and select <code>Continue</code> on CTK. Now CKT saved second device key information.<br>• When CTK asks to rotate the device key, then Stop the Mock MDS and rotate/change third Device.p12 in Keys folder.<br>• Relaunch mock MDS and select <code>Continue</code> on CTK. Now CKT saved third device key information.<br><em>Note</em>: <em>Rotate the device key in the MDS/SBI as many times as setup in project configuration</em><br>CTK will provide a result of the overall key rotation testcase once the testcase has been run.</p>                                                                                                                                                                                                                                                            |
| `TimeoutValidator`                | Validates if response is received within the given timeout period or not.                                          | <p>To test <strong>Timeout</strong> testcases with Mock SBI:<br>Call POST API: <code><http://127.0.0.1:4501/admin/delay></code><br>With request body,<br>{<br>"type": "Biometric Device",<br>"delay": "10000",<br>"method": \[<br>"RCAPTURE"]<br>}<br>To test <strong>Force Capture</strong> testcases with Mock SBI:<br>Call POST API: <code><http://127.0.0.1:4501/admin/delay></code><br>With request body,<br>{<br>"type": "Biometric Device",<br>"delay": "9500",<br>"method": \[<br>"RCAPTURE"]<br>}<br>Please try to increase the delay gradually to execute the testcase successfully.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `ISOStandardsValidator`           | Validates the `bioValue` in response of `rcapture` is as per ISO standards ISO19794-4:2011.                        | <p>ISO standard validation with proper <strong>ISO</strong> file by using mock MDS:<br>• Under an SBI project, create a collection by selecting ISO standard testcases.<br>• Run the mock MDS/SBI with standard ISO files. Perform a Scan and select the appropriate device.<br>• Run the ISO collection and verify the result status. ISO standard validation should be success.<br>ISO standard validation with <strong>Non-ISO</strong> files by using mock MDS:<br>• Under an SBI project, create a collection by selecting ISO standard testcases.<br>• Run the mock MDS/SBI with Non-ISO standard files (In Default folder replace standard ISO file with Non-ISO file). Perform a Scan and select the appropriate device.<br>• Run the ISO collection and verify the result status. ISO standard validation should be fail.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `BiometricsQualityCheckValidator` | Checks the quality of biometrics using all configured SDK services.                                                | <p>Biometrics quality check validation with <strong>good quality</strong> biometric:<br>• In compliance-toolkit-default.properties, configure Bio SDK service and health check URLs under <code>mosip.toolkit.sbi.qualitycheck.finger.sdk.urls</code> property. Restart CTK pods/services.<br>Example:<br><code>mosip.toolkit.sbi.qualitycheck.finger.sdk.urls=\[{"name": "Mock SDK qa-1201-b2 Env","url": "<https://api-internal.qa-1201-b2.mosip.net/biosdk-service","healthUrl>": "<https://api-internal.qa-1201-b2.mosip.net/biosdk-service/actuator/health>", "includeInResults":true}]</code><br>• Add Biometric quality testcase in CTK for all modalities (FP, Iris and Face for both Reg and Auth).<br>• Run Mock MDS and increase biometric quality score to get more than threshold value.<br>• In CTK scan the biometric devices and run the Biometric quality check testcases.<br>• After testcase execution is done, please check testcase result status. Biometric quality check validator should pass.<br>Biometrics quality check validation with <strong>poor quality</strong>biometric:<br>• Change the biometric quality score to less than the threshold value and run the Biometric quality check testcases.<br>• After testcase execution is done, please check testcase result status. Biometric quality check validator should fail because quality score is less than threshold.</p> |
| `TimeCheckValidator`              | Validates if response is received within the given timestamp interval or not.                                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `HashValidator`                   | Validates the 'hash value' received in the response matches 'previous hash' in request.                            |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |

### SDK Validators

| Name                                  | Description                                                                      | Test with Mock SDK |
| ------------------------------------- | -------------------------------------------------------------------------------- | ------------------ |
| `SchemaValidator`                     | Validates if response has all mandatory attributes and they have allowed values. |                    |
| `QualityCheckValidator`               | Checks the quality score of the modality.                                        |                    |
| `QualityCheckInvalidDataValidator`    | Validates the status code for invalid data.                                      |                    |
| `QualityCheckNoDataValidator`         | Validates the status code for no data.                                           |                    |
| `MatchValidator`                      | Validates if biomterics match for the modality.                                  |                    |
| `MatchInvalidDataValidator`           | Validates the status code for invalid data.                                      |                    |
| `MatchNoDataValidator`                | Validates the status code for no data.                                           |                    |
| `MatchMultipleGalleryValidator`       | Validates if biomterics match for the modality.                                  |                    |
| `ExtractTemplateValidator`            | Validates if input BDB data present in the Probe for the modality is valid.      |                    |
| `ExtractTemplateInvalidDataValidator` | Validates if input BDB data present in the Probe for the modality is valid.      |                    |
| `ExtractTemplateNoInputDataValidator` | Validates if no input BDB data present in the Probe.                             |                    |
| `ConvertDataValidator`                | Validates the input BDB data present in the Probe.                               |                    |
| `ConvertInvalidDataValidator`         | Validates if input BDB data present in the Probe for the modality is valid.      |                    |
| `ConvertNoInputDataValidator`         | Validates if no input BDB data present in the Probe.                             |                    |

### ABIS Validators

| Name                              | Description                                                                                           | Test with Mock ABIS |
| --------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------- |
| `SchemaValidator`                 | Validates if response has all mandatory attributes and they have allowed values.                      |                     |
| `ExpectedFailureReasonValidator`  | Validates the failure reason to match the expected value                                              |                     |
| `IdentifyDuplicateFoundValidator` | Validates the count of duplicates found by ABIS for the given referenceId                             |                     |
| `ExpectedDuplicateCountValidator` | Validates the duplicates found to match the expected value.                                           |                     |
| `ABISTokenValidator`              | Validates that ABIS is not generating a new token for every insert request, unless token has expired. |                     |
