ProteusPreKeyRefillerImpl

internal class ProteusPreKeyRefillerImpl(preKeyRepository: PreKeyRepository, lowOnPrekeysTreshold: Int = MINIMUM_PREKEYS_COUNT, remotePreKeyTargetCount: Int = REMOTE_PREKEYS_TARGET_COUNT, maxPreKeyId: Int = MAX_PREKEY_ID) : ProteusPreKeyRefiller

Parameters

preKeyRepository

The repository that is used to operate on prekeys.

lowOnPrekeysTreshold

The minimum of prekeys that will trigger the refill. If the number of available prekeys is lower than this value, the refill will be triggered.

remotePreKeyTargetCount

Number of remaining prekeys in the backend to aim for when generating a new batch if a refill is triggered.

maxPreKeyId

The highest possible prekey ID, before it needs to be reset down to zero. This number is dictated by Cryptobox.

Constructors

Link copied to clipboard
constructor(preKeyRepository: PreKeyRepository, lowOnPrekeysTreshold: Int = MINIMUM_PREKEYS_COUNT, remotePreKeyTargetCount: Int = REMOTE_PREKEYS_TARGET_COUNT, maxPreKeyId: Int = MAX_PREKEY_ID)

Functions

Link copied to clipboard
open suspend override fun refillIfNeeded(): Either<CoreFailure, Unit>

Generates more prekeys and upload them to the backend if needed.