diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2021-07-26 13:45:59 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-26 13:45:59 +0530 |
commit | 6c73cccd37ab6487c190a18171dfc369efb97b3b (patch) | |
tree | 4e0f2060b53a8bedb9fc189d187ff2aef4036a2c /format-common/src/main | |
parent | 003e757b1c641698981a29863f73f4475e3af985 (diff) |
PasswordEntry: use `update` method to write new TOTP values (#1472)
Diffstat (limited to 'format-common/src/main')
-rw-r--r-- | format-common/src/main/kotlin/dev/msfjarvis/aps/data/passfile/PasswordEntry.kt | 3 |
1 files changed, 2 insertions, 1 deletions
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 5a2b59ad..efcc6078 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 @@ -19,6 +19,7 @@ import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch /** Represents a single entry in the password store. */ @@ -192,7 +193,7 @@ constructor( ) { if (totpSecret != null) { Otp.calculateCode(totpSecret, millis / (1000 * totpPeriod), totpAlgorithm, digits, issuer) - .mapBoth({ code -> _totp.value = code }, { throwable -> throw throwable }) + .mapBoth({ code -> _totp.update { code } }, { throwable -> throw throwable }) } } |