VirgilSecurity / virgil-e3kit-kotlin

E3Kit is a security framework that simplifies work with Virgil services and presents the easiest way to add full end-to-end security to your chat application to become HIPAA and GDPR compliant and more.
https://virgilsecurity.com/e3kit/
BSD 3-Clause "New" or "Revised" License
12 stars 8 forks source link

com.virgilsecurity.keyknox.exception.KeyknoxServiceException: `Virgil-Keyknox-Previous-Hash` header is invalid. #52

Closed jetaggart closed 3 years ago

jetaggart commented 4 years ago

Describe the bug E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1 Process: io.getstream.thestream, PID: 2087 com.virgilsecurity.keyknox.exception.KeyknoxServiceException: Virgil-Keyknox-Previous-Hash header is invalid. at com.virgilsecurity.keyknox.client.HttpClient.send(HttpClient.kt:101) at com.virgilsecurity.keyknox.client.KeyknoxClient.pushValue(KeyknoxClient.kt:126) at com.virgilsecurity.keyknox.KeyknoxManager$pushValue$operation$1.invoke(KeyknoxManager.kt:84) at com.virgilsecurity.keyknox.KeyknoxManager$pushValue$operation$1.invoke(KeyknoxManager.kt:53) at com.virgilsecurity.keyknox.KeyknoxManager.run(KeyknoxManager.kt:167) at com.virgilsecurity.keyknox.KeyknoxManager.pushValue(KeyknoxManager.kt:95) at com.virgilsecurity.android.common.storage.cloud.CloudTicketStorage.store$ethree_common_release(CloudTicketStorage.kt:83) at com.virgilsecurity.android.common.manager.GroupManager.store$ethree_common_release(GroupManager.kt:70) at com.virgilsecurity.android.common.worker.GroupWorker$createGroup$1.get(GroupWorker.kt:71) at com.virgilsecurity.android.common.worker.GroupWorker$createGroup$1.get(GroupWorker.kt:59) at io.getstream.thestream.services.VirgilService.init(VirgilService.kt:41) at io.getstream.thestream.MainActivity$onCreate$1$1.invokeSuspend(MainActivity.kt:33) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

To Reproduce The last line of this function throws this error:


    fun init(context: Context, user: String) {
        val params = EThreeParams(user, BackendService::getVirgilToken, context)
        eThree = EThree(params)

        try {
            if(!eThree.hasLocalPrivateKey()) {
                eThree.register().execute()
            }
        } catch (e: EThreeException) {
            if (e.description != EThreeException.Description.USER_IS_ALREADY_REGISTERED) {
                // if user is already registered, we can safely ignore, otherwise rethrow
                throw e
            }
        }

        val otherUsers = BackendService.getUsers()
        userCards =
            if (otherUsers.isEmpty()) {
                FindUsersResult()
            } else eThree.findUsers(
                otherUsers,
                forceReload = true,
                checkResult = false
            ).get()
        userTimelineGroup = eThree.createGroup("feed-group-${user}", userCards).get()
    }

Platform (please complete the following information):

jetaggart commented 4 years ago

Just checking if someone has had a chance to look at this. This is a blocker for me and curious if there's at least aw ork around.

Thanks!