From b2b1e92b452db74ce03842ba467d2eddb4966b40 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 23 May 2021 18:21:02 +0530 Subject: format-common: make `PasswordEntry#extraContentString` public API Signed-off-by: Harsh Shandilya --- format-common/api/format-common.api | 1 + .../main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'format-common') diff --git a/format-common/api/format-common.api b/format-common/api/format-common.api index c088a828..09ff55a2 100644 --- a/format-common/api/format-common.api +++ b/format-common/api/format-common.api @@ -2,6 +2,7 @@ public final class dev/msfjarvis/aps/data/passfile/PasswordEntry { public static final field Companion Ldev/msfjarvis/aps/data/passfile/PasswordEntry$Companion; public fun (Ldev/msfjarvis/aps/util/time/UserClock;Ldev/msfjarvis/aps/util/totp/TotpFinder;Lkotlinx/coroutines/CoroutineScope;[B)V public final fun getExtraContent ()Ljava/util/Map; + public final fun getExtraContentString ()Ljava/lang/String; public final fun getExtraContentWithoutAuthData ()Ljava/lang/String; public final fun getPassword ()Ljava/lang/String; public final fun getTotp ()Lkotlinx/coroutines/flow/StateFlow; diff --git a/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt b/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt index 96337bf7..b2633c71 100644 --- a/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt +++ b/format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt @@ -5,7 +5,6 @@ package dev.msfjarvis.aps.data.passfile -import androidx.annotation.VisibleForTesting import com.github.michaelbull.result.mapBoth import dagger.assisted.Assisted import dagger.assisted.AssistedInject @@ -51,6 +50,12 @@ constructor( /** A [String] to [String] [Map] of the extra content of this entry, in a key:value fashion. */ public val extraContent: Map + /** + * Direct [String] representation of the extra content of this entry, before any transforms are + * applied. Only use this when the extra content is required in a formatting-preserving manner. + */ + public val extraContentString: String + /** * A [StateFlow] providing the current TOTP. It will emit a single empty string on initialization * which is replaced with a real TOTP if applicable. Call [hasTotp] to verify whether or not you @@ -67,7 +72,6 @@ constructor( private val totpSecret: String? private val totpPeriod: Long private val totpAlgorithm: String - @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) internal val extraContentString: String init { val (foundPassword, passContent) = findAndStripPassword(content.split("\n".toRegex())) -- cgit v1.2.3