Unable to get public address in iOS

Issue

Hey Devs,

I am unable to get private key and public address in Flutter for iOS.

When trying to get key using SingleFactorAuthFlutterPlugin.getKey() we are getting both privateKey and publicAddress in Android, but not getting anything in iOS. Nothing, no return no exception.

Could you please guide me on how to resolve this?


Additional context

  • SDK Version: single_factor_auth_flutter 1.0.0
  • Platform: macOS

Flutter doctor

Click To Expand
[!] Flutter (Channel stable, 3.13.9, on macOS 13.3.1 22E261 darwin-arm64, locale en-IN)
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.1.3/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/cumulations/fvm/versions/3.13.9. Consider adding /Users/cumulations/fvm/versions/3.13.9/bin to the front of your path.
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.85.0)
Unknown architecture undefined_arch, defaulting to arm64
[✓] Connected device (1 available)
[✓] Network resources

I’m facing a similar issue with Swift. I can get the user’s private key, but I only want their public address.

Seems like its the inverse of what it should be, far from what I would want as a user to have the private key so accessible and the address nowhere to be found lol.

1 Like

@samyak.b Thanks for your patience.

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

@samyak.b Have you tried running example attached with flutter sdk? It absoutely working fine.
Pls try running once at your end. Also web3Auth PnP sdk’s only provides user private key and userInfo() after successful login not the public address.

@huntertdiamond Web3Auth PnP sdk’s only provides user’s private key and userInfo() after successful login not the public address. Pls go through documentation once (Web3Auth PnP Flutter SDK | Documentation | Web3Auth). Also you can derive public address from private key.

Most of the documentation is simply incorrect.

For example:
In Session Management the W3ALoginParams object doesn’t accept a sessionTime Param.

The docs displays this object

public struct W3ALoginParams: Codable {
    public init() {
        loginProvider = nil
        dappShare = nil
        extraLoginOptions = nil
        redirectUrl = nil
        appState = nil
        mfaLevel = nil
        sessionTime = 86400
        curve = .SECP256K1
    }

    let loginProvider: String?
    var dappShare: String?
    let extraLoginOptions: ExtraLoginOptions?
    let redirectUrl: String?
    let appState: String?
    let mfaLevel: MFALevel?
    let sessionTime: Int
    let curve: SUPPORTED_KEY_CURVES
}

but simply looking into the source code you’ll see the only way to set the sessionTime value is by using W3AInitParams

I have no problem having to dig in deeper to be able to use the SDK, but some egregious inaccuracies need correcting within the documentation

sessionTime is in W3AInitParams in order to use.

Hey @gaurav,

I have tried the example mentioned in your documentations. The thing is that example is using web3auth_flutter whereas I want to use single_factor_auth_flutter.

When using the Flutter SFA SDK, I am unable to get any response from SingleFactorAuthFlutterPlugin.getKey() in iOS.

Also web3Auth PnP sdk’s only provides user private key and userInfo() after successful login not the public address.

When building the Flutter SFA for Android, and calling SingleFactorAuthFlutterPlugin.getKey(), I am getting a JSON Object having both private key and public address, like this:

{
    "privateKey": <privateKey>,
    "publicAddress": <publicAddress>
}

Hey @samyak.b, you can try this example: https://github.com/Web3Auth/single-factor-auth-flutter/tree/master/example

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.