mirror of
https://github.com/bitwarden/android.git
synced 2026-06-07 23:11:01 -05:00
Add support for encrypting sends (#515)
This commit is contained in:
committed by
Álison Fernandes
parent
9aca107183
commit
d00e7d69ea
@@ -120,6 +120,18 @@ interface VaultSdkSource {
|
||||
collectionList: List<Collection>,
|
||||
): Result<List<CollectionView>>
|
||||
|
||||
/**
|
||||
* Encrypts a [SendView] for the user with the given [userId], returning a [Send] wrapped
|
||||
* in a [Result].
|
||||
*
|
||||
* This should only be called after a successful call to [initializeCrypto] for the associated
|
||||
* user.
|
||||
*/
|
||||
suspend fun encryptSend(
|
||||
userId: String,
|
||||
sendView: SendView,
|
||||
): Result<Send>
|
||||
|
||||
/**
|
||||
* Decrypts a [Send] for the user with the given [userId], returning a [SendView] wrapped in a
|
||||
* [Result].
|
||||
|
||||
@@ -63,6 +63,17 @@ class VaultSdkSourceImpl(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun encryptSend(
|
||||
userId: String,
|
||||
sendView: SendView,
|
||||
): Result<Send> =
|
||||
runCatching {
|
||||
getClient(userId = userId)
|
||||
.vault()
|
||||
.sends()
|
||||
.encrypt(sendView)
|
||||
}
|
||||
|
||||
override suspend fun encryptCipher(
|
||||
userId: String,
|
||||
cipherView: CipherView,
|
||||
|
||||
Reference in New Issue
Block a user