Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #19 from catenax-ng/main
Browse files Browse the repository at this point in the history
add kotlin docs
  • Loading branch information
carslen authored Feb 3, 2023
2 parents f7847ce + beb5fa8 commit 70808e1
Show file tree
Hide file tree
Showing 35 changed files with 672 additions and 79 deletions.
9 changes: 5 additions & 4 deletions .env.docker
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
APP_VERSION=3.1.0
APP_VERSION=
MIW_NAME=Base-Wallet
MIW_BPN=BPNL000000000000
MIW_SHORT_DID=ArqouCjqi4RwBXQqjAbQrG
MIW_VERKEY=6Ng3Cu39yTViaEUg1BETpze78nXZqHpb6Q783X2rRhe6
MIW_MEMBERSHIP_ORG=Organisation-A
MIW_SHORT_DID=replace-short-did-of-endorser
MIW_VERKEY=replace-verjkey-of-endorser
MIW_MEMBERSHIP_ORG=replace-name-of-organisation

MIW_DB_JDBC_URL=jdbc:postgresql://db-host-placeholder:5432/db-name-placeholder?user=db-user-placeholder&password=db-password-placeholder
MIW_DB_JDBC_DRIVER=org.postgresql.Driver

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.1.1] - 2023-01-27
- Add Kotlin docs to the interfaces

## [3.1.0] - 2023-01-26
- Fix regex bug in utility method
- Rename enviroment variables and secrets
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,18 @@ excluded. Also their interfaces need to be excluded because they have a
`Application.kt` which are tested or simulated indirectly for example
using `withTestApplication` should also be excluded.
## Kotlin Documentation
To generate the Kotlin documentation and java-docs using `dokka` run
```
./gradlew dokkaHtml
./gradlew dokkaJavadoc
```
The generated files can be found under `./build/dokka/html/index.html` and `build/dokka/javadoc/index.html`
Note: Currently, only the Interfaces and their methods are documented.
## Helm Documentation
The `./charts/README.md` is autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ plugins {
kotlin("jvm") version "1.6.10"
id("org.jetbrains.kotlin.plugin.serialization") version "1.6.10"
jacoco
id("org.jetbrains.dokka") version "1.7.20"
}

