Diffrent private key for same account

When asking for help in this category, please make sure to provide the following details:

  • SDK Version:1.0.0
  • Platform: fluttre
  • Browser Console Screenshots:
  • If the issue is related to Custom Authentication, please include the following information (optional):
    • Verifier Name: “googel_provider”
    • JWKS Endpoint:
    • Sample idToken (JWT):eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImhjZTFyMGZtQklGOTdfUXB2anZ5ZSJ9.eyJnaXZlbl9uYW1lIjoiR2VldGhhIiwiZmFtaWx5X25hbWUiOiJDaG91ZGhhcmkiLCJuaWNrbmFtZSI6ImNob3VkaGFyaWdlZXRoYSIsIm5hbWUiOiJHZWV0aGEgQ2hvdWRoYXJpIiwicGljdHVyZSI6Imh0dHBzOi8vbGgzLmdvb2dsZXVzZXJjb250ZW50LmNvbS9hL0FDZzhvY0xIemVxcEgxNHlXS0F5QmwxMjdJa1RsODUtWllDNWR5RktDeG9vZm9waj1zOTYtYyIsImxvY2FsZSI6ImVuLUdCIiwidXBkYXRlZF9hdCI6IjIwMjMtMTEtMTZUMDg6NDE6MTMuMDgwWiIsImVtYWlsIjoiY2hvdWRoYXJpZ2VldGhhQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJpc3MiOiJodHRwczovL2Rldi0ydGZkZDdkemoxM2liZmVsLnVzLmF1dGgwLmNvbS8iLCJhdWQiOiJpTklaRlB2NTlZWFdFaEhUU1BrYXdJZnoxa2FrTXFzZiIsImlhdCI6MTcwMDEyNDA4OSwiZXhwIjoxNzAwMTYwMDg5LCJzdWIiOiJnb29nbGUtb2F1dGgyfDExMzk3MjUyNjkwNTk2Mzg3NTY4MSIsInNpZCI6ImVXWlI5MlM4UEhfSmxNLVpiaTU3MFdlak9zbktuajNzIn0.OZ1XDRG-tXw37GEXOfn60fi8N95Bdj60FtOOnVkA5uJXSAwQ0kEGpkykRDL2afndSn-lN8NSjTyBKyupIxw9OoKLvgLfdKaBR0LytV6xMidoZCK2C5v2WUajChkYawCAAzMSepirmswAfJwYMj08i-zWDty3M49DeKfwoaA1YFG3AQDiFGHD0bwsSKn-TF
class Auth0WalletHandler extends WalletHandlerInterface {
  final _SingleFactorAuthFlutterPlugin = SingleFactAuthFlutter();
  final _verifier = "googel_provider";

  Credentials? get credentials => AppDependency.instance.getItInstance
      .get<AuthHandlerInterface>()
      .credentials;

  @override
  Future<void> initSdk() async {
    if (Platform.isAndroid) {
      _init().then((value) => _initialize());
    } else if (Platform.isIOS) {
      _init();
      _initialize();
    } else {}
  }

  Future<void> _init() async {
    await _SingleFactorAuthFlutterPlugin.init(
        Web3AuthNetwork(network: TorusNetwork.testnet));
  }

  Future<void> _initialize() async {
     await _SingleFactorAuthFlutterPlugin.initialize();//privateKey =
  }

  @override
  Future<String> getPrivateKey() async {
    if (privateKey != null && privateKey!.isNotEmpty) return privateKey!;
    try {
      await Auth0.refreshAuthSession();
      privateKey = await _SingleFactorAuthFlutterPlugin.getKey(LoginParams(
          verifier: _verifier,
          verifierId: credentials?.user.sub??"",
          idToken: credentials?.idToken??""));
      Logger.log(_tag, "privateKey $privateKey");
      return privateKey!;
    } on UserCancelledException {
      Logger.log(_tag, "User cancelled.");
    } catch (exception) {
      Logger.log(_tag, "Unknown exception occurred:$exception");
    }
    return "";
  }
}

Here, to authenticate I used auth0 and after that, getting private key useing SingleFactAuthFlutter library as

{“privateKey”:9671347944998855650472…09484196075390732661251988928411312880973876490,“publicAddress”:“0x20d7A20c9AE82…Db6AB4228045B3B797cea”}

But When i used web3auth_flutter i was receiveing diffrent prvate key as

21f79799a14b79bd2798da5e2155d42…d237db777bf833516199d

Why is this. My understanding, we shoud receive same private key in both way

@shridhar.c Thanks for your recent post.

Your issue has been forwarded to our Dev team and we will get back with further updates.

1 Like

Hello @shridhar.c , thanks for asking question.
First, in your case it’s migration from the pnp sdk to sfa sdk.
it’s possible to get same private key using both sdk, by setting usepnpkey to true.
check out the following documentation.

But one thing here is that for mobile sdk like sfa ios, flutter, android,
we don’t have such option for that, since it’s quite new SDK.

Adding usePnpKey is in our pipeline and we will release soon.
Thanks.

Thanks, Please notify here when this feature is released