From 617395629215a043fb60c2439b736eaf571a0492 Mon Sep 17 00:00:00 2001 From: goncalo-frade-iohk Date: Tue, 19 Dec 2023 21:03:54 +0000 Subject: [PATCH] chore: prepare release 0.4.1 --- Package.swift | 4 +- .../Sources/Swift/anoncreds_wrapper.swift | 409 ++++++++---------- 2 files changed, 193 insertions(+), 220 deletions(-) diff --git a/Package.swift b/Package.swift index 9d82114f..d074255b 100644 --- a/Package.swift +++ b/Package.swift @@ -32,8 +32,8 @@ let package = Package( // RELEASE .binaryTarget( name: "libanoncreds", - url: "https://github.com/input-output-hk/anoncreds-rs/releases/download/0.4.0/libanoncreds.xcframework.zip", - checksum: "2cbb147f58dd4d59990c1fc01302e63aafd63673b64310946420893f639b1f67" + url: "https://github.com/input-output-hk/anoncreds-rs/releases/download/0.4.1/libanoncreds.xcframework.zip", + checksum: "85a67c56a4c6480975c631c122091381c3bfe74d3b3102f77da2cb0d71841873" ) ] ) diff --git a/uniffi/output-frameworks/anoncreds-swift/AnoncredsSwift/Sources/Swift/anoncreds_wrapper.swift b/uniffi/output-frameworks/anoncreds-swift/AnoncredsSwift/Sources/Swift/anoncreds_wrapper.swift index dacb309f..c09a8460 100644 --- a/uniffi/output-frameworks/anoncreds-swift/AnoncredsSwift/Sources/Swift/anoncreds_wrapper.swift +++ b/uniffi/output-frameworks/anoncreds-swift/AnoncredsSwift/Sources/Swift/anoncreds_wrapper.swift @@ -104,12 +104,12 @@ private func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: // Reads a float at the current offset. private func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float { - return Float(bitPattern: try readInt(&reader)) + return try Float(bitPattern: readInt(&reader)) } // Reads a float at the current offset. private func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double { - return Double(bitPattern: try readInt(&reader)) + return try Double(bitPattern: readInt(&reader)) } // Indicates if the offset has reached the end of the buffer. @@ -281,7 +281,7 @@ private func uniffiCheckCallStatus( // with the message. But if that code panics, then it just sends back // an empty buffer. if callStatus.errorBuf.len > 0 { - throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf)) + throw try UniffiInternalError.rustPanic(FfiConverterString.lift(callStatus.errorBuf)) } else { callStatus.errorBuf.deallocate() throw UniffiInternalError.rustPanic("Rust panic") @@ -369,7 +369,7 @@ private struct FfiConverterString: FfiConverter { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String { let len: Int32 = try readInt(&buf) - return String(bytes: try readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)! + return try String(bytes: readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)! } public static func write(_ value: String, into buf: inout [UInt8]) { @@ -402,7 +402,7 @@ public class Credential: CredentialProtocol { } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_credential_new( FfiConverterString.lower(jsonString), $0 ) @@ -487,10 +487,9 @@ public class Credential: CredentialProtocol { public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_credential_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_credential_get_json(self.pointer, $0) + } ) } } @@ -552,7 +551,7 @@ public class CredentialDefinition: CredentialDefinitionProtocol { } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_credentialdefinition_new( FfiConverterString.lower(jsonString), $0 ) @@ -601,10 +600,9 @@ public class CredentialDefinition: CredentialDefinitionProtocol { public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_credentialdefinition_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_credentialdefinition_get_json(self.pointer, $0) + } ) } } @@ -662,7 +660,7 @@ public class CredentialDefinitionPrivate: CredentialDefinitionPrivateProtocol { } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_credentialdefinitionprivate_new( FfiConverterString.lower(jsonString), $0 ) @@ -675,10 +673,9 @@ public class CredentialDefinitionPrivate: CredentialDefinitionPrivateProtocol { public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_credentialdefinitionprivate_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_credentialdefinitionprivate_get_json(self.pointer, $0) + } ) } } @@ -736,7 +733,7 @@ public class CredentialKeyCorrectnessProof: CredentialKeyCorrectnessProofProtoco } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_credentialkeycorrectnessproof_new( FfiConverterString.lower(jsonString), $0 ) @@ -749,10 +746,9 @@ public class CredentialKeyCorrectnessProof: CredentialKeyCorrectnessProofProtoco public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_credentialkeycorrectnessproof_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_credentialkeycorrectnessproof_get_json(self.pointer, $0) + } ) } } @@ -815,7 +811,7 @@ public class CredentialOffer: CredentialOfferProtocol { } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_credentialoffer_new( FfiConverterString.lower(jsonString), $0 ) @@ -873,10 +869,9 @@ public class CredentialOffer: CredentialOfferProtocol { public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_credentialoffer_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_credentialoffer_get_json(self.pointer, $0) + } ) } } @@ -937,7 +932,7 @@ public class CredentialRequest: CredentialRequestProtocol { } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_credentialrequest_new( FfiConverterString.lower(jsonString), $0 ) @@ -977,10 +972,9 @@ public class CredentialRequest: CredentialRequestProtocol { public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_credentialrequest_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_credentialrequest_get_json(self.pointer, $0) + } ) } } @@ -1041,7 +1035,7 @@ public class CredentialRequestMetadata: CredentialRequestMetadataProtocol { } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_credentialrequestmetadata_new( FfiConverterString.lower(jsonString), $0 ) @@ -1054,10 +1048,9 @@ public class CredentialRequestMetadata: CredentialRequestMetadataProtocol { public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_credentialrequestmetadata_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_credentialrequestmetadata_get_json(self.pointer, $0) + } ) } @@ -1160,58 +1153,54 @@ public class Issuer: IssuerProtocol { public func createSchema(schemaName: String, schemaVersion: String, issuerId: String, attrNames: [String]) throws -> Schema { return try FfiConverterTypeSchema.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_issuer_create_schema(self.pointer, - FfiConverterString.lower(schemaName), - FfiConverterString.lower(schemaVersion), - FfiConverterString.lower(issuerId), - FfiConverterSequenceString.lower(attrNames), $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_issuer_create_schema(self.pointer, + FfiConverterString.lower(schemaName), + FfiConverterString.lower(schemaVersion), + FfiConverterString.lower(issuerId), + FfiConverterSequenceString.lower(attrNames), $0) + } ) } public func createCredentialDefinition(schemaId: String, schema: Schema, issuerId: String, tag: String, signatureType: SignatureType, config: CredentialDefinitionConfig) throws -> IssuerCreateCredentialDefinitionReturn { return try FfiConverterTypeIssuerCreateCredentialDefinitionReturn.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_issuer_create_credential_definition(self.pointer, - FfiConverterString.lower(schemaId), - FfiConverterTypeSchema.lower(schema), - FfiConverterString.lower(issuerId), - FfiConverterString.lower(tag), - FfiConverterTypeSignatureType.lower(signatureType), - FfiConverterTypeCredentialDefinitionConfig.lower(config), $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_issuer_create_credential_definition(self.pointer, + FfiConverterString.lower(schemaId), + FfiConverterTypeSchema.lower(schema), + FfiConverterString.lower(issuerId), + FfiConverterString.lower(tag), + FfiConverterTypeSignatureType.lower(signatureType), + FfiConverterTypeCredentialDefinitionConfig.lower(config), $0) + } ) } public func createRevocationRegistryDef(credDef: CredentialDefinition, credDefId: String, issuerId: String, tag: String, revRegType: RegistryType, maxCredNum: UInt32) throws -> IssuerCreateRevocationRegistryDefReturn { return try FfiConverterTypeIssuerCreateRevocationRegistryDefReturn.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_issuer_create_revocation_registry_def(self.pointer, - FfiConverterTypeCredentialDefinition.lower(credDef), - FfiConverterString.lower(credDefId), - FfiConverterString.lower(issuerId), - FfiConverterString.lower(tag), - FfiConverterTypeRegistryType.lower(revRegType), - FfiConverterUInt32.lower(maxCredNum), $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_issuer_create_revocation_registry_def(self.pointer, + FfiConverterTypeCredentialDefinition.lower(credDef), + FfiConverterString.lower(credDefId), + FfiConverterString.lower(issuerId), + FfiConverterString.lower(tag), + FfiConverterTypeRegistryType.lower(revRegType), + FfiConverterUInt32.lower(maxCredNum), $0) + } ) } public func createRevocationStatusList(revRegDefId: String, revRegDef: RevocationRegistryDefinition, issuerId: String, timestamp: UInt64?, issuanceByDefault: Bool) throws -> RevocationStatusList { return try FfiConverterTypeRevocationStatusList.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_issuer_create_revocation_status_list(self.pointer, - FfiConverterString.lower(revRegDefId), - FfiConverterTypeRevocationRegistryDefinition.lower(revRegDef), - FfiConverterString.lower(issuerId), - FfiConverterOptionUInt64.lower(timestamp), - FfiConverterBool.lower(issuanceByDefault), $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_issuer_create_revocation_status_list(self.pointer, + FfiConverterString.lower(revRegDefId), + FfiConverterTypeRevocationRegistryDefinition.lower(revRegDef), + FfiConverterString.lower(issuerId), + FfiConverterOptionUInt64.lower(timestamp), + FfiConverterBool.lower(issuanceByDefault), $0) + } ) } @@ -1228,44 +1217,41 @@ public class Issuer: IssuerProtocol { public func updateRevocationStatusList(timestamp: UInt64?, issued: [UInt32]?, revoked: [UInt32]?, revRegDef: RevocationRegistryDefinition, currentList: RevocationStatusList) throws -> RevocationStatusList { return try FfiConverterTypeRevocationStatusList.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_issuer_update_revocation_status_list(self.pointer, - FfiConverterOptionUInt64.lower(timestamp), - FfiConverterOptionSequenceUInt32.lower(issued), - FfiConverterOptionSequenceUInt32.lower(revoked), - FfiConverterTypeRevocationRegistryDefinition.lower(revRegDef), - FfiConverterTypeRevocationStatusList.lower(currentList), $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_issuer_update_revocation_status_list(self.pointer, + FfiConverterOptionUInt64.lower(timestamp), + FfiConverterOptionSequenceUInt32.lower(issued), + FfiConverterOptionSequenceUInt32.lower(revoked), + FfiConverterTypeRevocationRegistryDefinition.lower(revRegDef), + FfiConverterTypeRevocationStatusList.lower(currentList), $0) + } ) } public func createCredentialOffer(schemaId: String, credDefId: String, correctnessProof: CredentialKeyCorrectnessProof) throws -> CredentialOffer { return try FfiConverterTypeCredentialOffer.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_issuer_create_credential_offer(self.pointer, - FfiConverterString.lower(schemaId), - FfiConverterString.lower(credDefId), - FfiConverterTypeCredentialKeyCorrectnessProof.lower(correctnessProof), $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_issuer_create_credential_offer(self.pointer, + FfiConverterString.lower(schemaId), + FfiConverterString.lower(credDefId), + FfiConverterTypeCredentialKeyCorrectnessProof.lower(correctnessProof), $0) + } ) } public func createCredential(credDef: CredentialDefinition, credDefPrivate: CredentialDefinitionPrivate, credOffer: CredentialOffer, credRequest: CredentialRequest, credValues: [AttributeValues], revRegId: RevocationRegistryId?, revStatusList: RevocationStatusList?, revocationConfig: CredentialRevocationConfig?) throws -> Credential { return try FfiConverterTypeCredential.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_issuer_create_credential(self.pointer, - FfiConverterTypeCredentialDefinition.lower(credDef), - FfiConverterTypeCredentialDefinitionPrivate.lower(credDefPrivate), - FfiConverterTypeCredentialOffer.lower(credOffer), - FfiConverterTypeCredentialRequest.lower(credRequest), - FfiConverterSequenceTypeAttributeValues.lower(credValues), - FfiConverterOptionTypeRevocationRegistryId.lower(revRegId), - FfiConverterOptionTypeRevocationStatusList.lower(revStatusList), - FfiConverterOptionTypeCredentialRevocationConfig.lower(revocationConfig), $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_issuer_create_credential(self.pointer, + FfiConverterTypeCredentialDefinition.lower(credDef), + FfiConverterTypeCredentialDefinitionPrivate.lower(credDefPrivate), + FfiConverterTypeCredentialOffer.lower(credOffer), + FfiConverterTypeCredentialRequest.lower(credRequest), + FfiConverterSequenceTypeAttributeValues.lower(credValues), + FfiConverterOptionTypeRevocationRegistryId.lower(revRegId), + FfiConverterOptionTypeRevocationStatusList.lower(revStatusList), + FfiConverterOptionTypeCredentialRevocationConfig.lower(revocationConfig), $0) + } ) } } @@ -1334,7 +1320,7 @@ public class LinkSecret: LinkSecretProtocol { } public static func newFromValue(valueString: String) throws -> LinkSecret { - return LinkSecret(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + return try LinkSecret(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_linksecret_new_from_value( FfiConverterString.lower(valueString), $0 ) @@ -1352,10 +1338,9 @@ public class LinkSecret: LinkSecretProtocol { public func getValue() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_linksecret_get_value(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_linksecret_get_value(self.pointer, $0) + } ) } } @@ -1423,7 +1408,7 @@ public class Nonce: NonceProtocol { } public static func newFromValue(valueString: String) throws -> Nonce { - return Nonce(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + return try Nonce(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_nonce_new_from_value( FfiConverterString.lower(valueString), $0 ) @@ -1432,10 +1417,9 @@ public class Nonce: NonceProtocol { public func getValue() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_nonce_get_value(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_nonce_get_value(self.pointer, $0) + } ) } } @@ -1493,7 +1477,7 @@ public class Presentation: PresentationProtocol { } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_presentation_new( FfiConverterString.lower(jsonString), $0 ) @@ -1506,10 +1490,9 @@ public class Presentation: PresentationProtocol { public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_presentation_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_presentation_get_json(self.pointer, $0) + } ) } } @@ -1567,7 +1550,7 @@ public class PresentationRequest: PresentationRequestProtocol { } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_presentationrequest_new( FfiConverterString.lower(jsonString), $0 ) @@ -1580,10 +1563,9 @@ public class PresentationRequest: PresentationRequestProtocol { public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_presentationrequest_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_presentationrequest_get_json(self.pointer, $0) + } ) } } @@ -1655,45 +1637,42 @@ public class Prover: ProverProtocol { public func createCredentialRequest(entropy: String?, proverDid: String?, credDef: CredentialDefinition, linkSecret: LinkSecret, linkSecretId: String, credentialOffer: CredentialOffer) throws -> CreateCrendentialRequestResponse { return try FfiConverterTypeCreateCrendentialRequestResponse.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_prover_create_credential_request(self.pointer, - FfiConverterOptionString.lower(entropy), - FfiConverterOptionString.lower(proverDid), - FfiConverterTypeCredentialDefinition.lower(credDef), - FfiConverterTypeLinkSecret.lower(linkSecret), - FfiConverterString.lower(linkSecretId), - FfiConverterTypeCredentialOffer.lower(credentialOffer), $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_prover_create_credential_request(self.pointer, + FfiConverterOptionString.lower(entropy), + FfiConverterOptionString.lower(proverDid), + FfiConverterTypeCredentialDefinition.lower(credDef), + FfiConverterTypeLinkSecret.lower(linkSecret), + FfiConverterString.lower(linkSecretId), + FfiConverterTypeCredentialOffer.lower(credentialOffer), $0) + } ) } public func processCredential(credential: Credential, credRequestMetadata: CredentialRequestMetadata, linkSecret: LinkSecret, credDef: CredentialDefinition, revRegDef: RevocationRegistryDefinition?) throws -> Credential { return try FfiConverterTypeCredential.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_prover_process_credential(self.pointer, - FfiConverterTypeCredential.lower(credential), - FfiConverterTypeCredentialRequestMetadata.lower(credRequestMetadata), - FfiConverterTypeLinkSecret.lower(linkSecret), - FfiConverterTypeCredentialDefinition.lower(credDef), - FfiConverterOptionTypeRevocationRegistryDefinition.lower(revRegDef), $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_prover_process_credential(self.pointer, + FfiConverterTypeCredential.lower(credential), + FfiConverterTypeCredentialRequestMetadata.lower(credRequestMetadata), + FfiConverterTypeLinkSecret.lower(linkSecret), + FfiConverterTypeCredentialDefinition.lower(credDef), + FfiConverterOptionTypeRevocationRegistryDefinition.lower(revRegDef), $0) + } ) } public func createPresentation(presentationRequest: PresentationRequest, credentials: [CredentialRequests], selfAttested: [String: String]?, linkSecret: LinkSecret, schemas: [SchemaId: Schema], credentialDefinitions: [CredentialDefinitionId: CredentialDefinition]) throws -> Presentation { return try FfiConverterTypePresentation.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_prover_create_presentation(self.pointer, - FfiConverterTypePresentationRequest.lower(presentationRequest), - FfiConverterSequenceTypeCredentialRequests.lower(credentials), - FfiConverterOptionDictionaryStringString.lower(selfAttested), - FfiConverterTypeLinkSecret.lower(linkSecret), - FfiConverterDictionaryTypeSchemaIdTypeSchema.lower(schemas), - FfiConverterDictionaryTypeCredentialDefinitionIdTypeCredentialDefinition.lower(credentialDefinitions), $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_prover_create_presentation(self.pointer, + FfiConverterTypePresentationRequest.lower(presentationRequest), + FfiConverterSequenceTypeCredentialRequests.lower(credentials), + FfiConverterOptionDictionaryStringString.lower(selfAttested), + FfiConverterTypeLinkSecret.lower(linkSecret), + FfiConverterDictionaryTypeSchemaIdTypeSchema.lower(schemas), + FfiConverterDictionaryTypeCredentialDefinitionIdTypeCredentialDefinition.lower(credentialDefinitions), $0) + } ) } @@ -1764,7 +1743,7 @@ public class RevocationRegistryDefinition: RevocationRegistryDefinitionProtocol } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_revocationregistrydefinition_new( FfiConverterString.lower(jsonString), $0 ) @@ -1813,10 +1792,9 @@ public class RevocationRegistryDefinition: RevocationRegistryDefinitionProtocol public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_revocationregistrydefinition_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_revocationregistrydefinition_get_json(self.pointer, $0) + } ) } } @@ -1874,7 +1852,7 @@ public class RevocationRegistryDefinitionPrivate: RevocationRegistryDefinitionPr } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_revocationregistrydefinitionprivate_new( FfiConverterString.lower(jsonString), $0 ) @@ -1887,10 +1865,9 @@ public class RevocationRegistryDefinitionPrivate: RevocationRegistryDefinitionPr public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_revocationregistrydefinitionprivate_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_revocationregistrydefinitionprivate_get_json(self.pointer, $0) + } ) } } @@ -1951,7 +1928,7 @@ public class RevocationRegistryDefinitionValue: RevocationRegistryDefinitionValu } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_revocationregistrydefinitionvalue_new( FfiConverterString.lower(jsonString), $0 ) @@ -1991,10 +1968,9 @@ public class RevocationRegistryDefinitionValue: RevocationRegistryDefinitionValu public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_revocationregistrydefinitionvalue_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_revocationregistrydefinitionvalue_get_json(self.pointer, $0) + } ) } } @@ -2052,7 +2028,7 @@ public class RevocationRegistryDefinitionValuePublicKeys: RevocationRegistryDefi } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_revocationregistrydefinitionvaluepublickeys_new( FfiConverterString.lower(jsonString), $0 ) @@ -2065,10 +2041,9 @@ public class RevocationRegistryDefinitionValuePublicKeys: RevocationRegistryDefi public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_revocationregistrydefinitionvaluepublickeys_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_revocationregistrydefinitionvaluepublickeys_get_json(self.pointer, $0) + } ) } } @@ -2126,7 +2101,7 @@ public class RevocationStatusList: RevocationStatusListProtocol { } public convenience init(jsonString: String) throws { - self.init(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + try self.init(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeAnoncredsError.lift) { uniffi_anoncreds_wrapper_fn_constructor_revocationstatuslist_new( FfiConverterString.lower(jsonString), $0 ) @@ -2139,10 +2114,9 @@ public class RevocationStatusList: RevocationStatusListProtocol { public func getJson() throws -> String { return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_revocationstatuslist_get_json(self.pointer, $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_revocationstatuslist_get_json(self.pointer, $0) + } ) } } @@ -2211,14 +2185,13 @@ public class Verifier: VerifierProtocol { public func verifyPresentation(presentation: Presentation, presentationRequest: PresentationRequest, schemas: [SchemaId: Schema], credentialDefinitions: [CredentialDefinitionId: CredentialDefinition]) throws -> Bool { return try FfiConverterBool.lift( - try - rustCallWithError(FfiConverterTypeAnoncredsError.lift) { - uniffi_anoncreds_wrapper_fn_method_verifier_verify_presentation(self.pointer, - FfiConverterTypePresentation.lower(presentation), - FfiConverterTypePresentationRequest.lower(presentationRequest), - FfiConverterDictionaryTypeSchemaIdTypeSchema.lower(schemas), - FfiConverterDictionaryTypeCredentialDefinitionIdTypeCredentialDefinition.lower(credentialDefinitions), $0) - } + rustCallWithError(FfiConverterTypeAnoncredsError.lift) { + uniffi_anoncreds_wrapper_fn_method_verifier_verify_presentation(self.pointer, + FfiConverterTypePresentation.lower(presentation), + FfiConverterTypePresentationRequest.lower(presentationRequest), + FfiConverterDictionaryTypeSchemaIdTypeSchema.lower(schemas), + FfiConverterDictionaryTypeCredentialDefinitionIdTypeCredentialDefinition.lower(credentialDefinitions), $0) + } ) } } @@ -2843,56 +2816,56 @@ public struct FfiConverterTypeAnoncredsError: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AnoncredsError { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return .ConversionError( - message: try FfiConverterString.read(from: &buf) + case 1: return try .ConversionError( + message: FfiConverterString.read(from: &buf) ) - case 2: return .SomethingWentWrong( - message: try FfiConverterString.read(from: &buf) + case 2: return try .SomethingWentWrong( + message: FfiConverterString.read(from: &buf) ) - case 3: return .CreateCrentialRequestError( - message: try FfiConverterString.read(from: &buf) + case 3: return try .CreateCrentialRequestError( + message: FfiConverterString.read(from: &buf) ) - case 4: return .CreateSchemaError( - message: try FfiConverterString.read(from: &buf) + case 4: return try .CreateSchemaError( + message: FfiConverterString.read(from: &buf) ) - case 5: return .CreateCredentialDefinition( - message: try FfiConverterString.read(from: &buf) + case 5: return try .CreateCredentialDefinition( + message: FfiConverterString.read(from: &buf) ) - case 6: return .CreateRevocationRegistryDef( - message: try FfiConverterString.read(from: &buf) + case 6: return try .CreateRevocationRegistryDef( + message: FfiConverterString.read(from: &buf) ) - case 7: return .CreateRevocationStatusList( - message: try FfiConverterString.read(from: &buf) + case 7: return try .CreateRevocationStatusList( + message: FfiConverterString.read(from: &buf) ) - case 8: return .UpdateRevocationStatusList( - message: try FfiConverterString.read(from: &buf) + case 8: return try .UpdateRevocationStatusList( + message: FfiConverterString.read(from: &buf) ) - case 9: return .CreateCredentialOffer( - message: try FfiConverterString.read(from: &buf) + case 9: return try .CreateCredentialOffer( + message: FfiConverterString.read(from: &buf) ) - case 10: return .CreateCredential( - message: try FfiConverterString.read(from: &buf) + case 10: return try .CreateCredential( + message: FfiConverterString.read(from: &buf) ) - case 11: return .ProcessCredential( - message: try FfiConverterString.read(from: &buf) + case 11: return try .ProcessCredential( + message: FfiConverterString.read(from: &buf) ) - case 12: return .CreatePresentationError( - message: try FfiConverterString.read(from: &buf) + case 12: return try .CreatePresentationError( + message: FfiConverterString.read(from: &buf) ) - case 13: return .ProcessCredentialError( - message: try FfiConverterString.read(from: &buf) + case 13: return try .ProcessCredentialError( + message: FfiConverterString.read(from: &buf) ) default: throw UniffiInternalError.unexpectedEnumCase @@ -3191,7 +3164,7 @@ private struct FfiConverterSequenceUInt32: FfiConverterRustBuffer { var seq = [UInt32]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterUInt32.read(from: &buf)) + try seq.append(FfiConverterUInt32.read(from: &buf)) } return seq } @@ -3213,7 +3186,7 @@ private struct FfiConverterSequenceString: FfiConverterRustBuffer { var seq = [String]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterString.read(from: &buf)) + try seq.append(FfiConverterString.read(from: &buf)) } return seq } @@ -3235,7 +3208,7 @@ private struct FfiConverterSequenceTypeAttributeValues: FfiConverterRustBuffer { var seq = [AttributeValues]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterTypeAttributeValues.read(from: &buf)) + try seq.append(FfiConverterTypeAttributeValues.read(from: &buf)) } return seq } @@ -3257,7 +3230,7 @@ private struct FfiConverterSequenceTypeCredentialRequests: FfiConverterRustBuffe var seq = [CredentialRequests]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterTypeCredentialRequests.read(from: &buf)) + try seq.append(FfiConverterTypeCredentialRequests.read(from: &buf)) } return seq } @@ -3279,7 +3252,7 @@ private struct FfiConverterSequenceTypeRequestedAttribute: FfiConverterRustBuffe var seq = [RequestedAttribute]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterTypeRequestedAttribute.read(from: &buf)) + try seq.append(FfiConverterTypeRequestedAttribute.read(from: &buf)) } return seq } @@ -3301,7 +3274,7 @@ private struct FfiConverterSequenceTypeRequestedPredicate: FfiConverterRustBuffe var seq = [RequestedPredicate]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterTypeRequestedPredicate.read(from: &buf)) + try seq.append(FfiConverterTypeRequestedPredicate.read(from: &buf)) } return seq }