Skip to content

pia-foss/mobile-shared-csi

Repository files navigation

PIA logo

Private Internet Access

Private Internet Access is the world's leading consumer VPN service. At Private Internet Access we believe in unfettered access for all, and as a firm supporter of the open source ecosystem we have made the decision to open source our VPN clients. For more information about the PIA service, please visit our website privateinternetaccess.com or check out the Wiki.

CSI common library for Android and Apple platforms

With this library, clients from iOS and Android can submit debug information.

Installation

Requirements

  • Git (latest)
  • Xcode (latest)
  • Android Studio (latest)
  • Gradle (latest)
  • ADB installed
  • NDK (latest)
  • Android 4.1+

Download Codebase

Using the terminal:

git clone https://github.com/pia-foss/mobile-common-csi.git *folder-name*

type in what folder you want to put in without the **

Building

Once the project is cloned, you can build the binaries by running the tasks ./gradlew bundleDebugAar or ./gradlew bundleReleaseAar for Android. And, ./gradlew assembleCsiDebugXCFramework or ./gradlew assembleCsiReleaseXCFramework for iOS. You can find the binaries at [PROJECT_DIR]/csi/build/outputs/aar and [PROJECT_DIR]/csi/build/XCFrameworks accordingly.

Usage

Android

To use this project in Android, you can run the task ./gradlew publishAndroidReleasePublicationToMavenLocal. This will publish the package to your maven local (Make sure to have included mavenLocal() as part of your gradle repositories). Once successful, you can set the dependency as per any other package, e.g.:

implementation("com.kape.android:csi:[version_number]")

where [version_number] is the version as set in csi/build.gradle.kts.

iOS

To use this project in iOS, once you have built csi.xcframework. You can go to your project target. Build Phases. Link Binary With Libraries. (or alternatively drag the file there and skip the rest) Click the +. Add Other. Add Files. And look for csi.xcframework.

Documentation

Architecture

The library is formed by two layers. The common layer. Containing the business logic for all platforms. And, the bridging layer. Containing the platform specific logic being injected into the common layer.

Code structure via packages:

  • commonMain - Common business logic.
  • androidMain - Android's bridging layer, providing the platform specific dependencies.
  • iosMain - iOS's bridging layer, providing the platform specific dependencies.

Significant Classes and Interfaces

  • CSIBuilder - Public builder class responsible for creating an instance of an object conforming to CSIAPI interface.
  • CSIAPI - Public interfaces defining the API to be offered by the library to the clients.
  • CSIHttpClient - Class defining the certificate pinning logic on each platform.

Contributing

By contributing to this project you are agreeing to the terms stated in the Contributor License Agreement (CLA) here.

For more details please see CONTRIBUTING.

Issues and Pull Requests should use these templates: ISSUE and PULL REQUEST.

Authors

License

This project is licensed under the MIT (Expat) license, which can be found here.

Acknowledgements