BIT-282: Include Bitwarden SDK dependency (#44)

This commit is contained in:
Brian Yencho 2023-09-14 16:27:34 -05:00 committed by Álison Fernandes
parent 8fdfcb1ea2
commit dd4b937061
6 changed files with 56 additions and 1 deletions

View file

@ -5,6 +5,7 @@ on:
pull_request:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JAVA_VERSION: 17
jobs:

View file

@ -22,7 +22,11 @@
$ git clone https://github.com/bitwarden/android
```
2. Setup the code style formatter:
2. Create a `user.properties` file in the root directory of the project and add the following properties:
- `gitHubToken`: A "classic" Github Personal Access Token (PAT) with the `read:packages` scope (ex: `gitHubToken=gph_xx...xx`). These can be generated by going to the [Github tokens page](https://github.com/settings/tokens). See [the Github Packages user documentation concerning authentication](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#authenticating-to-github-packages) for more details.
3. Setup the code style formatter:
All code must follow the guidelines described in the [Code Style Guidelines document](docs/STYLE_AND_BEST_PRACTICES.md). To aid in adhering to these rules, all contributors should apply `docs/bitwarden-style.xml` as their code style scheme. In IntelliJ / Android Studio:

View file

@ -82,6 +82,7 @@ dependencies {
implementation(libs.androidx.room.ktx)
implementation(libs.androidx.room.runtime)
implementation(platform(libs.google.firebase.bom))
implementation(libs.bitwarden.sdk)
implementation(libs.bumptech.glide)
implementation(libs.google.firebase.cloud.messaging)
implementation(libs.google.firebase.crashlytics)

View file

@ -0,0 +1,22 @@
package com.x8bit.bitwarden.data.platform.datasource.di
import com.bitwarden.sdk.Client
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
/**
* Provides dependencies related to encryption / decryption / secure generation.
*/
@Module
@InstallIn(SingletonComponent::class)
object EncryptionModule {
@Provides
@Singleton
fun provideBitwardenClient(): Client {
return Client(null)
}
}

View file

@ -20,6 +20,9 @@ androidxLifecycle = "2.6.1"
# child navigation destinations (BIT-201).
androidxNavigation = "2.5.3"
androidxRoom = "2.5.2"
# Once the app and SDK reach a critical point of completeness we should begin fixing the version
# here (BIT-311).
bitwardenSdk = "ps-maven-SNAPSHOT"
detekt = "1.23.1"
firebaseBom = "32.2.2"
glide = "4.15.1"
@ -61,6 +64,7 @@ androidx-navigation-compose = { module = "androidx.navigation:navigation-compose
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "androidxRoom" }
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "androidxRoom" }
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "androidxRoom" }
bitwarden-sdk = { module = "com.bitwarden:sdk-android", version.ref = "bitwardenSdk" }
bumptech-glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" }
detekt-detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" }
detekt-detekt-rules = { module = "io.gitlab.arturbosch.detekt:detekt-rules-libraries", version.ref = "detekt" }

View file

@ -1,3 +1,6 @@
import java.io.FileInputStream
import java.util.Properties
pluginManagement {
repositories {
google()
@ -5,11 +8,31 @@ pluginManagement {
gradlePluginPortal()
}
}
/**
* Loads local user-specific build properties that are not checked into source control.
*/
val userProperties = Properties().apply {
val buildPropertiesFile = File(rootDir, "user.properties")
if (buildPropertiesFile.exists()) {
FileInputStream(buildPropertiesFile).use { load(it) }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
name = "GitHubPackages (Bitwarden)"
url = uri("https://maven.pkg.github.com/bitwarden/sdk")
credentials {
username = ""
password = userProperties["gitHubToken"] as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}
}