datatheorem / TrustKit-Android

Easy SSL pinning validation and reporting for Android.
MIT License
583 stars 87 forks source link

Kotlin implementation for onCreate override #101

Open sebastianbuechler opened 1 year ago

sebastianbuechler commented 1 year ago

Describe the bug I've used the documentation https://github.com/datatheorem/TrustKit-Android/blob/master/docs/getting-started.md#adding-trustkit-as-a-dependency for integrating TrustKit into a Flutter app with Kotlin. When trying to initialize TrustKit with the Pinning Policy (https://github.com/datatheorem/TrustKit-Android/blob/master/docs/getting-started.md#initializing-trustkit-with-the-pinning-policy) I can only see the java implementation of the onCreate override, but most Flutter applications use by default Kotlin.

What would the override function look like for Kotlin?

TrustKit configuration

<!-- res/xml/network_security_config.xml -->
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
  <!-- Pin the domain www.datatheorem.com -->
  <!-- Official Android N API -->
  <domain-config>
    <domain>www.example.com</domain>
    <pin-set>
      <pin digest="SHA-256">GhPDsCxTrzTCSrlW+tqM8Clv4wTj9t44C8tn+48IS6Y=</pin>
    </pin-set>
    <!-- TrustKit Android API -->
    <!-- Do not enforce pinning validation -->
    <trustkit-config enforcePinning="true">
      <!-- Add a reporting URL for pin validation reports -->
      <report-uri>http://report.datatheorem.com/log_report</report-uri>
    </trustkit-config>
  </domain-config>
</network-security-config>

App details: