mirror of
https://github.com/bitwarden/android.git
synced 2024-11-24 10:25:57 +03:00
BIT-2291: use org IDs when unlocking vault for new TDE user (#1320)
This commit is contained in:
parent
b8fdadcedb
commit
3a25747518
2 changed files with 6 additions and 5 deletions
|
@ -473,9 +473,8 @@ class AuthRepositoryImpl(
|
|||
requestPrivateKey = requestPrivateKey,
|
||||
method = AuthRequestMethod.UserKey(protectedUserKey = asymmetricalKey),
|
||||
),
|
||||
// We can separately unlock vault for organization data after
|
||||
// receiving the sync response if this data is currently absent.
|
||||
organizationKeys = null,
|
||||
// We should already have the org keys from the login sync.
|
||||
organizationKeys = authDiskSource.getOrganizationKeys(userId = userId),
|
||||
)
|
||||
|
||||
authDiskSource.storeUserKey(userId = userId, userKey = asymmetricalKey)
|
||||
|
|
|
@ -1257,8 +1257,10 @@ class AuthRepositoryTest {
|
|||
val requestPrivateKey = "requestPrivateKey"
|
||||
val asymmetricalKey = "asymmetricalKey"
|
||||
val privateKey = "privateKey"
|
||||
val orgKeys = mapOf("orgId" to "orgKey")
|
||||
fakeAuthDiskSource.userState = SINGLE_USER_STATE_1
|
||||
fakeAuthDiskSource.storePrivateKey(userId = USER_ID_1, privateKey = privateKey)
|
||||
fakeAuthDiskSource.storeOrganizationKeys(userId = USER_ID_1, organizationKeys = orgKeys)
|
||||
coEvery {
|
||||
vaultRepository.unlockVault(
|
||||
userId = USER_ID_1,
|
||||
|
@ -1269,7 +1271,7 @@ class AuthRepositoryTest {
|
|||
requestPrivateKey = requestPrivateKey,
|
||||
method = AuthRequestMethod.UserKey(protectedUserKey = asymmetricalKey),
|
||||
),
|
||||
organizationKeys = null,
|
||||
organizationKeys = orgKeys,
|
||||
)
|
||||
} returns VaultUnlockResult.Success
|
||||
coEvery { vaultRepository.syncIfNecessary() } just runs
|
||||
|
@ -1289,7 +1291,7 @@ class AuthRepositoryTest {
|
|||
requestPrivateKey = requestPrivateKey,
|
||||
method = AuthRequestMethod.UserKey(protectedUserKey = asymmetricalKey),
|
||||
),
|
||||
organizationKeys = null,
|
||||
organizationKeys = orgKeys,
|
||||
)
|
||||
vaultRepository.syncIfNecessary()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue