mirror of
https://github.com/bitwarden/android.git
synced 2026-05-22 14:11:47 -05:00
Fix crash when parsing JWT and 'name' property is not present in the … (#146)
Co-authored-by: David Perez <david@livefront.com>
This commit is contained in:
committed by
Álison Fernandes
parent
284cd9ab54
commit
4ebaec7970
@@ -2,12 +2,19 @@ package com.x8bit.bitwarden.data.auth.repository.util
|
||||
|
||||
import com.x8bit.bitwarden.data.auth.repository.model.JwtTokenDataJson
|
||||
import com.x8bit.bitwarden.data.platform.datasource.network.util.base64UrlDecodeOrNull
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
/**
|
||||
* Internal, generally basic [Json] instance for JWT parsing purposes.
|
||||
*/
|
||||
private val json by lazy { Json { ignoreUnknownKeys = true } }
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
private val json: Json by lazy {
|
||||
Json {
|
||||
ignoreUnknownKeys = true
|
||||
explicitNulls = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a [JwtTokenDataJson] from the given [jwtToken], or `null` if this parsing is not possible.
|
||||
|
||||
Reference in New Issue
Block a user