Skip to content

Commit

Permalink
feat: fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Bassam Riman <bassam.riman@iohk.io>
  • Loading branch information
CryptoKnightIOG committed Dec 22, 2023
1 parent 4517f28 commit cfdb22e
Show file tree
Hide file tree
Showing 22 changed files with 381 additions and 319 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ object AnoncredLib {
version: String, // SCHEMA_Version
attr_names: AttributeNames,
issuer_id: IssuerId, // ISSUER_DID
): SchemaDef = uniffi.anoncreds_wrapper.Schema.apply(name, version, attr_names.toSeq.asJava, issuer_id)
): AnoncredSchemaDef = uniffi.anoncreds_wrapper.Schema.apply(name, version, attr_names.toSeq.asJava, issuer_id)

// issuer
def createCredDefinition(
issuer_id: String,
schema: SchemaDef,
schema: AnoncredSchemaDef,
tag: String,
supportRevocation: Boolean,
signature_type: uniffi.anoncreds_wrapper.SignatureType.CL.type = uniffi.anoncreds_wrapper.SignatureType.CL
) = {
): AnoncredCreateCredentialDefinition = {
val credentialDefinition: uniffi.anoncreds_wrapper.IssuerCreateCredentialDefinitionReturn =
uniffi.anoncreds_wrapper
.Issuer()
Expand All @@ -40,7 +40,7 @@ object AnoncredLib {
uniffi.anoncreds_wrapper.CredentialDefinitionConfig(supportRevocation)
)

CreateCredentialDefinition(
AnoncredCreateCredentialDefinition(
credentialDefinition.getCredentialDefinition(),
credentialDefinition.getCredentialDefinitionPrivate(),
credentialDefinition.getCredentialKeyCorrectnessProof()
Expand All @@ -49,9 +49,9 @@ object AnoncredLib {

// issuer
def createOffer(
credentialDefinition: CreateCredentialDefinition,
credentialDefinition: AnoncredCreateCredentialDefinition,
credentialDefinitionId: String
): CredentialOffer =
): AnoncredCredentialOffer =
uniffi.anoncreds_wrapper
.Issuer()
.createCredentialOffer(
Expand All @@ -62,15 +62,15 @@ object AnoncredLib {

// holder
def createCredentialRequest(
linkSecret: LinkSecretWithId,
credentialDefinition: CredentialDefinition,
credentialOffer: CredentialOffer,
linkSecret: AnoncredLinkSecretWithId,
credentialDefinition: AnoncredCredentialDefinition,
credentialOffer: AnoncredCredentialOffer,
entropy: String = {
val tmp = scala.util.Random()
tmp.setSeed(java.security.SecureRandom.getInstanceStrong().nextLong())
tmp.nextString(80)
}
): CreateCrendentialRequest = {
): AnoncredCreateCrendentialRequest = {
val credentialRequest =
uniffi.anoncreds_wrapper
.Prover()
Expand All @@ -83,16 +83,16 @@ object AnoncredLib {
credentialOffer, // CredentialOffer credential_offer
)

CreateCrendentialRequest(credentialRequest.getRequest(), credentialRequest.getMetadata())
AnoncredCreateCrendentialRequest(credentialRequest.getRequest(), credentialRequest.getMetadata())
}

// holder
def processCredential(
credential: Credential,
metadata: CredentialRequestMetadata,
linkSecret: LinkSecretWithId,
credentialDefinition: CredentialDefinition,
): Credential = {
credential: AnoncredCredential,
metadata: AnoncredCredentialRequestMetadata,
linkSecret: AnoncredLinkSecretWithId,
credentialDefinition: AnoncredCredentialDefinition,
): AnoncredCredential = {
uniffi.anoncreds_wrapper
.Prover()
.processCredential(
Expand All @@ -106,16 +106,16 @@ object AnoncredLib {

// issuer
def createCredential(
credentialDefinition: CredentialDefinition,
credentialDefinitionPrivate: CredentialDefinitionPrivate,
credentialOffer: CredentialOffer,
credentialRequest: CredentialRequest,
credentialDefinition: AnoncredCredentialDefinition,
credentialDefinitionPrivate: AnoncredCredentialDefinitionPrivate,
credentialOffer: AnoncredCredentialOffer,
credentialRequest: AnoncredCredentialRequest,
attributeValues: Seq[(String, String)]
// java.util.List[AttributeValues] : java.util.List[AttributeValues]
// revocationRegistryId : String
// revocationStatusList : RevocationStatusList
// credentialRevocationConfig : CredentialRevocationConfig
): Credential = {
): AnoncredCredential = {
uniffi.anoncreds_wrapper
.Issuer()
.createCredential(
Expand All @@ -141,11 +141,11 @@ object AnoncredLib {

def createPresentation(
presentationRequest: AnoncredPresentationRequest,
credentialRequests: Seq[CredentialRequests],
credentialRequests: Seq[AnoncredCredentialRequests],
selfAttested: Map[String, String],
linkSecret: LinkSecret,
schemas: Map[SchemaId, SchemaDef],
credentialDefinitions: Map[CredentialDefinitionId, CredentialDefinition],
linkSecret: AnoncredLinkSecret,
schemas: Map[SchemaId, AnoncredSchemaDef],
credentialDefinitions: Map[CredentialDefinitionId, AnoncredCredentialDefinition],
): Either[uniffi.anoncreds_wrapper.AnoncredsException.CreatePresentationException, AnoncredPresentation] = {
try {
Right(
Expand Down Expand Up @@ -183,8 +183,8 @@ object AnoncredLib {
def verifyPresentation(
presentation: AnoncredPresentation,
presentationRequest: AnoncredPresentationRequest,
schemas: Map[SchemaId, SchemaDef],
credentialDefinitions: Map[CredentialDefinitionId, CredentialDefinition],
schemas: Map[SchemaId, AnoncredSchemaDef],
credentialDefinitions: Map[CredentialDefinitionId, AnoncredCredentialDefinition],
): Boolean = {
uniffi.anoncreds_wrapper
.Verifier()
Expand Down
Loading

0 comments on commit cfdb22e

Please sign in to comment.