Skip to content

add FirebaseAppCheckKtxRegistrar to appcheck-ktx #4003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@

package com.google.firebase.appcheck.ktx

import com.google.firebase.BuildConfig
import com.google.firebase.FirebaseApp
import com.google.firebase.appcheck.AppCheckToken
import com.google.firebase.appcheck.FirebaseAppCheck
import com.google.firebase.components.Component
import com.google.firebase.components.ComponentRegistrar
import com.google.firebase.ktx.Firebase
import com.google.firebase.platforminfo.LibraryVersionComponent

/** Returns the [FirebaseAppCheck] instance of the default [FirebaseApp]. */
val Firebase.appCheck: FirebaseAppCheck
Expand All @@ -39,3 +43,10 @@ operator fun AppCheckToken.component1() = token
* @return the expireTimeMillis of the [AppCheckToken]
*/
operator fun AppCheckToken.component2() = expireTimeMillis

internal const val LIBRARY_NAME: String = "fire-app-check-ktx"

class FirebaseAppCheckKtxRegistrar : ComponentRegistrar {
override fun getComponents(): List<Component<*>> =
listOf(LibraryVersionComponent.create(LIBRARY_NAME, BuildConfig.VERSION_NAME))
}