diff --git a/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/Extensions.kt b/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/Extensions.kt index 15cdac1..7f8f20d 100644 --- a/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/Extensions.kt +++ b/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/Extensions.kt @@ -7,7 +7,6 @@ import com.miracl.trust.registration.VerificationException import com.miracl.trust.registration.QuickCodeException import com.miracl.trust.registration.RegistrationException import com.miracl.trust.session.AuthenticationSessionException -import com.miracl.trust.session.SigningSessionException import com.miracl.trust.signing.SigningException internal val ConfigurationException.flutterExceptionCodeRepresentation: MConfigurationExceptionCode @@ -79,17 +78,6 @@ internal val AuthenticationSessionException.flutterExceptionCodeRepresentation: AuthenticationSessionException.InvalidSessionDetails -> MAuthenticationSessionDetailsExceptionCode.INVALID_AUTHENTICATION_SESSION_DETAILS } -internal val SigningSessionException.flutterExceptionCodeRepresentation: MSigningSessionDetailsExceptionCode - get() = when (this) { - is SigningSessionException.AbortSigningSessionFail -> MSigningSessionDetailsExceptionCode.ABORT_SIGNING_SESSION_FAIL - is SigningSessionException.CompleteSigningSessionFail -> MSigningSessionDetailsExceptionCode.COMPLETE_SIGNING_SESSION_FAIL - is SigningSessionException.GetSigningSessionDetailsFail -> MSigningSessionDetailsExceptionCode.GET_SIGNING_SESSION_DETAILS_FAIL - SigningSessionException.InvalidAppLink -> MSigningSessionDetailsExceptionCode.INVALID_LINK - SigningSessionException.InvalidQRCode -> MSigningSessionDetailsExceptionCode.INVALID_QRCODE - SigningSessionException.InvalidSigningSession -> MSigningSessionDetailsExceptionCode.INVALID_SIGNING_SESSION - SigningSessionException.InvalidSigningSessionDetails -> MSigningSessionDetailsExceptionCode.INVALID_SIGNING_SESSION_DETAILS - } - internal val SigningException.flutterExceptionCodeRepresentation: MSigningExceptionCode get() = when (this) { SigningException.EmptyMessageHash -> MSigningExceptionCode.EMPTY_MESSAGE_HASH diff --git a/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/FlutterMiraclSdkPlugin.kt b/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/FlutterMiraclSdkPlugin.kt index a629cff..d397563 100644 --- a/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/FlutterMiraclSdkPlugin.kt +++ b/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/FlutterMiraclSdkPlugin.kt @@ -170,22 +170,7 @@ class FlutterMiraclSdkPlugin : FlutterPlugin, MiraclSdk { sdkHandler.getAuthenticationSessionDetailsFromPayload(payload, callback) } - - override fun getSigningDetailsFromQRCode( - qrCode: String, callback: (kotlin.Result) -> Unit - ) { - sdkHandler.getSigningSessionDetailsFromQRCode(qrCode, callback) - } - - override fun getSigningSessionDetailsFromLink( - link: String, - callback: (kotlin.Result) -> Unit - ) { - sdkHandler.getSigningSessionDetailsFromLink(link, callback) - } - override fun getUser(userId: String, callback: (kotlin.Result) -> Unit) { sdkHandler.getUser(userId, callback) } - } diff --git a/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/Pigeon.kt b/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/Pigeon.kt index d8744b4..adbccbd 100644 --- a/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/Pigeon.kt +++ b/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/Pigeon.kt @@ -114,17 +114,6 @@ enum class MIdentityType(val raw: Int) { } } -enum class MSigningSessionStatus(val raw: Int) { - ACTIVE(0), - SIGNED(1); - - companion object { - fun ofRaw(raw: Int): MSigningSessionStatus? { - return values().firstOrNull { it.raw == raw } - } - } -} - enum class MConfigurationExceptionCode(val raw: Int) { EMPTY_PROJECT_ID(0), INVALID_PROJECT_URL(1); @@ -229,22 +218,6 @@ enum class MAuthenticationSessionDetailsExceptionCode(val raw: Int) { } } -enum class MSigningSessionDetailsExceptionCode(val raw: Int) { - INVALID_LINK(0), - INVALID_QRCODE(1), - INVALID_SIGNING_SESSION_DETAILS(2), - GET_SIGNING_SESSION_DETAILS_FAIL(3), - INVALID_SIGNING_SESSION(4), - COMPLETE_SIGNING_SESSION_FAIL(5), - ABORT_SIGNING_SESSION_FAIL(6); - - companion object { - fun ofRaw(raw: Int): MSigningSessionDetailsExceptionCode? { - return values().firstOrNull { it.raw == raw } - } - } -} - enum class MSigningExceptionCode(val raw: Int) { EMPTY_MESSAGE_HASH(0), EMPTY_PUBLIC_KEY(1), @@ -396,79 +369,6 @@ data class MAuthenticationSessionDetails ( override fun hashCode(): Int = toList().hashCode() } -/** Generated class from Pigeon that represents data sent in messages. */ -data class MSigningSessionDetails ( - val userId: String, - val projectName: String, - val projectLogoURL: String, - val projectId: String, - val pinLength: Long, - val verificationMethod: MVerificationMethod, - val verificationURL: String, - val verificationCustomText: String, - val identityTypeLabel: String, - val quickCodeEnabled: Boolean, - val identityType: MIdentityType, - val sessionId: String, - val signingHash: String, - val signingDescription: String, - val status: MSigningSessionStatus, - val expireTime: Long -) - { - companion object { - fun fromList(pigeonVar_list: List): MSigningSessionDetails { - val userId = pigeonVar_list[0] as String - val projectName = pigeonVar_list[1] as String - val projectLogoURL = pigeonVar_list[2] as String - val projectId = pigeonVar_list[3] as String - val pinLength = pigeonVar_list[4] as Long - val verificationMethod = pigeonVar_list[5] as MVerificationMethod - val verificationURL = pigeonVar_list[6] as String - val verificationCustomText = pigeonVar_list[7] as String - val identityTypeLabel = pigeonVar_list[8] as String - val quickCodeEnabled = pigeonVar_list[9] as Boolean - val identityType = pigeonVar_list[10] as MIdentityType - val sessionId = pigeonVar_list[11] as String - val signingHash = pigeonVar_list[12] as String - val signingDescription = pigeonVar_list[13] as String - val status = pigeonVar_list[14] as MSigningSessionStatus - val expireTime = pigeonVar_list[15] as Long - return MSigningSessionDetails(userId, projectName, projectLogoURL, projectId, pinLength, verificationMethod, verificationURL, verificationCustomText, identityTypeLabel, quickCodeEnabled, identityType, sessionId, signingHash, signingDescription, status, expireTime) - } - } - fun toList(): List { - return listOf( - userId, - projectName, - projectLogoURL, - projectId, - pinLength, - verificationMethod, - verificationURL, - verificationCustomText, - identityTypeLabel, - quickCodeEnabled, - identityType, - sessionId, - signingHash, - signingDescription, - status, - expireTime, - ) - } - override fun equals(other: Any?): Boolean { - if (other !is MSigningSessionDetails) { - return false - } - if (this === other) { - return true - } - return PigeonPigeonUtils.deepEquals(toList(), other.toList()) } - - override fun hashCode(): Int = toList().hashCode() -} - /** Generated class from Pigeon that represents data sent in messages. */ data class MUser ( val projectId: String, @@ -700,101 +600,86 @@ private open class PigeonPigeonCodec : StandardMessageCodec() { } } 132.toByte() -> { - return (readValue(buffer) as Long?)?.let { - MSigningSessionStatus.ofRaw(it.toInt()) - } - } - 133.toByte() -> { return (readValue(buffer) as Long?)?.let { MConfigurationExceptionCode.ofRaw(it.toInt()) } } - 134.toByte() -> { + 133.toByte() -> { return (readValue(buffer) as Long?)?.let { MEmailVerificationExceptionCode.ofRaw(it.toInt()) } } - 135.toByte() -> { + 134.toByte() -> { return (readValue(buffer) as Long?)?.let { MActivationTokenExceptionCode.ofRaw(it.toInt()) } } - 136.toByte() -> { + 135.toByte() -> { return (readValue(buffer) as Long?)?.let { MRegistrationExceptionCode.ofRaw(it.toInt()) } } - 137.toByte() -> { + 136.toByte() -> { return (readValue(buffer) as Long?)?.let { MAuthenticationExceptionCode.ofRaw(it.toInt()) } } - 138.toByte() -> { + 137.toByte() -> { return (readValue(buffer) as Long?)?.let { MQuickCodeExceptionCode.ofRaw(it.toInt()) } } - 139.toByte() -> { + 138.toByte() -> { return (readValue(buffer) as Long?)?.let { MAuthenticationSessionDetailsExceptionCode.ofRaw(it.toInt()) } } - 140.toByte() -> { - return (readValue(buffer) as Long?)?.let { - MSigningSessionDetailsExceptionCode.ofRaw(it.toInt()) - } - } - 141.toByte() -> { + 139.toByte() -> { return (readValue(buffer) as Long?)?.let { MSigningExceptionCode.ofRaw(it.toInt()) } } - 142.toByte() -> { + 140.toByte() -> { return (readValue(buffer) as? List)?.let { MConfiguration.fromList(it) } } - 143.toByte() -> { + 141.toByte() -> { return (readValue(buffer) as? List)?.let { MActivationTokenResponse.fromList(it) } } - 144.toByte() -> { + 142.toByte() -> { return (readValue(buffer) as? List)?.let { MAuthenticationSessionDetails.fromList(it) } } - 145.toByte() -> { - return (readValue(buffer) as? List)?.let { - MSigningSessionDetails.fromList(it) - } - } - 146.toByte() -> { + 143.toByte() -> { return (readValue(buffer) as? List)?.let { MUser.fromList(it) } } - 147.toByte() -> { + 144.toByte() -> { return (readValue(buffer) as? List)?.let { MQuickCode.fromList(it) } } - 148.toByte() -> { + 145.toByte() -> { return (readValue(buffer) as? List)?.let { MSignature.fromList(it) } } - 149.toByte() -> { + 146.toByte() -> { return (readValue(buffer) as? List)?.let { MSigningResult.fromList(it) } } - 150.toByte() -> { + 147.toByte() -> { return (readValue(buffer) as? List)?.let { MActivationTokenErrorResponse.fromList(it) } } - 151.toByte() -> { + 148.toByte() -> { return (readValue(buffer) as? List)?.let { MEmailVerificationResponse.fromList(it) } @@ -816,84 +701,72 @@ private open class PigeonPigeonCodec : StandardMessageCodec() { stream.write(131) writeValue(stream, value.raw) } - is MSigningSessionStatus -> { - stream.write(132) - writeValue(stream, value.raw) - } is MConfigurationExceptionCode -> { - stream.write(133) + stream.write(132) writeValue(stream, value.raw) } is MEmailVerificationExceptionCode -> { - stream.write(134) + stream.write(133) writeValue(stream, value.raw) } is MActivationTokenExceptionCode -> { - stream.write(135) + stream.write(134) writeValue(stream, value.raw) } is MRegistrationExceptionCode -> { - stream.write(136) + stream.write(135) writeValue(stream, value.raw) } is MAuthenticationExceptionCode -> { - stream.write(137) + stream.write(136) writeValue(stream, value.raw) } is MQuickCodeExceptionCode -> { - stream.write(138) + stream.write(137) writeValue(stream, value.raw) } is MAuthenticationSessionDetailsExceptionCode -> { - stream.write(139) - writeValue(stream, value.raw) - } - is MSigningSessionDetailsExceptionCode -> { - stream.write(140) + stream.write(138) writeValue(stream, value.raw) } is MSigningExceptionCode -> { - stream.write(141) + stream.write(139) writeValue(stream, value.raw) } is MConfiguration -> { - stream.write(142) + stream.write(140) writeValue(stream, value.toList()) } is MActivationTokenResponse -> { - stream.write(143) + stream.write(141) writeValue(stream, value.toList()) } is MAuthenticationSessionDetails -> { - stream.write(144) - writeValue(stream, value.toList()) - } - is MSigningSessionDetails -> { - stream.write(145) + stream.write(142) writeValue(stream, value.toList()) } is MUser -> { - stream.write(146) + stream.write(143) writeValue(stream, value.toList()) } is MQuickCode -> { - stream.write(147) + stream.write(144) writeValue(stream, value.toList()) } is MSignature -> { - stream.write(148) + stream.write(145) writeValue(stream, value.toList()) } is MSigningResult -> { - stream.write(149) + stream.write(146) writeValue(stream, value.toList()) } is MActivationTokenErrorResponse -> { - stream.write(150) + stream.write(147) writeValue(stream, value.toList()) } is MEmailVerificationResponse -> { - stream.write(151) + stream.write(148) writeValue(stream, value.toList()) } else -> super.writeValue(stream, value) @@ -923,8 +796,6 @@ interface MiraclSdk { fun getAuthenticationSessionDetailsFromQRCode(qrCode: String, callback: (Result) -> Unit) fun getAuthenticationSessionDetailsFromLink(link: String, callback: (Result) -> Unit) fun getAuthenticationSessionDetailsFromPushNofitifactionPayload(payload: Map, callback: (Result) -> Unit) - fun getSigningDetailsFromQRCode(qrCode: String, callback: (Result) -> Unit) - fun getSigningSessionDetailsFromLink(link: String, callback: (Result) -> Unit) companion object { /** The codec used by MiraclSdk. */ @@ -1323,46 +1194,6 @@ interface MiraclSdk { channel.setMessageHandler(null) } } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.flutter_miracl_sdk.MiraclSdk.getSigningDetailsFromQRCode$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val qrCodeArg = args[0] as String - api.getSigningDetailsFromQRCode(qrCodeArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(PigeonPigeonUtils.wrapError(error)) - } else { - val data = result.getOrNull() - reply.reply(PigeonPigeonUtils.wrapResult(data)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.flutter_miracl_sdk.MiraclSdk.getSigningSessionDetailsFromLink$separatedMessageChannelSuffix", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val linkArg = args[0] as String - api.getSigningSessionDetailsFromLink(linkArg) { result: Result -> - val error = result.exceptionOrNull() - if (error != null) { - reply.reply(PigeonPigeonUtils.wrapError(error)) - } else { - val data = result.getOrNull() - reply.reply(PigeonPigeonUtils.wrapResult(data)) - } - } - } - } else { - channel.setMessageHandler(null) - } - } } } } diff --git a/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/SdkHandler.kt b/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/SdkHandler.kt index cff2b6a..80c2802 100644 --- a/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/SdkHandler.kt +++ b/android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/SdkHandler.kt @@ -12,7 +12,6 @@ import com.miracl.trust.registration.ActivationTokenErrorResponse import com.miracl.trust.registration.ActivationTokenException import com.miracl.trust.registration.VerificationException import com.miracl.trust.signing.SigningException -import com.miracl.trust.session.SigningSessionException import com.miracl.trust.authentication.AuthenticationException import com.miracl.trust.registration.QuickCodeException import com.miracl.trust.session.AuthenticationSessionException @@ -594,102 +593,6 @@ class SdkHandler { } } - fun getSigningSessionDetailsFromQRCode( - qrCode: String, - callback: (Result) -> Unit - ) { - MIRACLTrust.getInstance().getSigningSessionDetailsFromQRCode(qrCode) { - if (it is MIRACLSuccess) { - callback( - Result.success( - MSigningSessionDetails( - it.value.userId, - it.value.projectName, - it.value.projectLogoUrl, - it.value.projectId, - it.value.pinLength.toLong(), - MVerificationMethod.ofRaw(it.value.verificationMethod.ordinal) ?: MVerificationMethod.STANDARD_EMAIL, - it.value.verificationUrl, - it.value.verificationCustomText, - it.value.identityTypeLabel, - it.value.quickCodeEnabled, - MIdentityType.ofRaw(it.value.identityType.ordinal) ?: MIdentityType.EMAIL, - it.value.sessionId, - it.value.signingHash, - it.value.signingDescription, - MSigningSessionStatus.ofRaw(it.value.status.ordinal) ?: MSigningSessionStatus.ACTIVE, - it.value.expireTime - ) - ) - ) - } else { - if (it is MIRACLError) { - val error = it.value - val details = mutableMapOf() - - details["exceptionCode"] = error.flutterExceptionCodeRepresentation - if (error is SigningSessionException.GetSigningSessionDetailsFail && error.cause != null) { - details["error"] = error.cause.toString() - } - - callback( - Result.failure( - mapExceptionToFlutter(it.value, details) - ) - ) - } - } - } - } - - fun getSigningSessionDetailsFromLink( - link: String, - callback: (Result) -> Unit - ) { - MIRACLTrust.getInstance().getSigningSessionDetailsFromAppLink(Uri.parse(link)) { - if (it is MIRACLSuccess) { - callback( - Result.success( - MSigningSessionDetails( - it.value.userId, - it.value.projectName, - it.value.projectLogoUrl, - it.value.projectId, - it.value.pinLength.toLong(), - MVerificationMethod.ofRaw(it.value.verificationMethod.ordinal) ?: MVerificationMethod.STANDARD_EMAIL, - it.value.verificationUrl, - it.value.verificationCustomText, - it.value.identityTypeLabel, - it.value.quickCodeEnabled, - MIdentityType.ofRaw(it.value.identityType.ordinal) ?: MIdentityType.EMAIL, - it.value.sessionId, - it.value.signingHash, - it.value.signingDescription, - MSigningSessionStatus.ofRaw(it.value.status.ordinal) ?: MSigningSessionStatus.ACTIVE, - it.value.expireTime - ) - ) - ) - } else { - if (it is MIRACLError) { - val error = it.value - val details = mutableMapOf() - - details["exceptionCode"] = error.flutterExceptionCodeRepresentation - if (error is SigningSessionException.GetSigningSessionDetailsFail && error.cause != null) { - details["error"] = error.cause.toString() - } - - callback( - Result.failure( - mapExceptionToFlutter(it.value, details) - ) - ); - } - } - } - } - fun sign( userId: String, pin: String, diff --git a/integration_test_app/integration_test/compatiblity_test.dart b/integration_test_app/integration_test/compatiblity_test.dart index 3dc88a9..33821ea 100644 --- a/integration_test_app/integration_test/compatiblity_test.dart +++ b/integration_test_app/integration_test/compatiblity_test.dart @@ -230,29 +230,6 @@ void main() { activationTokenResponse = await miraclTrust.getActivationTokenByURI(verificationURI); user = await miraclTrust.register(userId, activationTokenResponse.activationToken, pin); - // Start a signing session. - final signingQRCode = await startSigningSession(cuvProjectId, userId, "Hello World", "Hello Desc", cuvProjectUrl); - - SigningSessionDetails signingSessionDetails = await miraclTrust.getSigningSessionDetailsFromQRCode(signingQRCode); - expect(signingSessionDetails.projectId, equals(cuvProjectId)); - - signingSessionDetails = await miraclTrust.getSigningSessionDetailsFromLink(Uri.parse(signingQRCode)); - expect(signingSessionDetails.projectId, equals(cuvProjectId)); - - await expectLater( - miraclTrust.getSigningSessionDetailsFromQRCode(""), - throwsA(isA().having( - (e) => e.code, "", equals(SigningSessionDetailsExceptionCode.invalidQRCode) - )) - ); - - await expectLater( - miraclTrust.getSigningSessionDetailsFromLink(Uri.parse("https://google.com")), - throwsA(isA().having( - (e) => e.code, "", equals(SigningSessionDetailsExceptionCode.invalidLink) - )) - ); - // Sign messages. String myString = "Hello, world! 😊"; List codeUnits = utf8.encode(myString); diff --git a/integration_test_app/integration_test/test_helpers.dart b/integration_test_app/integration_test/test_helpers.dart index 2c506f4..7a40516 100644 --- a/integration_test_app/integration_test/test_helpers.dart +++ b/integration_test_app/integration_test/test_helpers.dart @@ -95,29 +95,6 @@ String createRandomPin() { return smh; } -Future startSigningSession( - String projectId, - String userId, - String hash, - String description, - String projectUrl -) async { - var request = http.Request('POST', Uri.parse('$projectUrl/dvs/session')); - final Map body = { - 'projectId': projectId, - 'userId': userId, - 'hash' : hash, - 'description': description - }; - final String jsonBody = jsonEncode(body); - request.body = jsonBody; - - http.StreamedResponse response = await request.send(); - final responseString = jsonDecode(await response.stream.bytesToString()); - - return responseString["qrURL"]; -} - Future verifySignature( SigningResult signingResult, String serviceAccountToken, diff --git a/ios/flutter_miracl_sdk/Sources/flutter_miracl_sdk/Error+Extensions.swift b/ios/flutter_miracl_sdk/Sources/flutter_miracl_sdk/Error+Extensions.swift index c59d042..2e24938 100644 --- a/ios/flutter_miracl_sdk/Sources/flutter_miracl_sdk/Error+Extensions.swift +++ b/ios/flutter_miracl_sdk/Sources/flutter_miracl_sdk/Error+Extensions.swift @@ -137,25 +137,6 @@ extension AuthenticationSessionError { } } -extension SigningSessionError { - var flutterExceptionCodeRepresentation: MSigningSessionDetailsExceptionCode { - switch self { - case .abortSigningSessionFail: - return MSigningSessionDetailsExceptionCode.abortSigningSessionFail - case .getSigningSessionDetailsFail: - return MSigningSessionDetailsExceptionCode.getSigningSessionDetailsFail - case .invalidQRCode: - return MSigningSessionDetailsExceptionCode.invalidQRCode - case .invalidSigningSession: - return MSigningSessionDetailsExceptionCode.invalidSigningSession - case .invalidSigningSessionDetails: - return MSigningSessionDetailsExceptionCode.invalidSigningSessionDetails - case .invalidUniversalLinkURL: - return MSigningSessionDetailsExceptionCode.invalidLink - } - } -} - extension SigningError { var flutterExceptionCodeRepresentation: MSigningExceptionCode { switch self { diff --git a/ios/flutter_miracl_sdk/Sources/flutter_miracl_sdk/Pigeon.swift b/ios/flutter_miracl_sdk/Sources/flutter_miracl_sdk/Pigeon.swift index 5510b41..9891f0d 100644 --- a/ios/flutter_miracl_sdk/Sources/flutter_miracl_sdk/Pigeon.swift +++ b/ios/flutter_miracl_sdk/Sources/flutter_miracl_sdk/Pigeon.swift @@ -147,11 +147,6 @@ enum MIdentityType: Int { case alphanumeric = 1 } -enum MSigningSessionStatus: Int { - case active = 0 - case signed = 1 -} - enum MConfigurationExceptionCode: Int { case emptyProjectId = 0 case invalidProjectUrl = 1 @@ -214,16 +209,6 @@ enum MAuthenticationSessionDetailsExceptionCode: Int { case abortSessionFail = 5 } -enum MSigningSessionDetailsExceptionCode: Int { - case invalidLink = 0 - case invalidQRCode = 1 - case invalidSigningSessionDetails = 2 - case getSigningSessionDetailsFail = 3 - case invalidSigningSession = 4 - case completeSigningSessionFail = 5 - case abortSigningSessionFail = 6 -} - enum MSigningExceptionCode: Int { case emptyMessageHash = 0 case emptyPublicKey = 1 @@ -376,91 +361,6 @@ struct MAuthenticationSessionDetails: Hashable { } } -/// Generated class from Pigeon that represents data sent in messages. -struct MSigningSessionDetails: Hashable { - var userId: String - var projectName: String - var projectLogoURL: String - var projectId: String - var pinLength: Int64 - var verificationMethod: MVerificationMethod - var verificationURL: String - var verificationCustomText: String - var identityTypeLabel: String - var quickCodeEnabled: Bool - var identityType: MIdentityType - var sessionId: String - var signingHash: String - var signingDescription: String - var status: MSigningSessionStatus - var expireTime: Int64 - - - // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ pigeonVar_list: [Any?]) -> MSigningSessionDetails? { - let userId = pigeonVar_list[0] as! String - let projectName = pigeonVar_list[1] as! String - let projectLogoURL = pigeonVar_list[2] as! String - let projectId = pigeonVar_list[3] as! String - let pinLength = pigeonVar_list[4] as! Int64 - let verificationMethod = pigeonVar_list[5] as! MVerificationMethod - let verificationURL = pigeonVar_list[6] as! String - let verificationCustomText = pigeonVar_list[7] as! String - let identityTypeLabel = pigeonVar_list[8] as! String - let quickCodeEnabled = pigeonVar_list[9] as! Bool - let identityType = pigeonVar_list[10] as! MIdentityType - let sessionId = pigeonVar_list[11] as! String - let signingHash = pigeonVar_list[12] as! String - let signingDescription = pigeonVar_list[13] as! String - let status = pigeonVar_list[14] as! MSigningSessionStatus - let expireTime = pigeonVar_list[15] as! Int64 - - return MSigningSessionDetails( - userId: userId, - projectName: projectName, - projectLogoURL: projectLogoURL, - projectId: projectId, - pinLength: pinLength, - verificationMethod: verificationMethod, - verificationURL: verificationURL, - verificationCustomText: verificationCustomText, - identityTypeLabel: identityTypeLabel, - quickCodeEnabled: quickCodeEnabled, - identityType: identityType, - sessionId: sessionId, - signingHash: signingHash, - signingDescription: signingDescription, - status: status, - expireTime: expireTime - ) - } - func toList() -> [Any?] { - return [ - userId, - projectName, - projectLogoURL, - projectId, - pinLength, - verificationMethod, - verificationURL, - verificationCustomText, - identityTypeLabel, - quickCodeEnabled, - identityType, - sessionId, - signingHash, - signingDescription, - status, - expireTime, - ] - } - static func == (lhs: MSigningSessionDetails, rhs: MSigningSessionDetails) -> Bool { - return deepEqualsPigeon(lhs.toList(), rhs.toList()) } - func hash(into hasher: inout Hasher) { - deepHashPigeon(value: toList(), hasher: &hasher) - } -} - /// Generated class from Pigeon that represents data sent in messages. struct MUser: Hashable { var projectId: String @@ -693,84 +593,70 @@ private class PigeonPigeonCodecReader: FlutterStandardReader { } return nil case 132: - let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) - if let enumResultAsInt = enumResultAsInt { - return MSigningSessionStatus(rawValue: enumResultAsInt) - } - return nil - case 133: let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) if let enumResultAsInt = enumResultAsInt { return MConfigurationExceptionCode(rawValue: enumResultAsInt) } return nil - case 134: + case 133: let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) if let enumResultAsInt = enumResultAsInt { return MEmailVerificationExceptionCode(rawValue: enumResultAsInt) } return nil - case 135: + case 134: let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) if let enumResultAsInt = enumResultAsInt { return MActivationTokenExceptionCode(rawValue: enumResultAsInt) } return nil - case 136: + case 135: let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) if let enumResultAsInt = enumResultAsInt { return MRegistrationExceptionCode(rawValue: enumResultAsInt) } return nil - case 137: + case 136: let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) if let enumResultAsInt = enumResultAsInt { return MAuthenticationExceptionCode(rawValue: enumResultAsInt) } return nil - case 138: + case 137: let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) if let enumResultAsInt = enumResultAsInt { return MQuickCodeExceptionCode(rawValue: enumResultAsInt) } return nil - case 139: + case 138: let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) if let enumResultAsInt = enumResultAsInt { return MAuthenticationSessionDetailsExceptionCode(rawValue: enumResultAsInt) } return nil - case 140: - let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) - if let enumResultAsInt = enumResultAsInt { - return MSigningSessionDetailsExceptionCode(rawValue: enumResultAsInt) - } - return nil - case 141: + case 139: let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?) if let enumResultAsInt = enumResultAsInt { return MSigningExceptionCode(rawValue: enumResultAsInt) } return nil - case 142: + case 140: return MConfiguration.fromList(self.readValue() as! [Any?]) - case 143: + case 141: return MActivationTokenResponse.fromList(self.readValue() as! [Any?]) - case 144: + case 142: return MAuthenticationSessionDetails.fromList(self.readValue() as! [Any?]) - case 145: - return MSigningSessionDetails.fromList(self.readValue() as! [Any?]) - case 146: + case 143: return MUser.fromList(self.readValue() as! [Any?]) - case 147: + case 144: return MQuickCode.fromList(self.readValue() as! [Any?]) - case 148: + case 145: return MSignature.fromList(self.readValue() as! [Any?]) - case 149: + case 146: return MSigningResult.fromList(self.readValue() as! [Any?]) - case 150: + case 147: return MActivationTokenErrorResponse.fromList(self.readValue() as! [Any?]) - case 151: + case 148: return MEmailVerificationResponse.fromList(self.readValue() as! [Any?]) default: return super.readValue(ofType: type) @@ -789,65 +675,56 @@ private class PigeonPigeonCodecWriter: FlutterStandardWriter { } else if let value = value as? MIdentityType { super.writeByte(131) super.writeValue(value.rawValue) - } else if let value = value as? MSigningSessionStatus { - super.writeByte(132) - super.writeValue(value.rawValue) } else if let value = value as? MConfigurationExceptionCode { - super.writeByte(133) + super.writeByte(132) super.writeValue(value.rawValue) } else if let value = value as? MEmailVerificationExceptionCode { - super.writeByte(134) + super.writeByte(133) super.writeValue(value.rawValue) } else if let value = value as? MActivationTokenExceptionCode { - super.writeByte(135) + super.writeByte(134) super.writeValue(value.rawValue) } else if let value = value as? MRegistrationExceptionCode { - super.writeByte(136) + super.writeByte(135) super.writeValue(value.rawValue) } else if let value = value as? MAuthenticationExceptionCode { - super.writeByte(137) + super.writeByte(136) super.writeValue(value.rawValue) } else if let value = value as? MQuickCodeExceptionCode { - super.writeByte(138) + super.writeByte(137) super.writeValue(value.rawValue) } else if let value = value as? MAuthenticationSessionDetailsExceptionCode { - super.writeByte(139) - super.writeValue(value.rawValue) - } else if let value = value as? MSigningSessionDetailsExceptionCode { - super.writeByte(140) + super.writeByte(138) super.writeValue(value.rawValue) } else if let value = value as? MSigningExceptionCode { - super.writeByte(141) + super.writeByte(139) super.writeValue(value.rawValue) } else if let value = value as? MConfiguration { - super.writeByte(142) + super.writeByte(140) super.writeValue(value.toList()) } else if let value = value as? MActivationTokenResponse { - super.writeByte(143) + super.writeByte(141) super.writeValue(value.toList()) } else if let value = value as? MAuthenticationSessionDetails { - super.writeByte(144) - super.writeValue(value.toList()) - } else if let value = value as? MSigningSessionDetails { - super.writeByte(145) + super.writeByte(142) super.writeValue(value.toList()) } else if let value = value as? MUser { - super.writeByte(146) + super.writeByte(143) super.writeValue(value.toList()) } else if let value = value as? MQuickCode { - super.writeByte(147) + super.writeByte(144) super.writeValue(value.toList()) } else if let value = value as? MSignature { - super.writeByte(148) + super.writeByte(145) super.writeValue(value.toList()) } else if let value = value as? MSigningResult { - super.writeByte(149) + super.writeByte(146) super.writeValue(value.toList()) } else if let value = value as? MActivationTokenErrorResponse { - super.writeByte(150) + super.writeByte(147) super.writeValue(value.toList()) } else if let value = value as? MEmailVerificationResponse { - super.writeByte(151) + super.writeByte(148) super.writeValue(value.toList()) } else { super.writeValue(value) @@ -891,8 +768,6 @@ protocol MiraclSdk { func getAuthenticationSessionDetailsFromQRCode(qrCode: String, completion: @escaping (Result) -> Void) func getAuthenticationSessionDetailsFromLink(link: String, completion: @escaping (Result) -> Void) func getAuthenticationSessionDetailsFromPushNofitifactionPayload(payload: [String: String], completion: @escaping (Result) -> Void) - func getSigningDetailsFromQRCode(qrCode: String, completion: @escaping (Result) -> Void) - func getSigningSessionDetailsFromLink(link: String, completion: @escaping (Result) -> Void) } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. @@ -1236,40 +1111,6 @@ class MiraclSdkSetup { } else { getAuthenticationSessionDetailsFromPushNofitifactionPayloadChannel.setMessageHandler(nil) } - let getSigningDetailsFromQRCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.flutter_miracl_sdk.MiraclSdk.getSigningDetailsFromQRCode\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getSigningDetailsFromQRCodeChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let qrCodeArg = args[0] as! String - api.getSigningDetailsFromQRCode(qrCode: qrCodeArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - getSigningDetailsFromQRCodeChannel.setMessageHandler(nil) - } - let getSigningSessionDetailsFromLinkChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.flutter_miracl_sdk.MiraclSdk.getSigningSessionDetailsFromLink\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getSigningSessionDetailsFromLinkChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let linkArg = args[0] as! String - api.getSigningSessionDetailsFromLink(link: linkArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } - } - } else { - getSigningSessionDetailsFromLinkChannel.setMessageHandler(nil) - } } } /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. diff --git a/ios/flutter_miracl_sdk/Sources/flutter_miracl_sdk/SdkHandler.swift b/ios/flutter_miracl_sdk/Sources/flutter_miracl_sdk/SdkHandler.swift index d082892..80fc264 100644 --- a/ios/flutter_miracl_sdk/Sources/flutter_miracl_sdk/SdkHandler.swift +++ b/ios/flutter_miracl_sdk/Sources/flutter_miracl_sdk/SdkHandler.swift @@ -607,98 +607,6 @@ public class SdkHandler: NSObject, MiraclSdk { } } - func getSigningDetailsFromQRCode( - qrCode: String, - completion: @escaping (Result) -> Void - ) { - MIRACLTrust - .getInstance() - .getSigningSessionDetailsFromQRCode( - qrCode: qrCode - ) { signingSessionDetails, error in - if let signingSessionDetails { - let mSigningSessionDetails = MSigningSessionDetails( - userId: signingSessionDetails.userId, - projectName: signingSessionDetails.projectName, - projectLogoURL: signingSessionDetails.projectLogoURL, - projectId: signingSessionDetails.projectId, - pinLength: Int64(signingSessionDetails.pinLength), - verificationMethod: MVerificationMethod(rawValue: signingSessionDetails.verificationMethod.rawValue) ?? .standardEmail , - verificationURL: signingSessionDetails.verificationURL, - verificationCustomText: signingSessionDetails.verificationCustomText, - identityTypeLabel: signingSessionDetails.identityTypeLabel, - quickCodeEnabled: signingSessionDetails.quickCodeEnabled, - identityType: MIdentityType(rawValue: signingSessionDetails.identityType.rawValue) ?? .email, - sessionId: signingSessionDetails.sessionId, - signingHash: signingSessionDetails.signingHash, - signingDescription: signingSessionDetails.signingDescription, - status: MSigningSessionStatus(rawValue:signingSessionDetails.status.rawValue) ?? .active , - expireTime: Int64((signingSessionDetails.expireTime.timeIntervalSince1970 * 1000.0).rounded()) - ) - completion(Result.success(mSigningSessionDetails)) - } else if let error { - var details = [String: Any]() - - if let signingSessionError = error as? SigningSessionError { - details["exceptionCode"] = signingSessionError.flutterExceptionCodeRepresentation - } - - if case let SigningSessionError.getSigningSessionDetailsFail(signingSessionError) = error, let signingSessionError { - details["error"] = signingSessionError.errorDebugDescription - } - - let pigeonError = self.createPigeonError(error: error, details: details) - completion(Result.failure(pigeonError)); - } - } - } - - func getSigningSessionDetailsFromLink( - link: String, - completion: @escaping (Result) -> Void - ) { - MIRACLTrust - .getInstance() - .getSigningSessionDetailsFromUniversalLinkURL( - universalLinkURL: URL(string: link)! - ) { signingSessionDetails, error in - if let signingSessionDetails { - let mSigningSessionDetails = MSigningSessionDetails( - userId: signingSessionDetails.userId, - projectName: signingSessionDetails.projectName, - projectLogoURL: signingSessionDetails.projectLogoURL, - projectId: signingSessionDetails.projectId, - pinLength: Int64(signingSessionDetails.pinLength), - verificationMethod: MVerificationMethod(rawValue: signingSessionDetails.verificationMethod.rawValue) ?? .standardEmail, - verificationURL: signingSessionDetails.verificationURL, - verificationCustomText: signingSessionDetails.verificationCustomText, - identityTypeLabel: signingSessionDetails.identityTypeLabel, - quickCodeEnabled: signingSessionDetails.quickCodeEnabled, - identityType: MIdentityType(rawValue: signingSessionDetails.identityType.rawValue) ?? .email, - sessionId: signingSessionDetails.sessionId, - signingHash: signingSessionDetails.signingHash, - signingDescription: signingSessionDetails.signingDescription, - status: MSigningSessionStatus(rawValue:signingSessionDetails.status.rawValue) ?? .active , - expireTime: Int64((signingSessionDetails.expireTime.timeIntervalSince1970 * 1000.0).rounded()) - ) - completion(Result.success(mSigningSessionDetails)) - } else if let error { - var details = [String: Any]() - - if let signingSessionError = error as? SigningSessionError { - details["exceptionCode"] = signingSessionError.flutterExceptionCodeRepresentation - } - - if case let SigningSessionError.getSigningSessionDetailsFail(signingSessionError) = error, let signingSessionError { - details["error"] = signingSessionError.errorDebugDescription - } - - let pigeonError = self.createPigeonError(error: error, details: details) - completion(Result.failure(pigeonError)); - } - } - } - func getUser( userId: String, completion: @escaping (Result) -> Void diff --git a/lib/src/exceptions.dart b/lib/src/exceptions.dart index eb144e0..e35684d 100644 --- a/lib/src/exceptions.dart +++ b/lib/src/exceptions.dart @@ -213,41 +213,6 @@ class AuthenticationSessionDetailsException implements Exception { AuthenticationSessionDetailsException._create(this.code, this.underlyingError); } -/// An enumeration that describes signing session management issues. -enum SigningSessionDetailsExceptionCode { - /// Could not find the session identifier in the link. - invalidLink, - - /// Could not find the session identifier in the QR code. - invalidQRCode, - - /// The session identifier in `SigningSessionDetails` is empty or blank. - invalidSigningSessionDetails, - - /// Fetching the signing session details failed. - getSigningSessionDetailsFail, - - /// An invalid or expired signing session. - invalidSigningSession, - - /// Signing session completion failed. - completeSigningSessionFail, - - /// The abort of the signing session has failed. - abortSigningSessionFail; -} - -/// An exception thrown when there is an issue with the signing session management. -class SigningSessionDetailsException implements Exception { - /// The specific [SigningSessionDetailsExceptionCode] indicating the type of error. - final SigningSessionDetailsExceptionCode code; - - /// An optional, human-readable message providing more details about the error. - final String? underlyingError; - - SigningSessionDetailsException._create(this.code, this.underlyingError); -} - /// An enumeration that describes signing issues. enum SigningExceptionCode { /// Empty message hash. diff --git a/lib/src/extensions.dart b/lib/src/extensions.dart index b911d5c..31c211d 100644 --- a/lib/src/extensions.dart +++ b/lib/src/extensions.dart @@ -97,29 +97,6 @@ extension on MQuickCode { } } -extension on MSigningSessionDetails { - SigningSessionDetails _toSigningSessionDetails() { - return SigningSessionDetails._create( - userId: userId, - projectName: projectName, - projectLogoURL: projectLogoURL, - projectId: projectId, - pinLength: pinLength, - verificationMethod: VerificationMethod.getVerificationMethod(verificationMethod.name), - verificationURL: verificationURL, - verificationCustomText: verificationCustomText, - identityTypeLabel: identityTypeLabel, - quickCodeEnabled: quickCodeEnabled, - identityType: IdentityType.getIdentityType(identityType.name), - sessionId: sessionId, - signingHash: signingHash, - signingDescription: signingDescription, - status: SigningSessionStatus.getSigningSessionStatus(status.name), - expireTime: expireTime - ); - } -} - extension on MSigningResult { SigningResult _toSigningResult() { final signatureForReturn = Signature._create( @@ -217,18 +194,6 @@ extension on MAuthenticationSessionDetailsExceptionCode { }; } -extension on MSigningSessionDetailsExceptionCode { - SigningSessionDetailsExceptionCode toSigningSessionDetailsExceptionCode() => switch (this) { - MSigningSessionDetailsExceptionCode.invalidLink => SigningSessionDetailsExceptionCode.invalidLink, - MSigningSessionDetailsExceptionCode.invalidQRCode => SigningSessionDetailsExceptionCode.invalidQRCode, - MSigningSessionDetailsExceptionCode.invalidSigningSessionDetails => SigningSessionDetailsExceptionCode.invalidSigningSessionDetails, - MSigningSessionDetailsExceptionCode.getSigningSessionDetailsFail => SigningSessionDetailsExceptionCode.getSigningSessionDetailsFail, - MSigningSessionDetailsExceptionCode.invalidSigningSession => SigningSessionDetailsExceptionCode.invalidSigningSession, - MSigningSessionDetailsExceptionCode.completeSigningSessionFail => SigningSessionDetailsExceptionCode.completeSigningSessionFail, - MSigningSessionDetailsExceptionCode.abortSigningSessionFail => SigningSessionDetailsExceptionCode.abortSigningSessionFail, - }; -} - extension on MSigningExceptionCode { SigningExceptionCode toSigningExceptionCode() => switch (this) { MSigningExceptionCode.emptyMessageHash => SigningExceptionCode.emptyMessageHash, diff --git a/lib/src/miracl_trust.dart b/lib/src/miracl_trust.dart index 5758873..f50f46a 100644 --- a/lib/src/miracl_trust.dart +++ b/lib/src/miracl_trust.dart @@ -498,64 +498,6 @@ class MIRACLTrust { } } - /// Gets [SigningSessionDetails] from the MIRACL Trust platform using a QR code. - /// - /// Use this method to get session details for an application that is signing - /// against the MIRACL Trust Platform via a QR code. - /// - /// Parameters: - /// - [qrCode]: The raw string content read from the QR code. - /// - /// Throws [SigningSessionDetailsException] if fetching the session details - /// fails (e.g., due to an invalid or expired QR code). - Future getSigningSessionDetailsFromQRCode(String qrCode) async { - try { - final mSigningSessionDetails = await _sdk.getSigningDetailsFromQRCode(qrCode); - final signingSessionDetails = mSigningSessionDetails._toSigningSessionDetails(); - - return signingSessionDetails; - } on PlatformException catch(e) { - final exceptionCode = e._getExceptionCode(); - if (exceptionCode is MSigningSessionDetailsExceptionCode) { - throw SigningSessionDetailsException._create( - exceptionCode.toSigningSessionDetailsExceptionCode(), - e.details["error"] - ); - } else { - rethrow; - } - } - } - - /// Gets [SigningSessionDetails] from the MIRACL Trust platform using a deep link. - /// - /// Use this method to get session details for an application that is signing - /// against the MIRACL Trust Platform via a deep link. - /// - /// Parameters: - /// - [link]: A URI received via a deep link. - /// - /// Throws [SigningSessionDetailsException] if fetching the session details - /// fails (e.g., due to an invalid or expired deep link). - Future getSigningSessionDetailsFromLink(Uri link) async { - try { - final mSigningSessionDetails = await _sdk.getSigningSessionDetailsFromLink(link.toString()); - final signingSessionDetails = mSigningSessionDetails._toSigningSessionDetails(); - - return signingSessionDetails; - } on PlatformException catch(e) { - final exceptionCode = e._getExceptionCode(); - if (exceptionCode is MSigningSessionDetailsExceptionCode) { - throw SigningSessionDetailsException._create( - exceptionCode.toSigningSessionDetailsExceptionCode(), - e.details["error"] - ); - } else { - rethrow; - } - } - } - /// Creates a cryptographic signature for a given document hash. /// /// This method requires the user's PIN for authorization and, upon success, diff --git a/lib/src/models.dart b/lib/src/models.dart index 654b4eb..ba845b7 100644 --- a/lib/src/models.dart +++ b/lib/src/models.dart @@ -275,94 +275,4 @@ class SigningResult { required this.signature, required this.timestamp, }); -} - -/// An enumeration describing the status of the signing session. -enum SigningSessionStatus { - /// The session is active. - active, - - /// The session has finished signing the transaction. - signed; - - /// Returns the [SigningSessionStatus] corresponding to the given string [name]. - /// - /// If no method matches the [name], this returns [SigningSessionStatus.active] as a default. - static SigningSessionStatus getSigningSessionStatus(String name) { - return SigningSessionStatus.values.firstWhere( - (e) => e.name == name, - orElse: () => SigningSessionStatus.active, - ); - } -} - -/// An object representing details from an incoming signing session. -class SigningSessionDetails { - /// The User ID entered by the user when the session is started. - final String userId; - - /// The name of the project in the MIRACL Trust platform. - final String projectName; - - /// The URL of the project logo. - final String projectLogoURL; - - /// The Project ID setting for the application in the MIRACL Trust platform. - final String projectId; - - /// The required length (number of digits) for the user's PIN. - final int pinLength; - - /// Indicates the method of user verification. - final VerificationMethod verificationMethod; - - /// The URL for verification in case a custom verification method is used. - final String verificationURL; - - /// The custom text specified in the MIRACL Trust portal, for the - /// custom verification. - final String verificationCustomText; - - /// The label of the identity which will be used for identity verification. - final String identityTypeLabel; - - /// Indicates whether `QuickCode` is enabled for the project. - final bool quickCodeEnabled; - - /// The [IdentityType] which will be used for identity verification. - final IdentityType identityType; - - /// The identifier of the signing session. - final String sessionId; - - /// The hash of the transaction that needs to be signed. - final String signingHash; - - /// The description of the transaction that needs to be signed. - final String signingDescription; - - /// The current [SigningSessionStatus] of the session (e.g., active, signed). - final SigningSessionStatus status; - - /// The date indicating if the session has expired. - final int expireTime; - - SigningSessionDetails._create({ - required this.userId, - required this.projectName, - required this.projectLogoURL, - required this.projectId, - required this.pinLength, - required this.verificationMethod, - required this.verificationURL, - required this.verificationCustomText, - required this.identityTypeLabel, - required this.quickCodeEnabled, - required this.identityType, - required this.sessionId, - required this.signingHash, - required this.signingDescription, - required this.status, - required this.expireTime, - }); } \ No newline at end of file diff --git a/lib/src/pigeon.dart b/lib/src/pigeon.dart index e7336c0..63ebc4c 100644 --- a/lib/src/pigeon.dart +++ b/lib/src/pigeon.dart @@ -54,11 +54,6 @@ enum MIdentityType { alphanumeric, } -enum MSigningSessionStatus { - active, - signed, -} - enum MConfigurationExceptionCode { emptyProjectId, invalidProjectUrl, @@ -121,16 +116,6 @@ enum MAuthenticationSessionDetailsExceptionCode { abortSessionFail, } -enum MSigningSessionDetailsExceptionCode { - invalidLink, - invalidQRCode, - invalidSigningSessionDetails, - getSigningSessionDetailsFail, - invalidSigningSession, - completeSigningSessionFail, - abortSigningSessionFail, -} - enum MSigningExceptionCode { emptyMessageHash, emptyPublicKey, @@ -347,122 +332,6 @@ class MAuthenticationSessionDetails { ; } -class MSigningSessionDetails { - MSigningSessionDetails({ - required this.userId, - required this.projectName, - required this.projectLogoURL, - required this.projectId, - required this.pinLength, - required this.verificationMethod, - required this.verificationURL, - required this.verificationCustomText, - required this.identityTypeLabel, - required this.quickCodeEnabled, - required this.identityType, - required this.sessionId, - required this.signingHash, - required this.signingDescription, - required this.status, - required this.expireTime, - }); - - String userId; - - String projectName; - - String projectLogoURL; - - String projectId; - - int pinLength; - - MVerificationMethod verificationMethod; - - String verificationURL; - - String verificationCustomText; - - String identityTypeLabel; - - bool quickCodeEnabled; - - MIdentityType identityType; - - String sessionId; - - String signingHash; - - String signingDescription; - - MSigningSessionStatus status; - - int expireTime; - - List _toList() { - return [ - userId, - projectName, - projectLogoURL, - projectId, - pinLength, - verificationMethod, - verificationURL, - verificationCustomText, - identityTypeLabel, - quickCodeEnabled, - identityType, - sessionId, - signingHash, - signingDescription, - status, - expireTime, - ]; - } - - Object encode() { - return _toList(); } - - static MSigningSessionDetails decode(Object result) { - result as List; - return MSigningSessionDetails( - userId: result[0]! as String, - projectName: result[1]! as String, - projectLogoURL: result[2]! as String, - projectId: result[3]! as String, - pinLength: result[4]! as int, - verificationMethod: result[5]! as MVerificationMethod, - verificationURL: result[6]! as String, - verificationCustomText: result[7]! as String, - identityTypeLabel: result[8]! as String, - quickCodeEnabled: result[9]! as bool, - identityType: result[10]! as MIdentityType, - sessionId: result[11]! as String, - signingHash: result[12]! as String, - signingDescription: result[13]! as String, - status: result[14]! as MSigningSessionStatus, - expireTime: result[15]! as int, - ); - } - - @override - // ignore: avoid_equals_and_hash_code_on_mutable_classes - bool operator ==(Object other) { - if (other is! MSigningSessionDetails || other.runtimeType != runtimeType) { - return false; - } - if (identical(this, other)) { - return true; - } - return _deepEquals(encode(), other.encode()); - } - - @override - // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()) -; -} - class MUser { MUser({ required this.projectId, @@ -801,65 +670,56 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is MIdentityType) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is MSigningSessionStatus) { - buffer.putUint8(132); - writeValue(buffer, value.index); } else if (value is MConfigurationExceptionCode) { - buffer.putUint8(133); + buffer.putUint8(132); writeValue(buffer, value.index); } else if (value is MEmailVerificationExceptionCode) { - buffer.putUint8(134); + buffer.putUint8(133); writeValue(buffer, value.index); } else if (value is MActivationTokenExceptionCode) { - buffer.putUint8(135); + buffer.putUint8(134); writeValue(buffer, value.index); } else if (value is MRegistrationExceptionCode) { - buffer.putUint8(136); + buffer.putUint8(135); writeValue(buffer, value.index); } else if (value is MAuthenticationExceptionCode) { - buffer.putUint8(137); + buffer.putUint8(136); writeValue(buffer, value.index); } else if (value is MQuickCodeExceptionCode) { - buffer.putUint8(138); + buffer.putUint8(137); writeValue(buffer, value.index); } else if (value is MAuthenticationSessionDetailsExceptionCode) { - buffer.putUint8(139); - writeValue(buffer, value.index); - } else if (value is MSigningSessionDetailsExceptionCode) { - buffer.putUint8(140); + buffer.putUint8(138); writeValue(buffer, value.index); } else if (value is MSigningExceptionCode) { - buffer.putUint8(141); + buffer.putUint8(139); writeValue(buffer, value.index); } else if (value is MConfiguration) { - buffer.putUint8(142); + buffer.putUint8(140); writeValue(buffer, value.encode()); } else if (value is MActivationTokenResponse) { - buffer.putUint8(143); + buffer.putUint8(141); writeValue(buffer, value.encode()); } else if (value is MAuthenticationSessionDetails) { - buffer.putUint8(144); - writeValue(buffer, value.encode()); - } else if (value is MSigningSessionDetails) { - buffer.putUint8(145); + buffer.putUint8(142); writeValue(buffer, value.encode()); } else if (value is MUser) { - buffer.putUint8(146); + buffer.putUint8(143); writeValue(buffer, value.encode()); } else if (value is MQuickCode) { - buffer.putUint8(147); + buffer.putUint8(144); writeValue(buffer, value.encode()); } else if (value is MSignature) { - buffer.putUint8(148); + buffer.putUint8(145); writeValue(buffer, value.encode()); } else if (value is MSigningResult) { - buffer.putUint8(149); + buffer.putUint8(146); writeValue(buffer, value.encode()); } else if (value is MActivationTokenErrorResponse) { - buffer.putUint8(150); + buffer.putUint8(147); writeValue(buffer, value.encode()); } else if (value is MEmailVerificationResponse) { - buffer.putUint8(151); + buffer.putUint8(148); writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); @@ -879,54 +739,46 @@ class _PigeonCodec extends StandardMessageCodec { final int? value = readValue(buffer) as int?; return value == null ? null : MIdentityType.values[value]; case 132: - final int? value = readValue(buffer) as int?; - return value == null ? null : MSigningSessionStatus.values[value]; - case 133: final int? value = readValue(buffer) as int?; return value == null ? null : MConfigurationExceptionCode.values[value]; - case 134: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : MEmailVerificationExceptionCode.values[value]; - case 135: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : MActivationTokenExceptionCode.values[value]; - case 136: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : MRegistrationExceptionCode.values[value]; - case 137: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : MAuthenticationExceptionCode.values[value]; - case 138: + case 137: final int? value = readValue(buffer) as int?; return value == null ? null : MQuickCodeExceptionCode.values[value]; - case 139: + case 138: final int? value = readValue(buffer) as int?; return value == null ? null : MAuthenticationSessionDetailsExceptionCode.values[value]; - case 140: - final int? value = readValue(buffer) as int?; - return value == null ? null : MSigningSessionDetailsExceptionCode.values[value]; - case 141: + case 139: final int? value = readValue(buffer) as int?; return value == null ? null : MSigningExceptionCode.values[value]; - case 142: + case 140: return MConfiguration.decode(readValue(buffer)!); - case 143: + case 141: return MActivationTokenResponse.decode(readValue(buffer)!); - case 144: + case 142: return MAuthenticationSessionDetails.decode(readValue(buffer)!); - case 145: - return MSigningSessionDetails.decode(readValue(buffer)!); - case 146: + case 143: return MUser.decode(readValue(buffer)!); - case 147: + case 144: return MQuickCode.decode(readValue(buffer)!); - case 148: + case 145: return MSignature.decode(readValue(buffer)!); - case 149: + case 146: return MSigningResult.decode(readValue(buffer)!); - case 150: + case 147: return MActivationTokenErrorResponse.decode(readValue(buffer)!); - case 151: + case 148: return MEmailVerificationResponse.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1453,62 +1305,6 @@ class MiraclSdk { return (pigeonVar_replyList[0] as MAuthenticationSessionDetails?)!; } } - - Future getSigningDetailsFromQRCode(String qrCode) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.flutter_miracl_sdk.MiraclSdk.getSigningDetailsFromQRCode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([qrCode]); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as MSigningSessionDetails?)!; - } - } - - Future getSigningSessionDetailsFromLink(String link) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.flutter_miracl_sdk.MiraclSdk.getSigningSessionDetailsFromLink$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([link]); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as MSigningSessionDetails?)!; - } - } } abstract class MLogger { diff --git a/pigeon/sdk_types.dart b/pigeon/sdk_types.dart index c52233a..621fc96 100644 --- a/pigeon/sdk_types.dart +++ b/pigeon/sdk_types.dart @@ -41,11 +41,6 @@ enum MIdentityType { alphanumeric } -enum MSigningSessionStatus { - active, - signed -} - class MAuthenticationSessionDetails { final String userId; final String projectName; @@ -76,44 +71,6 @@ class MAuthenticationSessionDetails { ); } -class MSigningSessionDetails { - final String userId; - final String projectName; - final String projectLogoURL; - final String projectId; - final int pinLength; - final MVerificationMethod verificationMethod; - final String verificationURL; - final String verificationCustomText; - final String identityTypeLabel; - final bool quickCodeEnabled; - final MIdentityType identityType; - final String sessionId; - final String signingHash; - final String signingDescription; - final MSigningSessionStatus status; - final int expireTime; - - MSigningSessionDetails( - this.userId, - this.projectName, - this.projectLogoURL, - this.projectId, - this.pinLength, - this.verificationMethod, - this.verificationURL, - this.verificationCustomText, - this.identityTypeLabel, - this.quickCodeEnabled, - this.identityType, - this.sessionId, - this.signingHash, - this.signingDescription, - this.status, - this.expireTime - ); -} - class MUser { final String projectId; final bool revoked; @@ -233,16 +190,6 @@ enum MAuthenticationSessionDetailsExceptionCode { abortSessionFail; } -enum MSigningSessionDetailsExceptionCode { - invalidLink, - invalidQRCode, - invalidSigningSessionDetails, - getSigningSessionDetailsFail, - invalidSigningSession, - completeSigningSessionFail, - abortSigningSessionFail; -} - enum MSigningExceptionCode { emptyMessageHash, emptyPublicKey, @@ -331,16 +278,6 @@ abstract class MiraclSdk { MAuthenticationSessionDetails getAuthenticationSessionDetailsFromPushNofitifactionPayload( Map payload ); - - @async - MSigningSessionDetails getSigningDetailsFromQRCode( - String qrCode - ); - - @async - MSigningSessionDetails getSigningSessionDetailsFromLink( - String link - ); } @FlutterApi()