-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactored sdk and updated example as per web and swift
Signed-off-by: Gaurav Goel <[email protected]>
- Loading branch information
Showing
16 changed files
with
272 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,15 +6,15 @@ import android.widget.TextView | |
import androidx.appcompat.app.AppCompatActivity | ||
import com.web3auth.singlefactorauth.SingleFactorAuth | ||
import com.web3auth.singlefactorauth.types.LoginParams | ||
import com.web3auth.singlefactorauth.types.SFAParams | ||
import com.web3auth.singlefactorauth.types.Web3AuthOptions | ||
import org.torusresearch.fetchnodedetails.types.Web3AuthNetwork | ||
|
||
class MainActivity : AppCompatActivity() { | ||
|
||
private lateinit var btnTorusKey: Button | ||
private lateinit var tv: TextView | ||
lateinit var singleFactorAuth: SingleFactorAuth | ||
private lateinit var sfaParams: SFAParams | ||
private lateinit var web3AuthOptions: Web3AuthOptions | ||
lateinit var loginParams: LoginParams | ||
var TEST_VERIFIER = "torus-test-health" | ||
var TORUS_TEST_EMAIL = "[email protected]" | ||
|
@@ -30,16 +30,16 @@ class MainActivity : AppCompatActivity() { | |
getSFAKey() | ||
} | ||
val idToken = JwtUtils.generateIdToken(TORUS_TEST_EMAIL) | ||
sfaParams = | ||
SFAParams(Web3AuthNetwork.SAPPHIRE_MAINNET, "YOUR_CLIENT_ID", 86400, null, 0) | ||
singleFactorAuth = SingleFactorAuth(sfaParams, this) | ||
web3AuthOptions = | ||
Web3AuthOptions("YOUR_CLIENT_ID", Web3AuthNetwork.SAPPHIRE_MAINNET, 86400) | ||
singleFactorAuth = SingleFactorAuth(web3AuthOptions, this) | ||
loginParams = LoginParams(TEST_VERIFIER, TORUS_TEST_EMAIL, idToken) | ||
|
||
val sfakey = singleFactorAuth.initialize(this.applicationContext) | ||
sfakey.whenComplete { response, error -> | ||
if (error == null) { | ||
val text = | ||
"Public Address: ${response.getPublicAddress()} , Private Key: ${response.getPrivateKey()}" | ||
"Public Address: ${response.publicAddress} , Private Key: ${response.privateKey}" | ||
tv.text = text | ||
} else { | ||
tv.text = error.message | ||
|
@@ -55,7 +55,7 @@ class MainActivity : AppCompatActivity() { | |
singleFactorAuth.connect(loginParams, this.applicationContext) | ||
if (sfakey != null) { | ||
val text = | ||
"Public Address: ${sfakey.getPublicAddress()} , Private Key: ${sfakey.getPrivateKey()}" | ||
"Public Address: ${sfakey.publicAddress} , Private Key: ${sfakey.privateKey}" | ||
tv.text = text | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.