Skip to content

Commit 9e4a41a

Browse files
committed
Change platformURL to projectURL
1 parent 8c81554 commit 9e4a41a

File tree

54 files changed

+24728
-11974
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+24728
-11974
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,29 @@ import 'package:flutter_miracl_sdk/flutter_miracl_sdk.dart';
4343

4444
To configure the plugin:
4545

46-
1. Create an application in the MIRACL Trust platform. For information about how
46+
1. Create an account in the MIRACL Trust platform. For information about how
4747
to do it, see the
4848
[Getting Started](https://miracl.com/resources/docs/guides/get-started/)
4949
guide.
50-
2. Call the `initialize` method with a configuration created by the
51-
`Configuration` class:
50+
2. Call the
51+
[initialize](https://pub.dev/documentation/flutter_miracl_sdk/latest/flutter_miracl_sdk/MIRACLTrust/initialize.html)
52+
method with a configuration created by the
53+
[Configuration](https://pub.dev/documentation/flutter_miracl_sdk/latest/flutter_miracl_sdk/Configuration-class.html)
54+
class using
55+
[your project properties](https://miracl.com/resources/docs/get-started/create-project/#project-properties):
5256

5357
```dart
5458
final configuration = Configuration(
55-
projectId: "YOUR_PROJECT_ID"
59+
projectId: "Project Id",
60+
projectUrl: "Project Domain"
5661
);
5762
5863
await MIRACLTrust.initialize(configuration);
5964
```
6065

61-
Call the `initialize` method as early as possible in the application
66+
Call the
67+
[initialize](https://pub.dev/documentation/flutter_miracl_sdk/latest/flutter_miracl_sdk/MIRACLTrust/initialize.html)
68+
method as early as possible in the application
6269
lifecycle, and avoid creating instance before that; otherwise,
6370
an assertion will be triggered.
6471

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ android {
3636
}
3737

3838
dependencies {
39-
implementation "com.miracl:trust-sdk-android:1.4.0"
39+
implementation "com.miracl:trust-sdk-android:1.6.0"
4040
}
4141
}

android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/Extensions.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import com.miracl.trust.signing.SigningException
1313
internal val ConfigurationException.flutterExceptionCodeRepresentation: MConfigurationExceptionCode
1414
get() = when (this) {
1515
ConfigurationException.EmptyProjectId -> MConfigurationExceptionCode.EMPTY_PROJECT_ID
16+
ConfigurationException.InvalidProjectUrl -> MConfigurationExceptionCode.INVALID_PROJECT_URL
1617
}
1718

1819
internal val VerificationException.flutterExceptionCodeRepresentation: MEmailVerificationExceptionCode
@@ -56,6 +57,7 @@ internal val AuthenticationException.flutterExceptionCodeRepresentation: MAuthen
5657
AuthenticationException.Revoked -> MAuthenticationExceptionCode.REVOKED
5758
AuthenticationException.UnsuccessfulAuthentication -> MAuthenticationExceptionCode.UNSUCCESSFUL_AUTHENTICATION
5859
AuthenticationException.UserNotFound -> MAuthenticationExceptionCode.USER_NOT_FOUND
60+
AuthenticationException.InvalidCrossDeviceSession -> MAuthenticationExceptionCode.INVALID_CROSS_DEVICE_SESSION
5961
}
6062

6163
internal val QuickCodeException.flutterExceptionCodeRepresentation: MQuickCodeExceptionCode

android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/FlutterMiraclSdkPlugin.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ class FlutterMiraclSdkPlugin : FlutterPlugin, MiraclSdk {
4444
sdkHandler.initSdk(configuration, mLogger, context, callback)
4545
}
4646

47-
override fun setProjectId(
47+
override fun updateProjectSettings(
4848
projectId: String,
49+
projectUrl: String,
4950
callback: (kotlin.Result<Unit>) -> Unit
5051
) {
51-
sdkHandler.setProjectId(projectId, callback)
52+
sdkHandler.updateProjectSettings(projectId, projectUrl, callback)
5253
}
5354

5455
override fun sendVerificationEmail(

android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/Pigeon.kt

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ enum class MSigningSessionStatus(val raw: Int) {
126126
}
127127

128128
enum class MConfigurationExceptionCode(val raw: Int) {
129-
EMPTY_PROJECT_ID(0);
129+
EMPTY_PROJECT_ID(0),
130+
INVALID_PROJECT_URL(1);
130131

131132
companion object {
132133
fun ofRaw(raw: Int): MConfigurationExceptionCode? {
@@ -189,7 +190,8 @@ enum class MAuthenticationExceptionCode(val raw: Int) {
189190
INVALID_AUTHENTICATION_SESSION(7),
190191
UNSUCCESSFUL_AUTHENTICATION(8),
191192
PIN_CANCELLED(9),
192-
INVALID_PIN(10);
193+
INVALID_PIN(10),
194+
INVALID_CROSS_DEVICE_SESSION(11);
193195

194196
companion object {
195197
fun ofRaw(raw: Int): MAuthenticationExceptionCode? {
@@ -266,23 +268,23 @@ enum class MSigningExceptionCode(val raw: Int) {
266268
/** Generated class from Pigeon that represents data sent in messages. */
267269
data class MConfiguration (
268270
val projectId: String,
269-
val applicationInfo: String,
270-
val platformUrl: String? = null
271+
val platformUrl: String,
272+
val applicationInfo: String
271273
)
272274
{
273275
companion object {
274276
fun fromList(pigeonVar_list: List<Any?>): MConfiguration {
275277
val projectId = pigeonVar_list[0] as String
276-
val applicationInfo = pigeonVar_list[1] as String
277-
val platformUrl = pigeonVar_list[2] as String?
278-
return MConfiguration(projectId, applicationInfo, platformUrl)
278+
val platformUrl = pigeonVar_list[1] as String
279+
val applicationInfo = pigeonVar_list[2] as String
280+
return MConfiguration(projectId, platformUrl, applicationInfo)
279281
}
280282
}
281283
fun toList(): List<Any?> {
282284
return listOf(
283285
projectId,
284-
applicationInfo,
285286
platformUrl,
287+
applicationInfo,
286288
)
287289
}
288290
override fun equals(other: Any?): Boolean {
@@ -910,7 +912,7 @@ private open class PigeonPigeonCodec : StandardMessageCodec() {
910912
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
911913
interface MiraclSdk {
912914
fun initSdk(configuration: MConfiguration, callback: (Result<Unit>) -> Unit)
913-
fun setProjectId(projectId: String, callback: (Result<Unit>) -> Unit)
915+
fun updateProjectSettings(projectId: String, projectUrl: String, callback: (Result<Unit>) -> Unit)
914916
fun sendVerificationEmail(userId: String, callback: (Result<MEmailVerificationResponse>) -> Unit)
915917
fun getActivationTokenByURI(uri: String, callback: (Result<MActivationTokenResponse>) -> Unit)
916918
fun getActivationTokenByUserIdAndCode(userId: String, code: String, callback: (Result<MActivationTokenResponse>) -> Unit)
@@ -959,12 +961,13 @@ interface MiraclSdk {
959961
}
960962
}
961963
run {
962-
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.flutter_miracl_sdk.MiraclSdk.setProjectId$separatedMessageChannelSuffix", codec)
964+
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.flutter_miracl_sdk.MiraclSdk.updateProjectSettings$separatedMessageChannelSuffix", codec)
963965
if (api != null) {
964966
channel.setMessageHandler { message, reply ->
965967
val args = message as List<Any?>
966968
val projectIdArg = args[0] as String
967-
api.setProjectId(projectIdArg) { result: Result<Unit> ->
969+
val projectUrlArg = args[1] as String
970+
api.updateProjectSettings(projectIdArg, projectUrlArg) { result: Result<Unit> ->
968971
val error = result.exceptionOrNull()
969972
if (error != null) {
970973
reply.reply(PigeonPigeonUtils.wrapError(error))

android/src/main/kotlin/com/miracl/trust/flutter_miracl_sdk/SdkHandler.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@ class SdkHandler {
3232
) {
3333
try {
3434
val configurationBuilder = Configuration
35-
.Builder(config.projectId)
36-
.applicationInfo(config.applicationInfo)
35+
.Builder(
36+
config.projectId,
37+
config.platformUrl
38+
).applicationInfo(config.applicationInfo)
3739
.logger(FlutterLogger(mLogger))
38-
39-
if (config.platformUrl != null) {
40-
configurationBuilder.platformUrl(config.platformUrl)
41-
}
4240

4341
val configuration = configurationBuilder.build()
4442

@@ -56,9 +54,13 @@ class SdkHandler {
5654
}
5755
}
5856

59-
fun setProjectId(projectId: String, callback: (Result<Unit>) -> Unit) {
57+
fun updateProjectSettings(
58+
projectId: String,
59+
projectUrl: String,
60+
callback: (Result<Unit>) -> Unit
61+
) {
6062
try {
61-
MIRACLTrust.getInstance().setProjectId(projectId)
63+
MIRACLTrust.getInstance().updateProjectSettings(projectId, projectUrl)
6264
callback(Result.success(Unit))
6365
} catch (exception: ConfigurationException) {
6466
val details = mutableMapOf<String, Any?>()

example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ void main() async {
88

99
final configuration = Configuration(
1010
projectId: "<YOUR_PROJECT_ID>",
11-
platformUrl: "<YOUR_DOMAIN>"
11+
projectURL: "<YOUR_DOMAIN>"
1212
);
1313
await MIRACLTrust.initialize(configuration);
1414

example/pubspec.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ packages:
55
dependency: transitive
66
description:
77
name: async
8-
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
8+
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "2.13.0"
11+
version: "2.12.0"
1212
boolean_selector:
1313
dependency: transitive
1414
description:
@@ -53,10 +53,10 @@ packages:
5353
dependency: transitive
5454
description:
5555
name: fake_async
56-
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
56+
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
5757
url: "https://pub.dev"
5858
source: hosted
59-
version: "1.3.3"
59+
version: "1.3.2"
6060
flutter:
6161
dependency: "direct main"
6262
description: flutter
@@ -99,10 +99,10 @@ packages:
9999
dependency: transitive
100100
description:
101101
name: leak_tracker
102-
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
102+
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
103103
url: "https://pub.dev"
104104
source: hosted
105-
version: "10.0.9"
105+
version: "10.0.8"
106106
leak_tracker_flutter_testing:
107107
dependency: transitive
108108
description:
@@ -256,10 +256,10 @@ packages:
256256
dependency: transitive
257257
description:
258258
name: vm_service
259-
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
259+
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
260260
url: "https://pub.dev"
261261
source: hosted
262-
version: "15.0.0"
262+
version: "14.3.1"
263263
sdks:
264264
dart: ">=3.7.0-0 <4.0.0"
265265
flutter: ">=3.27.0"

0 commit comments

Comments
 (0)