Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: AnonCred linting #162

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions edge-agent-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ kotlin {
}
val androidInstrumentedTest by getting {
dependencies {
dependsOn(commonTest)
implementation(kotlin("test"))
implementation("androidx.test.espresso:espresso-core:3.5.1")
implementation("androidx.test.ext:junit:1.1.5")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.hyperledger.identus.walletsdk.edgeagent

import org.junit.Ignore

actual typealias AndroidIgnore = Ignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import org.hyperledger.identus.walletsdk.logger.PrismLoggerMock
import org.hyperledger.identus.walletsdk.mercury.ApiMock
import org.hyperledger.identus.walletsdk.pollux.PolluxImpl
import org.hyperledger.identus.walletsdk.pollux.models.CredentialRequestMeta
import org.hyperledger.identus.walletsdk.pollux.models.LinkSecretBlindingData
import org.hyperledger.identus.walletsdk.edgeagent.protocols.issueCredential.CredentialPreview
import org.hyperledger.identus.walletsdk.edgeagent.protocols.issueCredential.IssueCredential
import org.hyperledger.identus.walletsdk.edgeagent.protocols.issueCredential.OfferCredential
Expand All @@ -23,7 +22,11 @@ import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertTrue
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.test.runTest
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonNull
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
Expand Down Expand Up @@ -52,7 +55,14 @@ class AnoncredsTests {
polluxMock = PolluxMock()
mediationHandlerMock = MediationHandlerMock()
// Pairing will be removed in the future
connectionManager = ConnectionManagerImpl(mercuryMock, castorMock, plutoMock, mediationHandlerMock, mutableListOf())
connectionManager = ConnectionManagerImpl(
mercuryMock,
castorMock,
plutoMock,
mediationHandlerMock,
mutableListOf(),
polluxMock
)
json = Json {
ignoreUnknownKeys = true
prettyPrint = true
Expand Down Expand Up @@ -97,7 +107,11 @@ class AnoncredsTests {
body = OfferCredential.Body(
credentialPreview = CredentialPreview(
attributes = arrayOf(
CredentialPreview.Attribute(name = "Name", value = "Value", mediaType = "application/json")
CredentialPreview.Attribute(
name = "Name",
value = "Value",
mediaType = "application/json"
)
)
)
),
Expand All @@ -106,7 +120,8 @@ class AnoncredsTests {
from = fromDID,
to = toDID
)
val requestCredential = agent.prepareRequestCredentialWithIssuer(did = toDID, offer = offerCredential)
val requestCredential =
agent.prepareRequestCredentialWithIssuer(did = toDID, offer = offerCredential)

assertEquals(offerCredential.from, requestCredential.to)
assertEquals(offerCredential.to, requestCredential.from)
Expand All @@ -127,12 +142,21 @@ class AnoncredsTests {
val pollux = PolluxImpl(castorMock, apiMock)
plutoMock.getLinkSecretReturn = flow { emit(LinkSecret().getValue()) }
val meta = CredentialRequestMeta(
linkSecretBlindingData = LinkSecretBlindingData(
vPrime = "25640768589781180388780947458530942508097609060195936083325202836425537796105863532996457182896416190370043209557677698887790935151362153536943154068082466343529339252470449056527102073900035205398743827912718037139005903291819127500631482122295491777147526837712271367909449810555177615439256541701422814752128559601153332207720895418174855363389532697304935246097129194680107532713993463598420823365761867328806906368762890406604820633668919158697683127114469035627228895027952792675790305070772499052052690434104276748788760647551842035459213572765697025729553350526825112536685989553872204362324245819081933885546131268965572563884162204",
vrPrime = null
),
linkSecretName = "1",
nonce = "519571990522308752875135"
json = Json.encodeToString(
JsonObject(
mapOf(
"linkSecretBlindingData" to JsonObject(
mapOf(
"vPrime" to JsonPrimitive("25640768589781180388780947458530942508097609060195936083325202836425537796105863532996457182896416190370043209557677698887790935151362153536943154068082466343529339252470449056527102073900035205398743827912718037139005903291819127500631482122295491777147526837712271367909449810555177615439256541701422814752128559601153332207720895418174855363389532697304935246097129194680107532713993463598420823365761867328806906368762890406604820633668919158697683127114469035627228895027952792675790305070772499052052690434104276748788760647551842035459213572765697025729553350526825112536685989553872204362324245819081933885546131268965572563884162204"),
"vrPrime" to JsonNull
)
),
"linkSecretName" to JsonPrimitive("1"),
"nonce" to JsonPrimitive("519571990522308752875135")
)
)
)
)
plutoMock.getCredentialMetadataReturn = flow { emit(meta) }

Expand Down
Loading