@@ -66,7 +66,7 @@ internal class DefaultSharedSecretStorageService @Inject constructor(
6666 key : SsssKeySpec ? ,
6767 keyName : String ,
6868 keySigner : KeySigner ? ): SsssKeyCreationInfo {
69- return withContext(cryptoCoroutineScope.coroutineContext + coroutineDispatchers.main ) {
69+ return withContext(cryptoCoroutineScope.coroutineContext + coroutineDispatchers.computation ) {
7070 val bytes = (key as ? RawBytesKeySpec )?.privateKey
7171 ? : ByteArray (32 ).also {
7272 SecureRandom ().nextBytes(it)
@@ -99,7 +99,7 @@ internal class DefaultSharedSecretStorageService @Inject constructor(
9999 passphrase : String ,
100100 keySigner : KeySigner ,
101101 progressListener : ProgressListener ? ): SsssKeyCreationInfo {
102- return withContext(cryptoCoroutineScope.coroutineContext + coroutineDispatchers.main ) {
102+ return withContext(cryptoCoroutineScope.coroutineContext + coroutineDispatchers.computation ) {
103103 val privatePart = generatePrivateKeyWithPassword(passphrase, progressListener)
104104
105105 val storageKeyContent = SecretStorageKeyContent (
@@ -158,7 +158,7 @@ internal class DefaultSharedSecretStorageService @Inject constructor(
158158 }
159159
160160 override suspend fun storeSecret (name : String , secretBase64 : String , keys : List <SharedSecretStorageService .KeyRef >) {
161- withContext(cryptoCoroutineScope.coroutineContext + coroutineDispatchers.main ) {
161+ withContext(cryptoCoroutineScope.coroutineContext + coroutineDispatchers.computation ) {
162162 val encryptedContents = HashMap <String , EncryptedSecretContent >()
163163 keys.forEach {
164164 val keyId = it.keyId
@@ -316,7 +316,7 @@ internal class DefaultSharedSecretStorageService @Inject constructor(
316316 val algorithm = key.keyInfo.content
317317 if (SSSS_ALGORITHM_CURVE25519_AES_SHA2 == algorithm.algorithm) {
318318 val keySpec = secretKey as ? RawBytesKeySpec ? : throw SharedSecretStorageError .BadKeyFormat
319- return withContext(cryptoCoroutineScope.coroutineContext + coroutineDispatchers.main ) {
319+ return withContext(cryptoCoroutineScope.coroutineContext + coroutineDispatchers.computation ) {
320320 // decrypt from recovery key
321321 withOlmDecryption { olmPkDecryption ->
322322 olmPkDecryption.setPrivateKey(keySpec.privateKey)
@@ -331,7 +331,7 @@ internal class DefaultSharedSecretStorageService @Inject constructor(
331331 }
332332 } else if (SSSS_ALGORITHM_AES_HMAC_SHA2 == algorithm.algorithm) {
333333 val keySpec = secretKey as ? RawBytesKeySpec ? : throw SharedSecretStorageError .BadKeyFormat
334- return withContext(cryptoCoroutineScope.coroutineContext + coroutineDispatchers.main ) {
334+ return withContext(cryptoCoroutineScope.coroutineContext + coroutineDispatchers.computation ) {
335335 decryptAesHmacSha2(keySpec, name, secretContent)
336336 }
337337 } else {
0 commit comments