Skip to content
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

B64-encode documentId in routes for the Activity Log Event details page #809

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
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 @@ -7,6 +7,7 @@ import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.navArgument
import com.android.identity.util.fromBase64Url
import com.android.identity_credential.wallet.DocumentModel
import com.android.identity_credential.wallet.PermissionTracker
import com.android.identity_credential.wallet.ProvisioningViewModel
Expand Down Expand Up @@ -134,7 +135,8 @@ fun WalletNavigation(
)
) { backStackEntry ->
// Extract arguments from the back stack entry
val documentId = backStackEntry.arguments?.getString("documentId") ?: ""
val encodedDocumentId = backStackEntry.arguments?.getString("documentId") ?: ""
val documentId = String(encodedDocumentId.fromBase64Url())
val timestamp = backStackEntry.arguments?.getString("timestamp") ?: ""

EventDetailsScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.runtime.remember
import androidx.navigation.NavHostController
import com.android.identity.util.toBase64Url
import com.android.identity_credential.wallet.DocumentModel
import com.android.identity_credential.wallet.EventInfo
import com.android.identity_credential.wallet.R
Expand Down Expand Up @@ -110,7 +111,8 @@ fun EventLogScreen(
.padding(4.dp)
.clickable {
// Pass documentId and timestamp as arguments
navController.navigate("${WalletDestination.EventDetails.route}/$documentId/${eventInfo.timestamp}")
val encodedDocId = documentId.toByteArray().toBase64Url()
navController.navigate("${WalletDestination.EventDetails.route}/$encodedDocId/${eventInfo.timestamp}")
},
verticalAlignment = Alignment.CenterVertically
) {
Expand Down