Skip to content

Commit

Permalink
build: remove prism naming
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed Moussa <ahmed.moussa@iohk.io>
  • Loading branch information
hamada147 committed Nov 28, 2023
1 parent 6c1288b commit 725e3b7
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 132 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout the repo
- name: "Checkout the repo"
uses: actions/checkout@v3
with:
submodules: recursive
Expand All @@ -33,18 +33,14 @@ jobs:
java-version: "${{ env.JAVA_VERSION }}"
distribution: zulu

- name: Gradle Build Action
- name: "Gradle Build Action"
uses: gradle/gradle-build-action@v2

- name: Test Kotlin code is properly formatted
- name: "Test Kotlin code is properly formatted"
working-directory: ./anoncred-kmm
run: ./gradlew ktlintCheck

- name: Check bin files
working-directory: ./anoncred-kmm
run: ./gradlew :anoncred-wrapper-rust:printFiles

- name: Install Homebrew
- name: "Install Homebrew"
run: >
/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Expand Down Expand Up @@ -90,6 +86,6 @@ jobs:
run: |
cargo install cargo-ndk
- name: Build Check All tests
- name: "Build Check All tests"
working-directory: ./anoncred-kmm
run: ./gradlew :anoncreds-kmp:allTests
15 changes: 0 additions & 15 deletions anoncred-kmm/anoncred-wrapper-rust/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,6 @@ fun Project.commandLineWithOutput(vararg commands: String) {
// pb.start().waitFor()
// println(pb.output)

val printFiles by tasks.register("printFiles") {
group = "print"
doLast {
val directoryPath = project.file("/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/")

if (directoryPath.isDirectory) {
directoryPath.listFiles()?.forEach { file ->
println(file.name)
}
} else {
println("The specified path is not a directory.")
}
}
}

/**
* Delete the generated `Target` folder that is being generated by Rust Cargo
*/
Expand Down
2 changes: 1 addition & 1 deletion anoncred-kmm/anoncreds-kmp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ publishing {
android {
ndkVersion = "26.0.10792818"
compileSdk = 33
namespace = "io.iohk.atala.prism.anoncredskmp"
namespace = "anoncredskmp"
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")

sourceSets["main"].jniLibs {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="io.iohk.atala.prism.anoncredskmp" />
<manifest package="anoncredskmp" />
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.iohk.atala.prism.anoncred
package anoncred.wrapper

import org.junit.Ignore

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.iohk.atala.prism.anoncred
package anoncred.wrapper

enum class Platform {
Linux,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.iohk.atala.prism.anoncred
package anoncred.wrapper

/**
* Ignore Unit tests on Android Platform
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.iohk.atala.prism.anoncred
package anoncred.wrapper

import anoncreds_wrapper.AttributeValues
import anoncreds_wrapper.CredentialDefinitionConfig
Expand All @@ -13,9 +13,9 @@ import kotlin.test.assertEquals
import kotlin.test.assertTrue

@AndroidIgnore
class PrismIssuerTests {
class IssuerTests {
@Test
fun test_PrismIssuer_createSchema() {
fun test_Issuer_createSchema() {
val expectedSchema = Schema("Moussa", "1.0", listOf("name", "age"), "sample:uri")
val scheme: Schema = Issuer().createSchema("Moussa", "1.0", "sample:uri", listOf("name", "age"))
assertEquals(expectedSchema, scheme, "scheme not equal")
Expand All @@ -29,11 +29,11 @@ class PrismIssuerTests {
}

@Test
fun test_PrismIssuer_createCredentialDefinition() {
val prismIssuer = Issuer()
fun test_Issuer_createCredentialDefinition() {
val issuer = Issuer()
val attributeNames = listOf("name", "age")
val schema: Schema = prismIssuer.createSchema("Moussa", "1.0", "sample:uri", attributeNames)
val cred = prismIssuer.createCredentialDefinition(
val schema: Schema = issuer.createSchema("Moussa", "1.0", "sample:uri", attributeNames)
val cred = issuer.createCredentialDefinition(
"did:web:xyz/resource/schema",
schema,
"did:web:xyz",
Expand All @@ -48,19 +48,19 @@ class PrismIssuerTests {
}

@Test
fun test_PrismIssuer_createRevocationRegistryDef() {
val prismIssuer = Issuer()
fun test_Issuer_createRevocationRegistryDef() {
val issuer = Issuer()
val attributeNames = listOf("name", "age")
val schema = Schema("Moussa", "1.0", attributeNames, "sample:uri")
val cred = prismIssuer.createCredentialDefinition(
val cred = issuer.createCredentialDefinition(
"did:web:xyz/resource/schema",
schema,
"did:web:xyz",
"default-tag",
SignatureType.CL,
CredentialDefinitionConfig(true)
)
val rev = prismIssuer.createRevocationRegistryDef(
val rev = issuer.createRevocationRegistryDef(
cred.credentialDefinition,
"did:web:xyz/resource/cred-def",
"did:web:xyz",
Expand All @@ -75,27 +75,27 @@ class PrismIssuerTests {
}

@Test
fun test_PrismIssuer_createRevocationStatusList() {
val prismIssuer = Issuer()
fun test_Issuer_createRevocationStatusList() {
val issuer = Issuer()
val attributeNames = listOf("name", "age")
val schema = Schema("Moussa", "1.0", attributeNames, "sample:uri")
val cred = prismIssuer.createCredentialDefinition(
val cred = issuer.createCredentialDefinition(
"did:web:xyz/resource/schema",
schema,
"did:web:xyz",
"default-tag",
SignatureType.CL,
CredentialDefinitionConfig(true)
)
val rev = prismIssuer.createRevocationRegistryDef(
val rev = issuer.createRevocationRegistryDef(
cred.credentialDefinition,
"did:web:xyz/resource/cred-def",
"did:web:xyz",
"default-tag",
RegistryType.CL_ACCUM,
1000u
)
val revStatusList = prismIssuer.createRevocationStatusList(
val revStatusList = issuer.createRevocationStatusList(
"did:web:xyz/resource/rev-reg-def",
rev.regDef,
"did:web:xyz",
Expand All @@ -107,110 +107,110 @@ class PrismIssuerTests {
}

@Test
fun test_PrismIssuer_updateRevocationStatusListTimestampOnly() {
val prismIssuer = Issuer()
fun test_Issuer_updateRevocationStatusListTimestampOnly() {
val issuer = Issuer()
val attributeNames = listOf("name", "age")
val schema = Schema("Moussa", "1.0", attributeNames, "sample:uri")
val cred = prismIssuer.createCredentialDefinition(
val cred = issuer.createCredentialDefinition(
"did:web:xyz/resource/schema",
schema,
"did:web:xyz",
"default-tag",
SignatureType.CL,
CredentialDefinitionConfig(true)
)
val rev = prismIssuer.createRevocationRegistryDef(
val rev = issuer.createRevocationRegistryDef(
cred.credentialDefinition,
"did:web:xyz/resource/cred-def",
"did:web:xyz",
"default-tag",
RegistryType.CL_ACCUM,
1000u
)
val revStatusList = prismIssuer.createRevocationStatusList(
val revStatusList = issuer.createRevocationStatusList(
"did:web:xyz/resource/rev-reg-def",
rev.regDef,
"did:web:xyz",
null,
true
)
val updatedRevStatusList = prismIssuer.updateRevocationStatusListTimestampOnly(1000u, revStatusList)
val updatedRevStatusList = issuer.updateRevocationStatusListTimestampOnly(1000u, revStatusList)
println(updatedRevStatusList.getJson())
assertTrue(true)
}

@Test
fun test_PrismIssuer_updateRevocationStatusList() {
val prismIssuer = Issuer()
fun test_Issuer_updateRevocationStatusList() {
val issuer = Issuer()
val attributeNames = listOf("name", "age")
val schema = Schema("Moussa", "1.0", attributeNames, "sample:uri")
val cred = prismIssuer.createCredentialDefinition(
val cred = issuer.createCredentialDefinition(
"did:web:xyz/resource/schema",
schema,
"did:web:xyz",
"default-tag",
SignatureType.CL,
CredentialDefinitionConfig(true)
)
val rev = prismIssuer.createRevocationRegistryDef(
val rev = issuer.createRevocationRegistryDef(
cred.credentialDefinition,
"did:web:xyz/resource/cred-def",
"did:web:xyz",
"default-tag",
RegistryType.CL_ACCUM,
1000u
)
val revStatusList = prismIssuer.createRevocationStatusList(
val revStatusList = issuer.createRevocationStatusList(
"did:web:xyz/resource/rev-reg-def",
rev.regDef,
"did:web:xyz",
null,
true
)
val updatedRevStatusList = prismIssuer.updateRevocationStatusList(null, listOf(1u), null, rev.regDef, revStatusList)
val updatedRevStatusList = issuer.updateRevocationStatusList(null, listOf(1u), null, rev.regDef, revStatusList)
println(updatedRevStatusList.getJson())
assertTrue(true)
Nonce().toString()
Nonce()
}

@Test
fun test_PrismIssuer_createCredentialOffer() {
val prismIssuer = Issuer()
fun test_Issuer_createCredentialOffer() {
val issuer = Issuer()
val attributeNames = listOf("name", "age")
val schema = Schema("Moussa", "1.0", attributeNames, "sample:uri")
val cred = prismIssuer.createCredentialDefinition(
val cred = issuer.createCredentialDefinition(
"did:web:xyz/resource/schema",
schema,
"did:web:xyz",
"default-tag",
SignatureType.CL,
CredentialDefinitionConfig(true)
)
val credentialOffer = prismIssuer.createCredentialOffer("did:web:xyz/resource/schema", "did:web:xyz/resource/cred-def", cred.credentialKeyCorrectnessProof)
val credentialOffer = issuer.createCredentialOffer("did:web:xyz/resource/schema", "did:web:xyz/resource/cred-def", cred.credentialKeyCorrectnessProof)
println(credentialOffer.getJson())
assertTrue(true)
}

@Test
fun test_PrismIssuer_createCredential() {
val prismIssuer = Issuer()
fun test_Issuer_createCredential() {
val issuer = Issuer()
val attributeNames = listOf("name", "age")
val schema = Schema("Moussa", "1.0", attributeNames, "sample:uri")
val cred = prismIssuer.createCredentialDefinition(
val cred = issuer.createCredentialDefinition(
"did:web:xyz/resource/schema",
schema,
"did:web:xyz",
"default-tag",
SignatureType.CL,
CredentialDefinitionConfig(true)
)
val credentialOffer = prismIssuer.createCredentialOffer("did:web:xyz/resource/schema", "did:web:xyz/resource/cred-def", cred.credentialKeyCorrectnessProof)
val prismProver = Prover()
val linkSecret = prismProver.createLinkSecret()
val credentialRequest = prismProver.createCredentialRequest("entropy", null, cred.credentialDefinition, linkSecret, "my-secret-id", credentialOffer)
val credentialOffer = issuer.createCredentialOffer("did:web:xyz/resource/schema", "did:web:xyz/resource/cred-def", cred.credentialKeyCorrectnessProof)
val Prover = Prover()
val linkSecret = Prover.createLinkSecret()
val credentialRequest = Prover.createCredentialRequest("entropy", null, cred.credentialDefinition, linkSecret, "my-secret-id", credentialOffer)
val credentialValues = listOf(AttributeValues("name", "Moussa"))
val credential = prismIssuer.createCredential(
val credential = issuer.createCredential(
cred.credentialDefinition,
cred.credentialDefinitionPrivate,
credentialOffer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.iohk.atala.prism.anoncred
package anoncred.wrapper

import anoncreds_wrapper.CredentialDefinitionConfig
import anoncreds_wrapper.Issuer
Expand All @@ -9,38 +9,38 @@ import kotlin.test.Test
import kotlin.test.assertTrue

@AndroidIgnore
class PrismProverTests {
class ProverTests {
@Test
fun test_PrismProver_createLinkSecret() {
val prismProver = Prover()
val linkSecret = prismProver.createLinkSecret()
fun test_Prover_createLinkSecret() {
val prover = Prover()
val linkSecret = prover.createLinkSecret()
println(linkSecret.getBigNumber())
println(linkSecret.getValue())
assertTrue(linkSecret.getBigNumber().length > 0)
}

@Test
fun test_PrismProver_createCredentialRequest() {
val prismIssuer = Issuer()
fun test_Prover_createCredentialRequest() {
val issuer = Issuer()
val attributeNames = listOf("name", "age")
val schema = Schema("Moussa", "1.0", attributeNames, "sample:uri")
val cred = prismIssuer.createCredentialDefinition(
val cred = issuer.createCredentialDefinition(
"did:web:xyz/resource/schema",
schema,
"did:web:xyz",
"default-tag",
SignatureType.CL,
CredentialDefinitionConfig(true)
)
val credentialOffer = prismIssuer.createCredentialOffer(
val credentialOffer = issuer.createCredentialOffer(
"did:web:xyz/resource/schema",
"did:web:xyz/resource/cred-def",
cred.credentialKeyCorrectnessProof
)

val prismProver = Prover()
val linkSecret = prismProver.createLinkSecret()
val credentialRequest = prismProver.createCredentialRequest(
val prover = Prover()
val linkSecret = prover.createLinkSecret()
val credentialRequest = prover.createCredentialRequest(
"entropy",
null,
cred.credentialDefinition,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.iohk.atala.prism.anoncred
package anoncred.wrapper

/**
* Ignore Unit tests on Android Platform
Expand Down
Loading

0 comments on commit 725e3b7

Please sign in to comment.