Skip to content

Commit

Permalink
Merge pull request #22 from niscy-eudiw/main
Browse files Browse the repository at this point in the history
Updated to latest RQES Core, minor refactor
  • Loading branch information
stzouvaras authored Nov 25, 2024
2 parents 21bd2ae + a159193 commit 2e78869
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 31 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ TARGET_SDK_VERSION=35
MIN_SDK_VERSION=28

# PROJECT PROPERTIES
VERSION_NAME=0.0.5-SNAPSHOT
VERSION_NAME=0.0.6-SNAPSHOT
NAMESPACE=eu.europa.ec.eudi.rqesui
GROUP=eu.europa.ec.eudi

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
eudiRqesCore = "0.0.3-SNAPSHOT"
eudiRqesCore = "0.0.4-SNAPSHOT"
agp = "8.7.2"
kotlin = "2.0.21"
kotlinxCoroutines = "1.8.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.net.URL

internal interface EudiRqesController {
internal interface RqesController {
fun getSelectedFile(): EudiRqesGetSelectedFilePartialState

fun getQtsps(): EudiRqesGetQtspsPartialState
Expand Down Expand Up @@ -75,10 +75,10 @@ internal interface EudiRqesController {
): EudiRqesSaveSignedDocumentsPartialState
}

internal class EudiRqesControllerImpl(
internal class RqesControllerImpl(
private val eudiRQESUi: EudiRQESUi,
private val resourceProvider: ResourceProvider,
) : EudiRqesController {
) : RqesController {

private val genericErrorMsg
get() = resourceProvider.genericErrorMessage()
Expand Down Expand Up @@ -383,7 +383,6 @@ internal class EudiRqesControllerImpl(
authFlowRedirectionURI = authFlowRedirectionURI,
scaBaseURL = URL(qtspData.scaUrl),
),
signingAlgorithm = signingAlgorithm,
hashAlgorithm = hashAlgorithm,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
package eu.europa.ec.eudi.rqesui.domain.di

import android.content.Context
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesController
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesControllerImpl
import eu.europa.ec.eudi.rqesui.domain.controller.KeyStorage
import eu.europa.ec.eudi.rqesui.domain.controller.KeyStorageImpl
import eu.europa.ec.eudi.rqesui.domain.controller.LocalizationController
Expand All @@ -27,6 +25,8 @@ import eu.europa.ec.eudi.rqesui.domain.controller.LogController
import eu.europa.ec.eudi.rqesui.domain.controller.LogControllerImpl
import eu.europa.ec.eudi.rqesui.domain.controller.PreferencesController
import eu.europa.ec.eudi.rqesui.domain.controller.PreferencesControllerImpl
import eu.europa.ec.eudi.rqesui.domain.controller.RqesController
import eu.europa.ec.eudi.rqesui.domain.controller.RqesControllerImpl
import eu.europa.ec.eudi.rqesui.infrastructure.EudiRQESUi
import eu.europa.ec.eudi.rqesui.infrastructure.provider.ResourceProvider
import org.koin.core.annotation.Factory
Expand All @@ -41,8 +41,8 @@ internal fun provideLocalizationController(): LocalizationController =
LocalizationControllerImpl(EudiRQESUi.getEudiRQESUiConfig())

@Single
internal fun provideEudiRqesController(resourceProvider: ResourceProvider): EudiRqesController =
EudiRqesControllerImpl(EudiRQESUi, resourceProvider)
internal fun provideRqesController(resourceProvider: ResourceProvider): RqesController =
RqesControllerImpl(EudiRQESUi, resourceProvider)

@Factory
internal fun provideLogController(): LogController =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package eu.europa.ec.eudi.rqesui.domain.di

import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesController
import eu.europa.ec.eudi.rqesui.domain.controller.RqesController
import eu.europa.ec.eudi.rqesui.domain.interactor.SelectCertificateInteractor
import eu.europa.ec.eudi.rqesui.domain.interactor.SelectCertificateInteractorImpl
import eu.europa.ec.eudi.rqesui.domain.interactor.SelectQtspInteractor
Expand All @@ -28,15 +28,15 @@ import org.koin.core.annotation.Factory

@Factory
internal fun provideSelectQtspInteractor(
eudiRqesController: EudiRqesController,
eudiRqesController: RqesController,
): SelectQtspInteractor = SelectQtspInteractorImpl(
eudiRqesController,
)

@Factory
internal fun provideSelectCertificateInteractor(
resourceProvider: ResourceProvider,
eudiRqesController: EudiRqesController,
eudiRqesController: RqesController,
): SelectCertificateInteractor = SelectCertificateInteractorImpl(
resourceProvider,
eudiRqesController,
Expand All @@ -45,7 +45,7 @@ internal fun provideSelectCertificateInteractor(
@Factory
internal fun provideSuccessInteractor(
resourceProvider: ResourceProvider,
eudiRqesController: EudiRqesController,
eudiRqesController: RqesController,
): SuccessInteractor = SuccessInteractorImpl(
resourceProvider,
eudiRqesController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
package eu.europa.ec.eudi.rqesui.domain.interactor

import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesAuthorizeServicePartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesController
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesGetCertificatesPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesGetCredentialAuthorizationUrlPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesGetSelectedFilePartialState
import eu.europa.ec.eudi.rqesui.domain.controller.RqesController
import eu.europa.ec.eudi.rqesui.domain.entities.error.EudiRQESUiError
import eu.europa.ec.eudi.rqesui.infrastructure.config.data.CertificateData
import eu.europa.ec.eudi.rqesui.infrastructure.provider.ResourceProvider
Expand All @@ -37,7 +37,7 @@ internal interface SelectCertificateInteractor {

internal class SelectCertificateInteractorImpl(
private val resourceProvider: ResourceProvider,
private val eudiRqesController: EudiRqesController,
private val eudiRqesController: RqesController,
) : SelectCertificateInteractor {

private val genericErrorMsg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
package eu.europa.ec.eudi.rqesui.domain.interactor

import eu.europa.ec.eudi.rqes.core.RQESService
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesController
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesGetQtspsPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesGetSelectedFilePartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesGetServiceAuthorizationUrlPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesSetSelectedQtspPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.RqesController
import eu.europa.ec.eudi.rqesui.infrastructure.config.data.QtspData

internal interface SelectQtspInteractor {
Expand All @@ -35,7 +35,7 @@ internal interface SelectQtspInteractor {
}

internal class SelectQtspInteractorImpl(
private val eudiRqesController: EudiRqesController,
private val eudiRqesController: RqesController,
) : SelectQtspInteractor {

override fun getQtsps(): EudiRqesGetQtspsPartialState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
package eu.europa.ec.eudi.rqesui.domain.interactor

import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesAuthorizeCredentialPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesController
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesGetSelectedFilePartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesGetSelectedQtspPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesSaveSignedDocumentsPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesSignDocumentsPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.RqesController
import eu.europa.ec.eudi.rqesui.domain.entities.error.EudiRQESUiError
import eu.europa.ec.eudi.rqesui.infrastructure.config.data.DocumentData
import eu.europa.ec.eudi.rqesui.infrastructure.config.data.QtspData
Expand All @@ -38,7 +38,7 @@ internal interface SuccessInteractor {

internal class SuccessInteractorImpl(
private val resourceProvider: ResourceProvider,
private val eudiRqesController: EudiRqesController,
private val eudiRqesController: RqesController,
) : SuccessInteractor {

private val genericErrorMsg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package eu.europa.ec.eudi.rqesui.infrastructure.config

import eu.europa.ec.eudi.rqes.HashAlgorithmOID
import eu.europa.ec.eudi.rqes.SigningAlgorithmOID
import java.net.URI

/**
Expand All @@ -29,13 +28,11 @@ import java.net.URI
* @property clientId The client ID used to identify the application with the RQES service.
* @property clientSecret The client secret used for authentication with the RQES service.
* @property authFlowRedirectionURI The [URI] to which the user is redirected after authenticating with the RQES service.
* @property signingAlgorithm The signing algorithm used for generating digital signatures. Defaults to RSA.
* @property hashAlgorithm The hash algorithm used for generating message digests. Defaults to SHA-256.
*/
data class RqesServiceConfig(
val clientId: String,
val clientSecret: String,
val authFlowRedirectionURI: URI,
val signingAlgorithm: SigningAlgorithmOID = SigningAlgorithmOID.RSA,
val hashAlgorithm: HashAlgorithmOID = HashAlgorithmOID.SHA_256,
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package eu.europa.ec.eudi.rqesui.domain.interactor

import eu.europa.ec.eudi.rqes.core.RQESService
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesAuthorizeServicePartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesController
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesGetCertificatesPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesGetCredentialAuthorizationUrlPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.RqesController
import eu.europa.ec.eudi.rqesui.domain.entities.error.EudiRQESUiError
import eu.europa.ec.eudi.rqesui.domain.extension.toUri
import eu.europa.ec.eudi.rqesui.infrastructure.config.data.CertificateData
Expand Down Expand Up @@ -52,7 +52,7 @@ class TestSelectCertificateInteractor {
val coroutineRule = CoroutineTestRule()

@Mock
private lateinit var eudiController: EudiRqesController
private lateinit var eudiController: RqesController

@Mock
private lateinit var resourceProvider: ResourceProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package eu.europa.ec.eudi.rqesui.domain.interactor

import eu.europa.ec.eudi.rqes.core.RQESService
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesController
import eu.europa.ec.eudi.rqesui.domain.controller.RqesController
import eu.europa.ec.eudi.rqesui.infrastructure.config.data.QtspData
import kotlinx.coroutines.test.runTest
import org.junit.After
Expand All @@ -31,7 +31,7 @@ import org.mockito.kotlin.verify
class TestSelectQtspInteractor {

@Mock
private lateinit var eudiController: EudiRqesController
private lateinit var eudiController: RqesController

@Mock
private lateinit var qtspData: QtspData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import android.provider.OpenableColumns
import eu.europa.ec.eudi.rqes.core.RQESService
import eu.europa.ec.eudi.rqes.core.SignedDocuments
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesAuthorizeCredentialPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesController
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesGetSelectedFilePartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesGetSelectedQtspPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesSaveSignedDocumentsPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.EudiRqesSignDocumentsPartialState
import eu.europa.ec.eudi.rqesui.domain.controller.RqesController
import eu.europa.ec.eudi.rqesui.domain.entities.error.EudiRQESUiError
import eu.europa.ec.eudi.rqesui.infrastructure.config.data.DocumentData
import eu.europa.ec.eudi.rqesui.infrastructure.config.data.QtspData
Expand Down Expand Up @@ -64,7 +64,7 @@ class TestSuccessInteractor {
private lateinit var resourceProvider: ResourceProvider

@Mock
private lateinit var eudiRqesController: EudiRqesController
private lateinit var eudiRqesController: RqesController

@Mock
private lateinit var credentialAuthorized: RQESService.CredentialAuthorized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package eu.europa.ec.eudi.testrqes

import android.app.Application
import eu.europa.ec.eudi.rqes.HashAlgorithmOID
import eu.europa.ec.eudi.rqes.SigningAlgorithmOID
import eu.europa.ec.eudi.rqesui.domain.entities.localization.LocalizableKey
import eu.europa.ec.eudi.rqesui.domain.entities.localization.LocalizableKey.Companion.ARGUMENTS_SEPARATOR
import eu.europa.ec.eudi.rqesui.domain.extension.toUri
Expand Down Expand Up @@ -47,7 +46,6 @@ private class DefaultConfig : EudiRQESUiConfig {
clientId = "wallet-client-tester",
clientSecret = "somesecrettester2",
authFlowRedirectionURI = URI.create("rQES://oauth/callback"),
signingAlgorithm = SigningAlgorithmOID.RSA,
hashAlgorithm = HashAlgorithmOID.SHA_256,
)

Expand Down

0 comments on commit 2e78869

Please sign in to comment.