mirror of
https://github.com/bitwarden/android.git
synced 2025-12-11 04:39:19 -06:00
[PM-19846] Mark network module implementation details internal (#5115)
This commit is contained in:
parent
23ef5b38fe
commit
7436122953
@ -9,7 +9,6 @@ import com.bitwarden.network.BitwardenServiceClient
|
||||
import com.bitwarden.network.bitwardenServiceClient
|
||||
import com.bitwarden.network.interceptor.AuthTokenProvider
|
||||
import com.bitwarden.network.interceptor.BaseUrlsProvider
|
||||
import com.bitwarden.network.interceptor.HeadersInterceptor
|
||||
import com.bitwarden.network.model.BitwardenServiceClientConfig
|
||||
import com.bitwarden.network.service.ConfigService
|
||||
import com.bitwarden.network.ssl.CertificateProvider
|
||||
@ -37,14 +36,6 @@ object PlatformNetworkModule {
|
||||
bitwardenServiceClient: BitwardenServiceClient,
|
||||
): ConfigService = bitwardenServiceClient.configService
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun providesHeadersInterceptor(): HeadersInterceptor = HeadersInterceptor(
|
||||
userAgent = HEADER_VALUE_USER_AGENT,
|
||||
clientName = HEADER_VALUE_CLIENT_NAME,
|
||||
clientVersion = HEADER_VALUE_CLIENT_VERSION,
|
||||
)
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideBitwardenServiceClient(
|
||||
|
||||
@ -13,7 +13,7 @@ import retrofit2.http.POST
|
||||
/**
|
||||
* Defines raw calls under the /accounts API with authentication applied.
|
||||
*/
|
||||
interface AuthenticatedAccountsApi {
|
||||
internal interface AuthenticatedAccountsApi {
|
||||
|
||||
/**
|
||||
* Converts the currently active account to a key-connector account.
|
||||
|
||||
@ -14,7 +14,7 @@ import retrofit2.http.Path
|
||||
/**
|
||||
* Defines authenticated raw calls under the /auth-requests API.
|
||||
*/
|
||||
interface AuthenticatedAuthRequestsApi {
|
||||
internal interface AuthenticatedAuthRequestsApi {
|
||||
|
||||
/**
|
||||
* Notifies the server of a new admin authentication request.
|
||||
|
||||
@ -12,7 +12,7 @@ import retrofit2.http.Path
|
||||
* Defines raw calls under the /devices API that require authentication.
|
||||
*/
|
||||
@Keep
|
||||
interface AuthenticatedDevicesApi {
|
||||
internal interface AuthenticatedDevicesApi {
|
||||
@PUT("/devices/{appId}/keys")
|
||||
suspend fun updateTrustedDeviceKeys(
|
||||
@Path(value = "appId") appId: String,
|
||||
|
||||
@ -11,7 +11,7 @@ import retrofit2.http.Url
|
||||
* Defines raw calls specific for key connectors that use custom urls.
|
||||
*/
|
||||
@Keep
|
||||
interface AuthenticatedKeyConnectorApi {
|
||||
internal interface AuthenticatedKeyConnectorApi {
|
||||
@POST
|
||||
suspend fun storeMasterKeyToKeyConnector(
|
||||
@Url url: String,
|
||||
|
||||
@ -13,7 +13,7 @@ import retrofit2.http.Path
|
||||
/**
|
||||
* Defines raw calls under the authenticated /organizations API.
|
||||
*/
|
||||
interface AuthenticatedOrganizationApi {
|
||||
internal interface AuthenticatedOrganizationApi {
|
||||
/**
|
||||
* Enrolls this user in the organization's password reset.
|
||||
*/
|
||||
|
||||
@ -11,7 +11,7 @@ import retrofit2.http.Url
|
||||
/**
|
||||
* Defines raw calls to the Azure API without any authentication applied.
|
||||
*/
|
||||
interface AzureApi {
|
||||
internal interface AzureApi {
|
||||
/**
|
||||
* Attempts to upload an encrypted file to Azure.
|
||||
*/
|
||||
|
||||
@ -22,7 +22,7 @@ import retrofit2.http.Query
|
||||
* Defines raw calls under the /ciphers API with authentication applied.
|
||||
*/
|
||||
@Suppress("TooManyFunctions")
|
||||
interface CiphersApi {
|
||||
internal interface CiphersApi {
|
||||
|
||||
/**
|
||||
* Create a cipher.
|
||||
|
||||
@ -7,7 +7,7 @@ import retrofit2.http.GET
|
||||
/**
|
||||
* This interface defines the API service for fetching configuration data.
|
||||
*/
|
||||
interface ConfigApi {
|
||||
internal interface ConfigApi {
|
||||
|
||||
@GET("config")
|
||||
suspend fun getConfig(): NetworkResult<ConfigResponseJson>
|
||||
|
||||
@ -10,7 +10,7 @@ import retrofit2.http.Query
|
||||
* Defines calls to a digital asset link file.
|
||||
*/
|
||||
@Keep
|
||||
interface DigitalAssetLinkApi {
|
||||
internal interface DigitalAssetLinkApi {
|
||||
|
||||
/**
|
||||
* Checks if the given [relation] exists in a digital asset link file.
|
||||
|
||||
@ -9,7 +9,7 @@ import retrofit2.http.Url
|
||||
/**
|
||||
* Defines endpoints to retrieve content from arbitrary URLs.
|
||||
*/
|
||||
interface DownloadApi {
|
||||
internal interface DownloadApi {
|
||||
/**
|
||||
* Streams data from a [url].
|
||||
*/
|
||||
|
||||
@ -8,7 +8,7 @@ import retrofit2.http.POST
|
||||
/**
|
||||
* This interface defines the API service for posting event data.
|
||||
*/
|
||||
interface EventApi {
|
||||
internal interface EventApi {
|
||||
@POST("/collect")
|
||||
suspend fun collectOrganizationEvents(
|
||||
@Body events: List<OrganizationEventJson>,
|
||||
|
||||
@ -13,7 +13,7 @@ import retrofit2.http.Path
|
||||
/**
|
||||
* Defines raw calls under the /folders API with authentication applied.
|
||||
*/
|
||||
interface FoldersApi {
|
||||
internal interface FoldersApi {
|
||||
|
||||
/**
|
||||
* Create a folder.
|
||||
|
||||
@ -9,7 +9,7 @@ import retrofit2.http.Path
|
||||
* Defines endpoints for the "have I been pwned" API. For docs see
|
||||
* https://haveibeenpwned.com/API/v2.
|
||||
*/
|
||||
interface HaveIBeenPwnedApi {
|
||||
internal interface HaveIBeenPwnedApi {
|
||||
|
||||
@GET("/range/{hashPrefix}")
|
||||
suspend fun fetchBreachedPasswords(
|
||||
|
||||
@ -9,7 +9,7 @@ import retrofit2.http.Path
|
||||
/**
|
||||
* Defines API calls for push tokens.
|
||||
*/
|
||||
interface PushApi {
|
||||
internal interface PushApi {
|
||||
@PUT("/devices/identifier/{appId}/token")
|
||||
suspend fun putDeviceToken(
|
||||
@Path("appId") appId: String,
|
||||
|
||||
@ -17,7 +17,7 @@ import retrofit2.http.Path
|
||||
* Defines raw calls under the /send API with authentication applied.
|
||||
*/
|
||||
@Keep
|
||||
interface SendsApi {
|
||||
internal interface SendsApi {
|
||||
|
||||
/**
|
||||
* Create a text send.
|
||||
|
||||
@ -7,7 +7,7 @@ import retrofit2.http.GET
|
||||
/**
|
||||
* This interface defines the API service for fetching vault data.
|
||||
*/
|
||||
interface SyncApi {
|
||||
internal interface SyncApi {
|
||||
/**
|
||||
* Retrieves the vault data from the server.
|
||||
*
|
||||
|
||||
@ -13,7 +13,7 @@ import retrofit2.http.POST
|
||||
/**
|
||||
* Defines raw calls under the /accounts API.
|
||||
*/
|
||||
interface UnauthenticatedAccountsApi {
|
||||
internal interface UnauthenticatedAccountsApi {
|
||||
@POST("/accounts/password-hint")
|
||||
suspend fun passwordHintRequest(
|
||||
@Body body: PasswordHintRequestJson,
|
||||
|
||||
@ -13,7 +13,7 @@ import retrofit2.http.Query
|
||||
/**
|
||||
* Defines unauthenticated raw calls under the /auth-requests API.
|
||||
*/
|
||||
interface UnauthenticatedAuthRequestsApi {
|
||||
internal interface UnauthenticatedAuthRequestsApi {
|
||||
|
||||
/**
|
||||
* Notifies the server of a new authentication request.
|
||||
|
||||
@ -7,7 +7,7 @@ import retrofit2.http.Header
|
||||
/**
|
||||
* Defines raw calls under the /devices API that do not require authentication.
|
||||
*/
|
||||
interface UnauthenticatedDevicesApi {
|
||||
internal interface UnauthenticatedDevicesApi {
|
||||
@GET("/devices/knowndevice")
|
||||
suspend fun getIsKnownDevice(
|
||||
@Header(value = "X-Request-Email") emailAddress: String,
|
||||
|
||||
@ -24,7 +24,7 @@ import retrofit2.http.Query
|
||||
/**
|
||||
* Defines raw calls under the /identity API.
|
||||
*/
|
||||
interface UnauthenticatedIdentityApi {
|
||||
internal interface UnauthenticatedIdentityApi {
|
||||
|
||||
@POST("/connect/token")
|
||||
@Suppress("LongParameterList")
|
||||
|
||||
@ -15,7 +15,7 @@ import retrofit2.http.Url
|
||||
* Defines raw calls specific for key connectors that use custom urls.
|
||||
*/
|
||||
@Keep
|
||||
interface UnauthenticatedKeyConnectorApi {
|
||||
internal interface UnauthenticatedKeyConnectorApi {
|
||||
@POST
|
||||
suspend fun storeMasterKeyToKeyConnector(
|
||||
@Url url: String,
|
||||
|
||||
@ -11,7 +11,7 @@ import retrofit2.http.POST
|
||||
/**
|
||||
* Defines raw calls under the /organizations API.
|
||||
*/
|
||||
interface UnauthenticatedOrganizationApi {
|
||||
internal interface UnauthenticatedOrganizationApi {
|
||||
/**
|
||||
* Checks for the claimed domain organization of an email for SSO purposes.
|
||||
*/
|
||||
|
||||
@ -20,7 +20,7 @@ private const val NO_CONTENT_RESPONSE_CODE: Int = 204
|
||||
* A [Call] for wrapping a network request into a [NetworkResult].
|
||||
*/
|
||||
@Suppress("TooManyFunctions")
|
||||
class NetworkResultCall<T>(
|
||||
internal class NetworkResultCall<T>(
|
||||
private val backingCall: Call<T>,
|
||||
private val successType: Type,
|
||||
) : Call<NetworkResult<T>> {
|
||||
|
||||
@ -8,7 +8,7 @@ import java.lang.reflect.Type
|
||||
/**
|
||||
* A [retrofit2.CallAdapter] for wrapping network requests into [NetworkResult].
|
||||
*/
|
||||
class NetworkResultCallAdapter<T>(
|
||||
internal class NetworkResultCallAdapter<T>(
|
||||
private val successType: Type,
|
||||
) : CallAdapter<T, Call<NetworkResult<T>>> {
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ import java.lang.reflect.Type
|
||||
/**
|
||||
* A [retrofit2.CallAdapter.Factory] for wrapping network requests into [NetworkResult].
|
||||
*/
|
||||
class NetworkResultCallAdapterFactory : CallAdapter.Factory() {
|
||||
internal class NetworkResultCallAdapterFactory : CallAdapter.Factory() {
|
||||
override fun get(
|
||||
returnType: Type,
|
||||
annotations: Array<out Annotation>,
|
||||
|
||||
@ -9,7 +9,7 @@ import java.io.IOException
|
||||
/**
|
||||
* Interceptor responsible for adding the auth token(Bearer) to API requests.
|
||||
*/
|
||||
class AuthTokenInterceptor(
|
||||
internal class AuthTokenInterceptor(
|
||||
private val authTokenProvider: AuthTokenProvider,
|
||||
) : Interceptor {
|
||||
private val missingTokenMessage = "Auth token is missing!"
|
||||
|
||||
@ -9,7 +9,7 @@ import okhttp3.Response
|
||||
* An [Interceptor] that optionally takes the current base URL of a request and replaces it with
|
||||
* the currently set base URL from the [baseUrlProvider].
|
||||
*/
|
||||
class BaseUrlInterceptor(
|
||||
internal class BaseUrlInterceptor(
|
||||
private val baseUrlProvider: () -> String?,
|
||||
) : Interceptor {
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import com.bitwarden.core.annotation.OmitFromCoverage
|
||||
* An overall container for various [BaseUrlInterceptor] implementations for different API groups.
|
||||
*/
|
||||
@OmitFromCoverage
|
||||
class BaseUrlInterceptors(
|
||||
internal class BaseUrlInterceptors(
|
||||
private val baseUrlsProvider: BaseUrlsProvider,
|
||||
) {
|
||||
/**
|
||||
|
||||
@ -11,7 +11,7 @@ import okhttp3.Response
|
||||
/**
|
||||
* Interceptor responsible for adding various headers to all API requests.
|
||||
*/
|
||||
class HeadersInterceptor(
|
||||
internal class HeadersInterceptor(
|
||||
private val userAgent: String,
|
||||
private val clientName: String,
|
||||
private val clientVersion: String,
|
||||
|
||||
@ -28,7 +28,7 @@ import kotlinx.serialization.json.Json
|
||||
* The default implementation of the [AccountsService].
|
||||
*/
|
||||
@Suppress("TooManyFunctions")
|
||||
class AccountsServiceImpl(
|
||||
internal class AccountsServiceImpl(
|
||||
private val unauthenticatedAccountsApi: UnauthenticatedAccountsApi,
|
||||
private val authenticatedAccountsApi: AuthenticatedAccountsApi,
|
||||
private val unauthenticatedKeyConnectorApi: UnauthenticatedKeyConnectorApi,
|
||||
|
||||
@ -5,7 +5,7 @@ import com.bitwarden.network.model.AuthRequestUpdateRequestJson
|
||||
import com.bitwarden.network.model.AuthRequestsResponseJson
|
||||
import com.bitwarden.network.util.toResult
|
||||
|
||||
class AuthRequestsServiceImpl(
|
||||
internal class AuthRequestsServiceImpl(
|
||||
private val authenticatedAuthRequestsApi: AuthenticatedAuthRequestsApi,
|
||||
) : AuthRequestsService {
|
||||
override suspend fun getAuthRequests(): Result<AuthRequestsResponseJson> =
|
||||
|
||||
@ -30,7 +30,7 @@ import java.time.ZonedDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
@Suppress("TooManyFunctions")
|
||||
class CiphersServiceImpl(
|
||||
internal class CiphersServiceImpl(
|
||||
private val azureApi: AzureApi,
|
||||
private val ciphersApi: CiphersApi,
|
||||
private val json: Json,
|
||||
|
||||
@ -8,6 +8,6 @@ import com.bitwarden.network.util.toResult
|
||||
* Default implementation of [ConfigService] for querying app configurations.
|
||||
*/
|
||||
// TODO [PM-19846] Make internal when dependents are migrated.
|
||||
class ConfigServiceImpl(private val configApi: ConfigApi) : ConfigService {
|
||||
internal class ConfigServiceImpl(private val configApi: ConfigApi) : ConfigService {
|
||||
override suspend fun getConfig(): Result<ConfigResponseJson> = configApi.getConfig().toResult()
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import com.bitwarden.network.util.toResult
|
||||
/**
|
||||
* The default implementation of the [DevicesService].
|
||||
*/
|
||||
class DevicesServiceImpl(
|
||||
internal class DevicesServiceImpl(
|
||||
private val authenticatedDevicesApi: AuthenticatedDevicesApi,
|
||||
private val unauthenticatedDevicesApi: UnauthenticatedDevicesApi,
|
||||
) : DevicesService {
|
||||
|
||||
@ -7,7 +7,7 @@ import com.bitwarden.network.util.toResult
|
||||
/**
|
||||
* Primary implementation of [DigitalAssetLinkService].
|
||||
*/
|
||||
class DigitalAssetLinkServiceImpl(
|
||||
internal class DigitalAssetLinkServiceImpl(
|
||||
private val digitalAssetLinkApi: DigitalAssetLinkApi,
|
||||
) : DigitalAssetLinkService {
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import okhttp3.ResponseBody
|
||||
/**
|
||||
* Default implementation of [DownloadService].
|
||||
*/
|
||||
class DownloadServiceImpl(
|
||||
internal class DownloadServiceImpl(
|
||||
private val downloadApi: DownloadApi,
|
||||
) : DownloadService {
|
||||
override suspend fun getDataStream(
|
||||
|
||||
@ -7,7 +7,7 @@ import com.bitwarden.network.util.toResult
|
||||
/**
|
||||
* The default implementation of the [EventService].
|
||||
*/
|
||||
class EventServiceImpl(
|
||||
internal class EventServiceImpl(
|
||||
private val eventApi: EventApi,
|
||||
) : EventService {
|
||||
override suspend fun sendOrganizationEvents(
|
||||
|
||||
@ -10,7 +10,7 @@ import com.bitwarden.network.util.parseErrorBodyOrNull
|
||||
import com.bitwarden.network.util.toResult
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
class FolderServiceImpl(
|
||||
internal class FolderServiceImpl(
|
||||
private val foldersApi: FoldersApi,
|
||||
private val json: Json,
|
||||
) : FolderService {
|
||||
|
||||
@ -4,7 +4,9 @@ import com.bitwarden.network.api.HaveIBeenPwnedApi
|
||||
import com.bitwarden.network.util.toResult
|
||||
import java.security.MessageDigest
|
||||
|
||||
class HaveIBeenPwnedServiceImpl(private val api: HaveIBeenPwnedApi) : HaveIBeenPwnedService {
|
||||
internal class HaveIBeenPwnedServiceImpl(
|
||||
private val api: HaveIBeenPwnedApi,
|
||||
) : HaveIBeenPwnedService {
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
override suspend fun getPasswordBreachCount(password: String): Result<Int> {
|
||||
|
||||
@ -24,7 +24,7 @@ import com.bitwarden.network.util.parseErrorBodyOrNull
|
||||
import com.bitwarden.network.util.toResult
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
class IdentityServiceImpl(
|
||||
internal class IdentityServiceImpl(
|
||||
private val unauthenticatedIdentityApi: UnauthenticatedIdentityApi,
|
||||
private val json: Json,
|
||||
private val deviceModelProvider: DeviceModelProvider = DeviceModelProvider(),
|
||||
|
||||
@ -11,7 +11,7 @@ import com.bitwarden.network.util.toResult
|
||||
/**
|
||||
* The default implementation of the [NewAuthRequestService].
|
||||
*/
|
||||
class NewAuthRequestServiceImpl(
|
||||
internal class NewAuthRequestServiceImpl(
|
||||
private val authenticatedAuthRequestsApi: AuthenticatedAuthRequestsApi,
|
||||
private val unauthenticatedAuthRequestsApi: UnauthenticatedAuthRequestsApi,
|
||||
) : NewAuthRequestService {
|
||||
|
||||
@ -14,7 +14,7 @@ import com.bitwarden.network.util.toResult
|
||||
/**
|
||||
* Default implementation of [OrganizationService].
|
||||
*/
|
||||
class OrganizationServiceImpl(
|
||||
internal class OrganizationServiceImpl(
|
||||
private val authenticatedOrganizationApi: AuthenticatedOrganizationApi,
|
||||
private val unauthenticatedOrganizationApi: UnauthenticatedOrganizationApi,
|
||||
) : OrganizationService {
|
||||
|
||||
@ -7,7 +7,7 @@ import com.bitwarden.network.util.toResult
|
||||
/**
|
||||
* Default implementation of [PushService].
|
||||
*/
|
||||
class PushServiceImpl(
|
||||
internal class PushServiceImpl(
|
||||
private val pushApi: PushApi,
|
||||
private val appId: String,
|
||||
) : PushService {
|
||||
|
||||
@ -27,7 +27,7 @@ import java.time.format.DateTimeFormatter
|
||||
/**
|
||||
* Default implementation of the [SendsService].
|
||||
*/
|
||||
class SendsServiceImpl(
|
||||
internal class SendsServiceImpl(
|
||||
private val azureApi: AzureApi,
|
||||
private val sendsApi: SendsApi,
|
||||
private val clock: Clock,
|
||||
|
||||
@ -4,7 +4,7 @@ import com.bitwarden.network.api.SyncApi
|
||||
import com.bitwarden.network.model.SyncResponseJson
|
||||
import com.bitwarden.network.util.toResult
|
||||
|
||||
class SyncServiceImpl(
|
||||
internal class SyncServiceImpl(
|
||||
private val syncApi: SyncApi,
|
||||
) : SyncService {
|
||||
override suspend fun sync(): Result<SyncResponseJson> = syncApi
|
||||
|
||||
@ -7,7 +7,7 @@ import retrofit2.Call
|
||||
/**
|
||||
* Synchronously executes the [Call] and returns the [NetworkResult].
|
||||
*/
|
||||
inline fun <reified T : Any> Call<T>.executeForNetworkResult(): NetworkResult<T> =
|
||||
internal inline fun <reified T : Any> Call<T>.executeForNetworkResult(): NetworkResult<T> =
|
||||
this
|
||||
.toNetworkResultCall()
|
||||
.executeForResult()
|
||||
@ -15,7 +15,7 @@ inline fun <reified T : Any> Call<T>.executeForNetworkResult(): NetworkResult<T>
|
||||
/**
|
||||
* Wraps the existing [Call] in a [NetworkResultCall].
|
||||
*/
|
||||
inline fun <reified T : Any> Call<T>.toNetworkResultCall(): NetworkResultCall<T> =
|
||||
internal inline fun <reified T : Any> Call<T>.toNetworkResultCall(): NetworkResultCall<T> =
|
||||
NetworkResultCall(
|
||||
backingCall = this,
|
||||
successType = T::class.java,
|
||||
|
||||
@ -7,7 +7,7 @@ import com.bitwarden.core.annotation.OmitFromCoverage
|
||||
* Provides device model string. Useful for mocking static [Build.MODEL] call tests.
|
||||
*/
|
||||
@OmitFromCoverage
|
||||
class DeviceModelProvider {
|
||||
internal class DeviceModelProvider {
|
||||
|
||||
/**
|
||||
* Device model.
|
||||
|
||||
@ -17,7 +17,7 @@ import retrofit2.HttpException
|
||||
* will be attempted to be parsed.
|
||||
* @param json [Json] serializer to use.
|
||||
*/
|
||||
inline fun <reified T> BitwardenError.parseErrorBodyOrNull(
|
||||
internal inline fun <reified T> BitwardenError.parseErrorBodyOrNull(
|
||||
codes: List<NetworkErrorCode>,
|
||||
json: Json,
|
||||
): T? =
|
||||
@ -31,7 +31,7 @@ inline fun <reified T> BitwardenError.parseErrorBodyOrNull(
|
||||
/**
|
||||
* Helper for calling [parseErrorBodyOrNull] with a single code.
|
||||
*/
|
||||
inline fun <reified T> BitwardenError.parseErrorBodyOrNull(
|
||||
internal inline fun <reified T> BitwardenError.parseErrorBodyOrNull(
|
||||
code: NetworkErrorCode,
|
||||
json: Json,
|
||||
): T? = parseErrorBodyOrNull(codes = listOf(code), json = json)
|
||||
|
||||
@ -3,7 +3,7 @@ package com.bitwarden.network.util
|
||||
/**
|
||||
* The key used for the 'authorization' headers.
|
||||
*/
|
||||
const val HEADER_KEY_AUTHORIZATION: String = "Authorization"
|
||||
internal const val HEADER_KEY_AUTHORIZATION: String = "Authorization"
|
||||
|
||||
/**
|
||||
* The key used for the 'bitwarden-client-name' headers.
|
||||
@ -28,7 +28,7 @@ internal const val HEADER_KEY_DEVICE_TYPE: String = "Device-Type"
|
||||
/**
|
||||
* The bearer prefix used for the 'authorization' headers value.
|
||||
*/
|
||||
const val HEADER_VALUE_BEARER_PREFIX: String = "Bearer "
|
||||
internal const val HEADER_VALUE_BEARER_PREFIX: String = "Bearer "
|
||||
|
||||
/**
|
||||
* The value used for the 'device-type' headers.
|
||||
|
||||
@ -3,7 +3,7 @@ package com.bitwarden.network.util
|
||||
/**
|
||||
* An enum that represents HTTP error codes that we may need to parse for specific responses.
|
||||
*/
|
||||
enum class NetworkErrorCode(
|
||||
internal enum class NetworkErrorCode(
|
||||
val code: Int,
|
||||
) {
|
||||
BAD_REQUEST(code = 400),
|
||||
|
||||
@ -7,7 +7,7 @@ import com.bitwarden.network.model.NetworkResult
|
||||
/**
|
||||
* Converts the [NetworkResult] to a [Result].
|
||||
*/
|
||||
fun <T> NetworkResult<T>.toResult(): Result<T> =
|
||||
internal fun <T> NetworkResult<T>.toResult(): Result<T> =
|
||||
when (this) {
|
||||
is NetworkResult.Failure -> this.throwable.asFailure()
|
||||
is NetworkResult.Success -> this.value.asSuccess()
|
||||
|
||||
@ -7,7 +7,7 @@ import com.bitwarden.network.model.TwoFactorAuthMethod
|
||||
* (Higher value = preference to use the method if it's available)
|
||||
*/
|
||||
@Suppress("MagicNumber")
|
||||
val TwoFactorAuthMethod.priority: Int
|
||||
internal val TwoFactorAuthMethod.priority: Int
|
||||
get() = when (this) {
|
||||
TwoFactorAuthMethod.AUTHENTICATOR_APP -> 1
|
||||
TwoFactorAuthMethod.EMAIL -> 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user