Skip to content

Commit

Permalink
feat: update single-factor-auth-android
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Goel <[email protected]>
  • Loading branch information
grvgoel81 authored and Gaurav Goel committed Sep 19, 2024
1 parent 996b2ef commit 8b2285d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ android {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
implementation 'com.github.Web3Auth:single-factor-auth-android:1.0.0'
implementation 'com.github.grvgoel81:single-factor-auth-android:9.0.0'
implementation 'org.torusresearch:fetch-node-details-java:5.0.0'
implementation 'com.google.code.gson:gson:2.9.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class SingleFactorAuthFlutterPlugin : FlutterPlugin, MethodCallHandler {
try {
val sfaKey = singleFactorAuth.initialize(context)
Log.d("${SingleFactorAuthFlutterPlugin::class.qualifiedName}", "#initialize")
return if (sfaKey != null) {
prepareResultFromSFAkey(sfaKey)
return if (sfaKey.get() != null) {
prepareResultFromSFAkey(sfaKey.get())
} else {
""
}
Expand Down Expand Up @@ -127,7 +127,16 @@ class SingleFactorAuthFlutterPlugin : FlutterPlugin, MethodCallHandler {
}

"isSessionIdExists" -> {
return singleFactorAuth.isSessionIdExists()
try {
val result = singleFactorAuth.isSessionIdExists()
Log.d(
"${SingleFactorAuthFlutterPlugin::class.qualifiedName}",
"#isSessionIdExists"
)
return result
} catch (e: Throwable) {
throw Error(e)
}
}
}
throw NotImplementedError()
Expand Down
7 changes: 4 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ class _MyAppState extends State<MyApp> {
height: 20,
),
const Text(
'Get Web3AuthKey',
'Get SFAKey',
style: TextStyle(fontSize: 12),
),
const SizedBox(
height: 20,
),
ElevatedButton(
onPressed: _getKey(getKey),
child: const Text('Web3AuthKey'),
child: const Text('Get SFAKey'),
),
ElevatedButton(
onPressed: () => _initialize(),
Expand Down Expand Up @@ -163,7 +163,8 @@ class _MyAppState extends State<MyApp> {
final SFAKey? response =
await _singleFactorAuthFlutterPlugin.initialize();
setState(() {
_result = "Private Key : ${response?.privateKey}";
_result =
"Public Add : ${response?.publicAddress} , Private Key : ${response?.privateKey}";
log(response!.publicAddress);
});
} on PrivateKeyNotGeneratedException {
Expand Down

0 comments on commit 8b2285d

Please sign in to comment.