mirror of
https://github.com/bitwarden/android.git
synced 2026-05-11 02:15:43 -05:00
Compare commits
2 Commits
v2026.3.1-
...
release/20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ee3e2e249 | ||
|
|
58f4983790 |
@@ -50,6 +50,8 @@ import kotlinx.coroutines.withContext
|
||||
import kotlinx.serialization.json.Json
|
||||
import timber.log.Timber
|
||||
|
||||
private const val DAL_ROUTE = ".well-known/assetlinks.json"
|
||||
|
||||
/**
|
||||
* Primary implementation of [BitwardenCredentialManager].
|
||||
*/
|
||||
@@ -123,7 +125,7 @@ class BitwardenCredentialManagerImpl(
|
||||
.getSignatureFingerprintAsHexString()
|
||||
.orEmpty(),
|
||||
host = hostUrl,
|
||||
assetLinkUrl = hostUrl,
|
||||
assetLinkUrl = hostUrl.toDigitalAssetLinkUrl(),
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -316,7 +318,7 @@ class BitwardenCredentialManagerImpl(
|
||||
packageName = callingAppInfo.packageName,
|
||||
sha256CertFingerprint = signatureFingerprint,
|
||||
host = host,
|
||||
assetLinkUrl = host,
|
||||
assetLinkUrl = host.toDigitalAssetLinkUrl(),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -428,6 +430,13 @@ class BitwardenCredentialManagerImpl(
|
||||
?.relyingParty
|
||||
?.id
|
||||
?.prefixHttpsIfNecessaryOrNull()
|
||||
|
||||
private fun String.toDigitalAssetLinkUrl(): String =
|
||||
when {
|
||||
this.endsWith(DAL_ROUTE) -> this
|
||||
this.endsWith("/") -> "$this$DAL_ROUTE"
|
||||
else -> "$this/$DAL_ROUTE"
|
||||
}
|
||||
}
|
||||
|
||||
private const val MAX_AUTHENTICATION_ATTEMPTS = 5
|
||||
|
||||
@@ -160,7 +160,7 @@ fun VaultItemListingContent(
|
||||
|
||||
itemsIndexed(
|
||||
items = state.displayCollectionList,
|
||||
key = { _, collection -> collection.id },
|
||||
key = { _, collection -> "collection_${collection.id}" },
|
||||
) { index, collection ->
|
||||
BitwardenGroupItem(
|
||||
startIcon = IconData.Local(iconRes = BitwardenDrawable.ic_collections),
|
||||
@@ -195,7 +195,7 @@ fun VaultItemListingContent(
|
||||
|
||||
itemsIndexed(
|
||||
items = state.displayFolderList,
|
||||
key = { _, folder -> folder.id },
|
||||
key = { _, folder -> "folder_${folder.id}" },
|
||||
) { index, folder ->
|
||||
BitwardenGroupItem(
|
||||
startIcon = IconData.Local(iconRes = BitwardenDrawable.ic_folder),
|
||||
@@ -229,7 +229,7 @@ fun VaultItemListingContent(
|
||||
}
|
||||
itemsIndexed(
|
||||
items = state.displayItemList,
|
||||
key = { _, item -> item.id },
|
||||
key = { _, item -> "item_${item.id}" },
|
||||
) { index, it ->
|
||||
BitwardenListItem(
|
||||
startIcon = it.iconData,
|
||||
|
||||
@@ -142,7 +142,7 @@ fun VaultContent(
|
||||
|
||||
itemsIndexed(
|
||||
items = state.favoriteItems,
|
||||
key = { _, favorite -> favorite.id },
|
||||
key = { _, favorite -> "favorite_${favorite.id}" },
|
||||
) { index, favoriteItem ->
|
||||
VaultEntryListItem(
|
||||
startIcon = favoriteItem.startIcon,
|
||||
@@ -307,7 +307,7 @@ fun VaultContent(
|
||||
|
||||
itemsIndexed(
|
||||
items = state.folderItems,
|
||||
key = { _, folder -> folder.id ?: "no_folder_group" },
|
||||
key = { _, folder -> "folder_${folder.id}" },
|
||||
) { index, folder ->
|
||||
BitwardenGroupItem(
|
||||
startIcon = IconData.Local(iconRes = BitwardenDrawable.ic_folder),
|
||||
@@ -344,7 +344,7 @@ fun VaultContent(
|
||||
}
|
||||
itemsIndexed(
|
||||
items = state.noFolderItems,
|
||||
key = { _, noFolderItem -> noFolderItem.id },
|
||||
key = { _, noFolderItem -> "no_folder_${noFolderItem.id}" },
|
||||
) { index, noFolderItem ->
|
||||
VaultEntryListItem(
|
||||
startIcon = noFolderItem.startIcon,
|
||||
@@ -400,7 +400,7 @@ fun VaultContent(
|
||||
|
||||
itemsIndexed(
|
||||
items = state.collectionItems,
|
||||
key = { _, collection -> collection.id },
|
||||
key = { _, collection -> "collection_${collection.id}" },
|
||||
) { index, collection ->
|
||||
BitwardenGroupItem(
|
||||
startIcon = IconData.Local(iconRes = BitwardenDrawable.ic_collections),
|
||||
|
||||
@@ -681,7 +681,8 @@ class BitwardenCredentialManagerTest {
|
||||
DEFAULT_PACKAGE_NAME,
|
||||
DEFAULT_CERT_FINGERPRINT,
|
||||
"https://${mockAssertionOptions.relyingPartyId!!}",
|
||||
"https://${mockAssertionOptions.relyingPartyId}",
|
||||
@Suppress("MaxLineLength")
|
||||
"https://${mockAssertionOptions.relyingPartyId}/.well-known/assetlinks.json",
|
||||
),
|
||||
),
|
||||
requestCaptureSlot.captured.origin,
|
||||
@@ -1499,7 +1500,7 @@ private val DEFAULT_ANDROID_ORIGIN = Origin.Android(
|
||||
packageName = DEFAULT_PACKAGE_NAME,
|
||||
sha256CertFingerprint = DEFAULT_CERT_FINGERPRINT,
|
||||
host = "https://$DEFAULT_HOST",
|
||||
assetLinkUrl = "https://$DEFAULT_HOST",
|
||||
assetLinkUrl = "https://$DEFAULT_HOST/.well-known/assetlinks.json",
|
||||
),
|
||||
)
|
||||
private val DEFAULT_WEB_ORIGIN = Origin.Web("bitwarden.com")
|
||||
|
||||
Reference in New Issue
Block a user