Skip to content

Commit

Permalink
Merge pull request #30 from roots-id/21-add-external-persistence-storage
Browse files Browse the repository at this point in the history
Refactor #21 - Add external persistence storage
  • Loading branch information
rogelio-blanco authored Jun 22, 2022
2 parents afde645 + 23c6a19 commit 49bb96f
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 30 deletions.
19 changes: 10 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "com.rootsid.wal"
version = "1.0.2"
version = "2.0.0"
java.sourceCompatibility = JavaVersion.VERSION_11

repositories {
Expand All @@ -23,6 +23,12 @@ repositories {
}

dependencies {
// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))

// Use the Kotlin JDK 8 standard library.
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.10")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-native-mt")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2")
Expand All @@ -47,13 +53,8 @@ dependencies {
implementation("org.didcommx:didcomm:0.3.0")
implementation("org.didcommx:peerdid:0.3.0")

implementation("org.junit.jupiter:junit-jupiter:5.8.2")

// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))

// Use the Kotlin JDK 8 standard library.
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// Test
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
}

publishing {
Expand All @@ -76,7 +77,7 @@ publishing {
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>() {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "11"
}

Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/com/rootsid/wal/library/dlt/model/Claim.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.rootsid.wal.library.dlt.model

import io.iohk.atala.prism.api.CredentialClaim
import io.iohk.atala.prism.identity.PrismDid
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
Expand All @@ -25,7 +24,6 @@ data class Claim(
*
* Convert a Claim to PRISM CredentialClaim
*/
@OptIn(ExperimentalSerializationApi::class)
fun Claim.toCredentialClaim() = CredentialClaim(
PrismDid.fromString(this.subjectDid),
Json.decodeFromString(this.content)
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/com/rootsid/wal/library/dlt/model/KeyPath.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import kotlinx.serialization.Serializable
* @property didIdx
* @property keyTypeValue
* @property keyIdx
* @property privateKey
* @property publicKey
* @property revoked
* @constructor Create empty Key pair
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/rootsid/wal/library/utils/QR.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.rootsid.wal.library
package com.rootsid.wal.library.utils

import boofcv.alg.fiducial.qrcode.QrCodeEncoder
import boofcv.alg.fiducial.qrcode.QrCodeGeneratorImage
Expand Down
20 changes: 9 additions & 11 deletions src/main/kotlin/com/rootsid/wal/library/wallet/model/Wallet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import com.rootsid.wal.library.dlt.model.Did
* Wallet
*
* @property _id
* @property mnemonic
* @property passphrase
* @property dids
* @property importedCredentials
* @property issuedCredentials
Expand All @@ -21,16 +19,16 @@ interface Wallet {
var importedCredentials: MutableList<ImportedCredential>
// List of credentials issued by a DID from this wallet
var issuedCredentials: MutableList<IssuedCredential>
}

fun addDid(did: Did) {
dids.add(did)
}
fun Wallet.addDid(did: Did) {
dids.add(did)
}

fun addImportedCredential(credential: ImportedCredential) {
importedCredentials.add(credential)
}
fun Wallet.addImportedCredential(credential: ImportedCredential) {
importedCredentials.add(credential)
}

fun addIssuedCredential(credential: IssuedCredential) {
issuedCredentials.add(credential)
}
fun Wallet.addIssuedCredential(credential: IssuedCredential) {
issuedCredentials.add(credential)
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.rootsid.wal.library
package com.rootsid.wal.library.wallet.storage.document

import com.mongodb.ConnectionString
import com.mongodb.client.MongoDatabase
import com.rootsid.wal.library.wallet.model.Wallet
import com.rootsid.wal.library.wallet.storage.document.WalletDocument
import com.rootsid.wal.library.wallet.storage.Storage
import io.iohk.atala.prism.crypto.util.BytesOps
import org.litote.kmongo.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.rootsid.wal.library.wallet.storage.document

import com.rootsid.wal.library.dlt.model.Did
import com.rootsid.wal.library.wallet.model.BlockchainTxLogEntry
import com.rootsid.wal.library.wallet.model.ImportedCredential
import com.rootsid.wal.library.wallet.model.IssuedCredential
import com.rootsid.wal.library.wallet.model.Wallet
Expand Down
2 changes: 0 additions & 2 deletions src/test/kotlin/com/rootsid/wal/library/DLTKtTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.rootsid.wal.library

import org.junit.jupiter.api.Assertions.*

internal class DLTKtTest {

@org.junit.jupiter.api.Test
Expand Down

0 comments on commit 49bb96f

Please sign in to comment.