diff --git a/pollux/lib/anoncreds/README_anoncreds.md b/pollux/lib/anoncreds/README_anoncreds.md index dadc9ef5b9..80fc891694 100644 --- a/pollux/lib/anoncreds/README_anoncreds.md +++ b/pollux/lib/anoncreds/README_anoncreds.md @@ -12,6 +12,19 @@ https://github.com/hyperledger/anoncreds-rs/releases/tag/v0.1.0-dev.15 The file `anoncreds.udl` describes the warp interface generated with Uniffi. The file can be found in the IOHK's anoncreds-rs repository [https://github.com/input-output-hk/anoncreds-rs/blob/main/uniffi/src/anoncreds.udl](https://github.com/input-output-hk/anoncreds-rs/blob/main/uniffi/src/anoncreds.udl) + +## Build Jar lib + +Build the NATIVE anoncred lib from IOHK's fork of the anoncreds-rs [https://github.com/input-output-hk/anoncreds-rs](https://github.com/input-output-hk/anoncreds-rs) + +Go into the folder `uniffi` and generate the file `anoncreds.kt` + +Assuming uniffi_bindgen is install. Install with `cargo install uniffi_bindgen --version $(cargo pkgid uniffi | cut -f 2 -d '@')` + +Replace the `anoncreds.kt` file in the UniffiPOC project (`UniffiPOC/src/main/uniffi/anoncreds/anoncreds.kt`) + +Generate the Jar with `./gradlew jar` in the UniffiPOC project + ## Build the NATIVE lib Build the NATIVE anoncred lib from IOHK's fork of the anoncreds-rs [https://github.com/input-output-hk/anoncreds-rs](https://github.com/input-output-hk/anoncreds-rs) diff --git a/pollux/lib/anoncreds/UniffiPOC-1.0-SNAPSHOT.jar b/pollux/lib/anoncreds/UniffiPOC-1.0-SNAPSHOT.jar index e9522f9e26..7b9d6fe6a3 100644 Binary files a/pollux/lib/anoncreds/UniffiPOC-1.0-SNAPSHOT.jar and b/pollux/lib/anoncreds/UniffiPOC-1.0-SNAPSHOT.jar differ diff --git a/pollux/lib/anoncreds/native-lib/NATIVE/linux/amd64/libuniffi_anoncreds.so b/pollux/lib/anoncreds/native-lib/NATIVE/linux/amd64/libuniffi_anoncreds.so index 865d0c0cd2..2856fe52a5 100755 Binary files a/pollux/lib/anoncreds/native-lib/NATIVE/linux/amd64/libuniffi_anoncreds.so and b/pollux/lib/anoncreds/native-lib/NATIVE/linux/amd64/libuniffi_anoncreds.so differ diff --git a/pollux/lib/anoncredsTest/src/test/scala/io/iohk/atala/pollux/anoncreds/PoCNewLib.scala b/pollux/lib/anoncredsTest/src/test/scala/io/iohk/atala/pollux/anoncreds/PoCNewLib.scala index d363a216ca..f09e4d2803 100644 --- a/pollux/lib/anoncredsTest/src/test/scala/io/iohk/atala/pollux/anoncreds/PoCNewLib.scala +++ b/pollux/lib/anoncredsTest/src/test/scala/io/iohk/atala/pollux/anoncreds/PoCNewLib.scala @@ -52,7 +52,7 @@ class PoCNewLib extends AnyFlatSpec { println(credentialDefinition) - println(credentialDefinition.getCredentialDefinition()) + println(credentialDefinition.getCredentialDefinition().getJson()) println(credentialDefinition.getCredentialDefinitionPrivate().getJson()) println(credentialDefinition.getCredentialKeyCorrectnessProof().getJson()) @@ -71,8 +71,7 @@ class PoCNewLib extends AnyFlatSpec { ) println("CreateOffer") - println(tmp) - // println(AnonCredsAPI.getJson(tmp.ref.getValue())) + println(tmp.getJson()) tmp } @@ -82,30 +81,19 @@ class PoCNewLib extends AnyFlatSpec { credentialOffer: CredentialOffer ) = { - // string? entropy, - // string? prover_did, - // CredentialDefinition cred_def, - // LinkSecret link_secret, - // string link_secret_id, - // CredentialOffer credential_offer - val credentialRequest = Prover().createCredentialRequest( - "entropy", - null, - credentialDefinition, - linkSecret, - "linkSecretId", - credentialOffer, + "entropy", // string? entropy, + null, // string? prover_did, + credentialDefinition, // CredentialDefinition cred_def, + linkSecret, // LinkSecret link_secret, + "linkSecretId", // string link_secret_id, + credentialOffer, // CredentialOffer credential_offer ) - print("Request: ") + println("Request: ") println(credentialRequest.getRequest().getJson()) - print("Metadata: ") - println(credentialRequest.getMetadata()) - // println(AnonCredsAPI.getJson(credentialRequest.ref.getValue())) - // print("cred_req_meta_p: ") - // println(credentialRequest.meta_ref) - // println(AnonCredsAPI.getJson(credentialRequest.meta_ref.getValue())) + println("Metadata: ") + println(credentialRequest.getMetadata()) // FIXME Do we also need a getJson method? credentialRequest } @@ -139,6 +127,7 @@ class PoCNewLib extends AnyFlatSpec { null, ) + println("issuer_createCredential:") println(cred.getJson()) cred } @@ -154,7 +143,10 @@ class PoCNewLib extends AnyFlatSpec { println("*** holder " + ("*" * 100)) val linkSecret = LinkSecret() - println(linkSecret.getBigNumber()) + println(linkSecret.getBigNumber()) // TODO REMOVE + println( + linkSecret.getJson() + ) // FIXME this printing 5FCC7E4BC91B265C59E059369E5C49901AB38E50DF20C218F7B2135E165BAE3C and should have '"' like: "5FCC7E4BC91B265C59E059369E5C49901AB38E50DF20C218F7B2135E165BAE3C" val credentialRequest = holder_createCredentialRequest(linkSecret, credentialDefinition.getCredentialDefinition(), credentialOffer)