Skip to content

Commit

Permalink
Merge pull request #227 from niscy-eudiw/main
Browse files Browse the repository at this point in the history
RQES Config refactored
  • Loading branch information
stzouvaras authored Nov 20, 2024
2 parents 31d9aed + 60817a8 commit 8129784
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,7 @@

package eu.europa.ec.businesslogic.config

import eu.europa.ec.businesslogic.BuildConfig
import eu.europa.ec.eudi.rqes.HashAlgorithmOID
import eu.europa.ec.eudi.rqes.SigningAlgorithmOID
import eu.europa.ec.eudi.rqesui.domain.extension.toUri
import eu.europa.ec.eudi.rqesui.infrastructure.config.EudiRQESUiConfig
import eu.europa.ec.eudi.rqesui.infrastructure.config.RqesServiceConfig
import eu.europa.ec.eudi.rqesui.infrastructure.config.data.QtspData
import java.net.URI

class ConfigLogicImpl : ConfigLogic {
override val appFlavor: AppFlavor
Expand All @@ -33,33 +26,12 @@ class ConfigLogicImpl : ConfigLogic {
get() = DemoEnvironmentConfig()

override val rqesConfig: EudiRQESUiConfig
get() = RqesConfig()
get() = RQESConfigImpl()
}

private class DemoEnvironmentConfig : EnvironmentConfig() {
override fun getServerHost(): String = when (environment) {
ServerConfig.Debug -> ""
ServerConfig.Release -> ""
}
}

private class RqesConfig : EudiRQESUiConfig {

override val rqesServiceConfig: RqesServiceConfig
get() = RqesServiceConfig(
clientId = "wallet-client",
clientSecret = "somesecret2",
authFlowRedirectionURI = URI.create(BuildConfig.RQES_DEEPLINK),
signingAlgorithm = SigningAlgorithmOID.RSA,
hashAlgorithm = HashAlgorithmOID.SHA_256,
)

override val qtsps: List<QtspData>
get() = listOf(
QtspData(
name = "Wallet-Centric",
endpoint = "https://walletcentric.signer.eudiw.dev/csc/v2".toUri(),
scaUrl = "https://walletcentric.signer.eudiw.dev",
)
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2023 European Commission
*
* Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
* Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work
* except in compliance with the Licence.
*
* You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the Licence for the specific language
* governing permissions and limitations under the Licence.
*/

package eu.europa.ec.businesslogic.config

import eu.europa.ec.businesslogic.BuildConfig
import eu.europa.ec.eudi.rqes.HashAlgorithmOID
import eu.europa.ec.eudi.rqes.SigningAlgorithmOID
import eu.europa.ec.eudi.rqesui.domain.extension.toUri
import eu.europa.ec.eudi.rqesui.infrastructure.config.EudiRQESUiConfig
import eu.europa.ec.eudi.rqesui.infrastructure.config.RqesServiceConfig
import eu.europa.ec.eudi.rqesui.infrastructure.config.data.QtspData
import java.net.URI

class RQESConfigImpl : EudiRQESUiConfig {

override val rqesServiceConfig: RqesServiceConfig
get() = RqesServiceConfig(
clientId = "wallet-client",
clientSecret = "somesecret2",
authFlowRedirectionURI = URI.create(BuildConfig.RQES_DEEPLINK),
signingAlgorithm = SigningAlgorithmOID.RSA,
hashAlgorithm = HashAlgorithmOID.SHA_256,
)

override val qtsps: List<QtspData>
get() = listOf(
QtspData(
name = "Wallet-Centric",
endpoint = "https://walletcentric.signer.eudiw.dev/csc/v2".toUri(),
scaUrl = "https://walletcentric.signer.eudiw.dev",
)
)

override val printLogs: Boolean get() = BuildConfig.DEBUG
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,7 @@

package eu.europa.ec.businesslogic.config

import eu.europa.ec.businesslogic.BuildConfig
import eu.europa.ec.eudi.rqes.HashAlgorithmOID
import eu.europa.ec.eudi.rqes.SigningAlgorithmOID
import eu.europa.ec.eudi.rqesui.domain.extension.toUri
import eu.europa.ec.eudi.rqesui.infrastructure.config.EudiRQESUiConfig
import eu.europa.ec.eudi.rqesui.infrastructure.config.RqesServiceConfig
import eu.europa.ec.eudi.rqesui.infrastructure.config.data.QtspData
import java.net.URI

class ConfigLogicImpl : ConfigLogic {
override val appFlavor: AppFlavor
Expand All @@ -33,33 +26,12 @@ class ConfigLogicImpl : ConfigLogic {
get() = DevEnvironmentConfig()

override val rqesConfig: EudiRQESUiConfig
get() = RqesConfig()
get() = RQESConfigImpl()
}

private class DevEnvironmentConfig : EnvironmentConfig() {
override fun getServerHost(): String = when (environment) {
ServerConfig.Debug -> ""
ServerConfig.Release -> ""
}
}

private class RqesConfig : EudiRQESUiConfig {

override val rqesServiceConfig: RqesServiceConfig
get() = RqesServiceConfig(
clientId = "wallet-client",
clientSecret = "somesecret2",
authFlowRedirectionURI = URI.create(BuildConfig.RQES_DEEPLINK),
signingAlgorithm = SigningAlgorithmOID.RSA,
hashAlgorithm = HashAlgorithmOID.SHA_256,
)

override val qtsps: List<QtspData>
get() = listOf(
QtspData(
name = "Wallet-Centric",
endpoint = "https://walletcentric.signer.eudiw.dev/csc/v2".toUri(),
scaUrl = "https://walletcentric.signer.eudiw.dev",
)
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2023 European Commission
*
* Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
* Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work
* except in compliance with the Licence.
*
* You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the Licence for the specific language
* governing permissions and limitations under the Licence.
*/

package eu.europa.ec.businesslogic.config

import eu.europa.ec.businesslogic.BuildConfig
import eu.europa.ec.eudi.rqes.HashAlgorithmOID
import eu.europa.ec.eudi.rqes.SigningAlgorithmOID
import eu.europa.ec.eudi.rqesui.domain.extension.toUri
import eu.europa.ec.eudi.rqesui.infrastructure.config.EudiRQESUiConfig
import eu.europa.ec.eudi.rqesui.infrastructure.config.RqesServiceConfig
import eu.europa.ec.eudi.rqesui.infrastructure.config.data.QtspData
import java.net.URI

class RQESConfigImpl : EudiRQESUiConfig {

override val rqesServiceConfig: RqesServiceConfig
get() = RqesServiceConfig(
clientId = "wallet-client",
clientSecret = "somesecret2",
authFlowRedirectionURI = URI.create(BuildConfig.RQES_DEEPLINK),
signingAlgorithm = SigningAlgorithmOID.RSA,
hashAlgorithm = HashAlgorithmOID.SHA_256,
)

override val qtsps: List<QtspData>
get() = listOf(
QtspData(
name = "Wallet-Centric",
endpoint = "https://walletcentric.signer.eudiw.dev/csc/v2".toUri(),
scaUrl = "https://walletcentric.signer.eudiw.dev",
)
)

override val printLogs: Boolean get() = BuildConfig.DEBUG
}
80 changes: 69 additions & 11 deletions wiki/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

The application allows the configuration of:

1. Verifier API
2. Issuing API
1. Issuing API

Via the *WalletCoreConfig* interface inside the business-logic module.

Expand All @@ -35,6 +34,28 @@ You can configure the *EudiWalletConfig* per flavor. You can find both implement
}
```

2. Trusted certificates

Via the *WalletCoreConfig* interface.

```
interface WalletCoreConfig {
val config: EudiWalletConfig
}
```

Same as the Verifier and Issuing APIs you can configure the Trusted certificates for the *EudiWalletConfig* per flavor inside the core-logic module at src/demo/config/WalletCoreConfigImpl and src/dev/config/WalletCoreConfigImpl

```
_config = EudiWalletConfig.Builder(context)
.trustedReaderCertificates(R.raw.eudi_pid_issuer_ut)
.build()
```

The application's IACA certificates are located [here](https://github.com/eu-digital-identity-wallet/eudi-app-android-wallet-ui/tree/main/resources-logic/src/main/res/raw)

3. Preregistered Client Scheme

If you plan to use the *ClientIdScheme.Preregistered* for OpenId4VP configuration, please add the following to the configuration files.

```
Expand All @@ -59,25 +80,62 @@ const val OPENID4VP_VERIFIER_CLIENT_ID = "your_verifier_client_id"
}
```

3. Trusted certificates
4. RQES

Via the *WalletCoreConfig* interface.
Via the *ConfigLogic* interface inside the business-logic module.

```
interface WalletCoreConfig {
val config: EudiWalletConfig
interface ConfigLogic {
/**
* RQES Config.
*/
val rqesConfig: EudiRQESUiConfig
}
```

Same as the Verifier and Issuing APIs you can configure the Trusted certificates for the *EudiWalletConfig* per flavor inside the core-logic module at src/demo/config/WalletCoreConfigImpl and src/dev/config/WalletCoreConfigImpl
You can configure the *RQESConfig*, which implements the EudiRQESUiConfig interface from the RQESUi SDK, per flavor. You can find both implementations inside the business-logic module at src/demo/config/RQESConfigImpl and src/dev/config/RQESConfigImpl.

```
_config = EudiWalletConfig.Builder(context)
.trustedReaderCertificates(R.raw.eudi_pid_issuer_ut)
.build()
class RQESConfigImpl : EudiRQESUiConfig {
override val translations: Map<String, Map<LocalizableKey, String>> get()
override val themeManager: ThemeManager get()
override val rqesServiceConfig: RqesServiceConfig get()
override val qtsps: List<QtspData> get()
override val printLogs: Boolean get()
}
```

The application's IACA certificates are located [here](https://github.com/eu-digital-identity-wallet/eudi-app-android-wallet-ui/tree/main/resources-logic/src/main/res/raw):
Example:

```
class RQESConfigImpl : EudiRQESUiConfig {
override val rqesServiceConfig: RqesServiceConfig
get() = RqesServiceConfig(
clientId = "your_clientid",
clientSecret = "your_secret",
authFlowRedirectionURI = URI.create(your_uri),
signingAlgorithm = your_algo,
hashAlgorithm = your_algo,
)
override val qtsps: List<QtspData>
get() = listOf(
QtspData(
name = "your_name",
endpoint = "your_endpoint".toUri(),
scaUrl = "your_sca",
)
)
override val printLogs: Boolean get() = BuildConfig.DEBUG
}
```

## DeepLink Schemas configuration

Expand Down

0 comments on commit 8129784

Please sign in to comment.