jacoco {
Expand Down
5 changes: 2 additions & 3 deletions charts/managed-identity-wallets/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.6.6
appVersion: 3.1.0

version: 0.6.7
appVersion: 3.1.1

dependencies:
- name: postgresql
Expand Down
2 changes: 1 addition & 1 deletion charts/managed-identity-wallets/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# managed-identity-wallets

![Version: 0.6.6](https://img.shields.io/badge/Version-0.6.6-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.1.0](https://img.shields.io/badge/AppVersion-3.1.0-informational?style=flat-square)
![Version: 0.6.7](https://img.shields.io/badge/Version-0.6.7-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.1.1](https://img.shields.io/badge/AppVersion-3.1.1-informational?style=flat-square)

Managed Identity Wallets Service

Expand Down
2 changes: 1 addition & 1 deletion charts/managed-identity-wallets/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ postgresql:
initContainers:
- name: initdb
# -- The image is built and used to initialize the database of MIW. The tag must equal the appVersion in Chart.yaml
image: ghcr.io/catenax-ng/tx-managed-identity-wallets_initdb:3.1.0
image: ghcr.io/catenax-ng/tx-managed-identity-wallets_initdb:3.1.1
imagePullPolicy: Always
command:
- sh
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ acapy_java_library_version=0.7.33
kotlin.code.style=official
kompendium_version=2.3.5
exposed_version=0.38.2
version=3.1.0
version=3.1.1
coverage_excludes=**/models/**,**/entities/**,**/Application*,**/services/IWalletService*,**/services/IAcaPyService*,**/services/AcaPyService*,**/services/IBusinessPartnerDataService*,**/services/IRevocationService*,**/services/RevocationService*

Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private fun onStarted(app: Application) {
val veykeyOfBaseWallet = app.environment.config.property("wallet.baseWalletVerkey").getString()
val nameOfBaseWallet = app.environment.config.property("wallet.baseWalletName").getString()
runBlocking {
Services.walletService.initBaseWalletAndSubscribeForAriesWS(
Services.walletService.initBaseWalletWithListeners(
bpn = bpnOfBaseWallet,
did = didOfBaseWallet,
verkey = veykeyOfBaseWallet,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class ConnectionRepository {

fun getAll(): List<Connection> = transaction { Connection.all().toList() }

@Throws(NotFoundException::class)
fun get(
connectionId: String,
): Connection = Connection.find { Connections.connectionId eq connectionId }
Expand All @@ -58,6 +59,7 @@ class ConnectionRepository {
}
}

@Throws(NotFoundException::class)
fun updateConnectionState(connectionId: String, rfc23State: String) {
get(connectionId).apply {
state = rfc23State
Expand All @@ -71,6 +73,7 @@ class ConnectionRepository {
return true
}

@Throws(NotFoundException::class)
fun deleteConnection(connectionId: String): Boolean {
get(connectionId).delete()
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class WalletRepository {
}
}


fun isWalletExists(identifier: String): Boolean {
return transaction{
!Wallet.find { (Wallets.did eq identifier) or (Wallets.bpn eq identifier) }.empty()
Expand All @@ -72,17 +71,20 @@ class WalletRepository {
}
}

@Throws(NotFoundException::class)
fun deleteWallet(identifier: String): Boolean {
getWallet(identifier).delete()
return true
}

@Throws(NotFoundException::class)
fun updatePending(did: String, isPending: Boolean) {
getWallet(did).apply {
pendingMembershipIssuance = isPending
}
}

@Throws(NotFoundException::class)
fun addRevocationList(did: String, revocationList: String) {
getWallet(did).apply {
revocationListName = revocationList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class WebhookRepository {

fun getAll(): List<Webhook> = transaction { Webhook.all().toList() }

@Throws(NotFoundException::class)
fun get(
threadId: String,
): Webhook = Webhook.find { Webhooks.threadId eq threadId }
Expand All @@ -38,6 +39,7 @@ class WebhookRepository {
threadId: String,
): Webhook? = Webhook.find { Webhooks.threadId eq threadId }.firstOrNull()

@Throws(NotFoundException::class)
fun deleteWebhook(threadId: String): Boolean {
get(threadId).delete()
return true
Expand All @@ -55,6 +57,7 @@ class WebhookRepository {
}
}

@Throws(NotFoundException::class)
fun updateStateOfWebhook(webhookThreadId: String, stateOfRequest: String) {
get(webhookThreadId).apply {
state = stateOfRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import io.ktor.http.*
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import org.eclipse.tractusx.managedidentitywallets.Services
import org.eclipse.tractusx.managedidentitywallets.models.BadRequestException
import org.eclipse.tractusx.managedidentitywallets.models.InternalServerErrorException
import org.eclipse.tractusx.managedidentitywallets.models.SelfManagedWalletCreateDto
import org.eclipse.tractusx.managedidentitywallets.models.UnprocessableEntityException
Expand All @@ -48,7 +47,6 @@ import org.eclipse.tractusx.managedidentitywallets.models.ssi.acapy.VerifyReques
import org.eclipse.tractusx.managedidentitywallets.models.ssi.acapy.VerifyResponse
import org.eclipse.tractusx.managedidentitywallets.models.ssi.acapy.WalletAndAcaPyConfig
import org.eclipse.tractusx.managedidentitywallets.models.ssi.acapy.WalletKey
import org.eclipse.tractusx.managedidentitywallets.models.ssi.acapy.WalletList
import org.hyperledger.acy_py.generated.model.TransactionJobs
import org.hyperledger.acy_py.generated.model.V20CredRequestRequest
import org.hyperledger.acy_py.generated.model.V20CredStoreRequest
Expand All @@ -69,6 +67,10 @@ import org.hyperledger.aries.api.jsonld.VerifiableCredential
import org.hyperledger.aries.api.multitenancy.RemoveWalletRequest
import java.util.*

/**
* AcaPyService provides functionalities for interacting with the AcaPy API to perform
* various actions. It uses HTTP requests and the acapy-java-client library.
*/
class AcaPyService(
private val acaPyConfig: WalletAndAcaPyConfig,
private val utilsService: UtilsService,
Expand All @@ -90,18 +92,6 @@ class AcaPyService(
)
}

override suspend fun getSubWallets(): WalletList {
return try {
client.get {
url("${acaPyConfig.apiAdminUrl}/multitenancy/wallets")
headers.append("X-API-Key", acaPyConfig.adminApiKey)
accept(ContentType.Application.Json)
}
} catch (e: Exception) {
throw BadRequestException(e.message)
}
}

override suspend fun createSubWallet(subWallet: CreateSubWallet): CreatedSubWalletResult {
val httpResponse: HttpResponse = client.post {
url("${acaPyConfig.apiAdminUrl}/multitenancy/wallet")
Expand Down Expand Up @@ -354,7 +344,6 @@ class AcaPyService(
ariesClient.walletDidPublic(did, endorserInfoFilter)
}


override suspend fun sendConnectionRequest(
didOfTheirWallet: String,
usePublicDid: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ import org.slf4j.LoggerFactory
import java.time.Instant
import java.util.*

/**
* AcaPyWalletServiceImpl provides the core functionalities for managing wallets,
* issuing credentials using AcaPy.
*/
class AcaPyWalletServiceImpl(
private val acaPyService: IAcaPyService,
private val walletRepository: WalletRepository,
Expand Down Expand Up @@ -962,7 +966,7 @@ class AcaPyWalletServiceImpl(
)
}

override suspend fun initBaseWalletAndSubscribeForAriesWS(
override suspend fun initBaseWalletWithListeners(
bpn: String,
did: String,
verkey: String,
Expand Down Expand Up @@ -1074,7 +1078,7 @@ class AcaPyWalletServiceImpl(
}
}

override suspend fun setEndorserMetaDataForAcapyConnection(connectionId: String) {
override suspend fun setEndorserMetaDataForConnection(connectionId: String) {
acaPyService.setEndorserMetaData(connectionId)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ import org.jetbrains.exposed.sql.transactions.transaction
import org.slf4j.LoggerFactory
import java.util.*

/**
* The BaseWalletAriesEventHandler triggers appropriate responses
* to some of the Aries-Flow events to enable connection and exchange of credentials
* with other external or internal wallets.
*/
class BaseWalletAriesEventHandler(
private val businessPartnerDataService: IBusinessPartnerDataService,
private val walletService: IWalletService,
Expand Down Expand Up @@ -61,7 +66,7 @@ class BaseWalletAriesEventHandler(
connectionState = connection.rfc23State
)
runBlocking {
walletService.setEndorserMetaDataForAcapyConnection(connection.connectionId)
walletService.setEndorserMetaDataForConnection(connection.connectionId)
walletService.acceptConnectionRequest(walletService.getBaseWallet().did, connection)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ import org.slf4j.LoggerFactory
import java.time.Instant
import java.util.*

/**
* BusinessPartnerDataServiceImpl provides functionalities for
* pulling data from the Business Partner Data Pool (BPDM) and issuing/updating credentials.
*/
class BusinessPartnerDataServiceImpl(
private val walletService: IWalletService,
private val bpdmConfig: BPDMConfig,
Expand Down
Loading

0 comments on commit 70808e1

Please sign in to comment.