mirror of
https://github.com/bitwarden/android.git
synced 2026-03-11 20:54:58 -05:00
[PM-30664] Unlock with PIN doesn’t appear as enabled after enabling ‘Require master password on app restart’ (#6344)
This commit is contained in:
committed by
GitHub
parent
40c8346bf7
commit
acc3e24d65
@@ -373,7 +373,10 @@ class AuthDiskSourceImpl(
|
||||
inMemoryOnly: Boolean,
|
||||
) {
|
||||
inMemoryPinProtectedUserKeyEnvelopes[userId] = pinProtectedUserKeyEnvelope
|
||||
if (inMemoryOnly) return
|
||||
if (inMemoryOnly) {
|
||||
getMutablePinProtectedUserKeyEnvelopeFlow(userId).tryEmit(pinProtectedUserKeyEnvelope)
|
||||
return
|
||||
}
|
||||
putString(
|
||||
key = PIN_PROTECTED_USER_KEY_KEY_ENVELOPE.appendIdentifier(userId),
|
||||
value = pinProtectedUserKeyEnvelope,
|
||||
|
||||
@@ -865,6 +865,31 @@ class AuthDiskSourceTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Suppress("MaxLineLength")
|
||||
fun `storePinProtectedUserKeyEnvelope with inMemoryOnly true emits flow and stores only in memory`() =
|
||||
runTest {
|
||||
val userId = "mockUserId"
|
||||
val envelope = "topSecretEnvelope"
|
||||
|
||||
authDiskSource.getPinProtectedUserKeyEnvelopeFlow(userId).test {
|
||||
assertNull(awaitItem())
|
||||
authDiskSource.storePinProtectedUserKeyEnvelope(
|
||||
userId = userId,
|
||||
pinProtectedUserKeyEnvelope = envelope,
|
||||
inMemoryOnly = true,
|
||||
)
|
||||
assertEquals(envelope, awaitItem())
|
||||
assertEquals(envelope, authDiskSource.getPinProtectedUserKeyEnvelope(userId))
|
||||
assertNull(
|
||||
fakeSharedPreferences.getString(
|
||||
"pinKeyEncryptedUserKeyEnvelope_$userId",
|
||||
null,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getPinProtectedUserKeyEnvelope should pull from SharedPreferences`() {
|
||||
val pinProtectedUserKeyEnvelopeBaseKey =
|
||||
|
||||
Reference in New Issue
Block a user