Move private fun

This commit is contained in:
Benoit Marty 2021-01-22 17:48:13 +01:00
parent a44d00a31c
commit 401b5e2b7a

View file

@ -46,17 +46,6 @@ internal class DefaultIdentityBulkLookupTask @Inject constructor(
@UserId private val userId: String @UserId private val userId: String
) : IdentityBulkLookupTask { ) : IdentityBulkLookupTask {
private fun getHashedAddresses(threePids: List<ThreePid>, pepper: String): List<String> {
return withOlmUtility { olmUtility ->
threePids.map { threePid ->
base64ToBase64Url(
olmUtility.sha256(threePid.value.toLowerCase(Locale.ROOT)
+ " " + threePid.toMedium() + " " + pepper)
)
}
}
}
override suspend fun execute(params: IdentityBulkLookupTask.Params): List<FoundThreePid> { override suspend fun execute(params: IdentityBulkLookupTask.Params): List<FoundThreePid> {
val identityAPI = getIdentityApiAndEnsureTerms(identityApiProvider, userId) val identityAPI = getIdentityApiAndEnsureTerms(identityApiProvider, userId)
val identityData = identityStore.getIdentityData() ?: throw IdentityServiceError.NoIdentityServerConfigured val identityData = identityStore.getIdentityData() ?: throw IdentityServiceError.NoIdentityServerConfigured
@ -124,6 +113,17 @@ internal class DefaultIdentityBulkLookupTask @Inject constructor(
} }
} }
private fun getHashedAddresses(threePids: List<ThreePid>, pepper: String): List<String> {
return withOlmUtility { olmUtility ->
threePids.map { threePid ->
base64ToBase64Url(
olmUtility.sha256(threePid.value.toLowerCase(Locale.ROOT)
+ " " + threePid.toMedium() + " " + pepper)
)
}
}
}
private suspend fun fetchHashDetails(identityAPI: IdentityAPI): IdentityHashDetailResponse { private suspend fun fetchHashDetails(identityAPI: IdentityAPI): IdentityHashDetailResponse {
return executeRequest(null) { return executeRequest(null) {
apiCall = identityAPI.hashDetails() apiCall = identityAPI.hashDetails()