I am using "@toruslabs/customauth-react-native-sdk" version 4.0.1 for getting toruskey but having issue in ios [Error: getTorusKey: ] in android it is working fine

in code I did

const web3auth = new Web3Auth({
clientId: clientId,
web3AuthNetwork: EnvironmentVariables.BASE_ENV.torusNetwork,
usePnPKey: false, // By default, this sdk returns CoreKitKey
});

const privateKeyProvider = new EthereumPrivateKeyProvider({
config: {
/*
pass the chain config that you want to connect with
all chainConfig fields are required.
*/
chainConfig: {
chainId: ‘0x1’,
rpcTarget: ‘https://rpc.ankr.com/eth’,
displayName: ‘mainnet’,
blockExplorer: ‘https://etherscan.io/’,
ticker: ‘ETH’,
tickerName: ‘Ethereum’,
},
},
});

try {
web3auth.init({ provider: privateKeyProvider });
} catch (error) {
uiConsole(error, ‘mounted caught’);
}

const OAuthShareProvider = await web3auth.connect({
verifier: EnvironmentVariables.BASE_ENV.torusKey, // e.g. web3auth-sfa-verifier replace with your verifier name, and it has to be on the same network passed in init().
verifierId: data_obj.email, // e.g. Yux1873xnibdui or name@email.com replace with your verifier id(sub or email)'s value.
idToken: data_obj.torus_token,
});
const OAuthShareKey = await OAuthShareProvider.request({
method: ‘eth_private_key’,
});

Blockquote

Hello @yashovardhan understand that the release for the new sdk has not happened as yet. Do let us know the best situation as and when you have an update.

Appreciate if you could update us on the release status for the new package. and if it fixes the current issue we are facing with IOS App

hello @yashovardhan! it is about 2 weeks we are unable to use it in production.
is the new sdk launch?

hello @yashovardhan @vjgee we haven’t had further updates on this topic. Could you please let us know if the new package was released or going to take some more time? Also are we the only ones in a similar situation with all others using the node-SDK instead?

Please expect everything to be ready for your use by the end of the day. There were multiple moving parts which were added recently to make sure you don’t encounter the errors you were facing earlier, even with Single Factor Auth React Native.

Just an update, things are progressing in this PR: Tkey update for sfa service provider by yashovardhan · Pull Request #165 · Web3Auth/web3auth-core-kit-examples · GitHub

You can refer to the react native examples. They are ready to go. There have been major changes since we had to introduce a new service provider for SFA SDKs, to make sure there are no more errors that you all face.

Thank You Yash, this is good and will get this implemented and tested to confirm the fix we wanted.

hi @yashovardhan !

previously we ware using :

> Blockquote

now I found this in documentation.:

can I use it instead of older one?

hi @yashovardhan !

I tried

> Blockquote

but I got this error after installing the dependency. I am using “react-native”: “0.63.5”,

As I see this error might be happening due to the crypto module not being properly available.

Please add the module: import “react-native-get-random-values”; in your index.js

also please make sure your metro config looks similar to this: https://github.com/Web3Auth/web3auth-core-kit-examples/blob/main/tkey-react-native/tkey-react-native-firebase-example/metro.config.js

Please follow this: Installing PnP React Native SDK | Documentation | Web3Auth

hi @yashovardhan ! we already have the token we did not required the login to user. we need getTorusKey is there any other doc for it?

As you see in the example, SFA SDK is being used. It does expect you to connect using intrinsic flow, it expects an ID Token. I’d recommend you to please have a look once again in the example. The example clearly takes the id token from the firebase login and passes to the tKey SFA service provider.

There is no need to getTorusKey function, that is using the React Native CustomAuth SDK which is not being used at all in the latest version of this example. React Native CustomAuth SDK has been deprecated.

hi @yashovardhan ! I got same error after reinstall node module and pods.

hi @yashovardhan !
I resolved this issue but if I try

 try {
    await (tKeyInstance.serviceProvider).init(
      ethereumPrivateKeyProvider,
    );
  } catch (error) {
    console.error(error);
  }

I got this error

I am following this code example : https://github.com/Web3Auth/web3auth-core-kit-examples/tree/main/tkey-react-native/tkey-react-native-firebase-example

hi @yashovardhan ! We are using node 14 and “react-native”: “0.63.5”, in our app. and the repo which you shared using latest RN version.

so If I am trying the same setup in our app it is giving use above error.

Hey @mahadev

Our SDKs require a minimum of

  • React Native Release 0.71 and above (for Bare React Native Workflow)
  • Expo SDK 48 and above (for Expo Managed Workflow)
  • iOS Platform Target Version 14 and above
  • Android Target SDK Version 31 and above

BigInt is a needed dependency and unfortunately the older versions do not support it.

This error happens with our browser version as well, you can check our troubleshooting guides

Also we recommend using node 18+ as it is the LTS version.

hi @yashovardhan ! we are using @toruslabs/customauth-react-native-sdk, from to long with the RN 0.63.5, for upgrading react native it is not an easy task for us. Also the same lib is working fine in android with all env and ios in test env only production env have the error.

can you please provide us any alternate solution so we can release our app for now.

You can try using the same react native version, but increase the platform target version for both android and ios. It might be able to fix your issue.

We upgrade to versions you mentioned abouve.

  • React Native Release 0.71 and above (for Bare React Native Workflow)
  • iOS Platform Target Version 14 and above
  • Android Target SDK Version 31 and above
    Tried in android - NODE version v18.16.0

We are getting this error now.

Response: 403
Url: https://metadata.tor.us/get_or_set_nonce
{"_bodyBlob": {"_data": {"__collector": [Object], "blobId": "08da171f-d6ab-4ce5-9f1d-663b86c14016", -4ce5-9f1d-663b86c14016", "offset": 0, "size": 83}}, "bodyUsed": false, "headers": {"map": {"content-length": "83", "content-security-policy": "default-src 'self';base-uri 'self';font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests", "content-type": "application/json; charset=utf-8", "cross-origin-embedder-policy": "require-corp", "cross-origin-opener-policy": "same-origin", "cross-origin-resource-policy": "same-origin", "date": "Thu, 24 Aug 2023 12:15:22 GMT", "etag": "W/\"53-M+1xWIPNXuyfp4q8yvBrboJ7CKE\"", "origin-agent-cluster": "?1", "referrer-policy": "no-referrer", "strict-transport-security": "max-age=15552000; includeSubDomains", "vary": "Origin, Accept-Encoding", "x-content-type-options": "nosniff", "x-dns-prefetch-control": "off", "x-download-options": "noopen", "x-frame-options": "SAMEORIGIN", "x-permitted-cross-domain-policies": "none", "x-xss-protection": "0"}}, "ok": false, "status": 403, "statusText": "", "type": "default", "url": "https://metadata.tor.us/get_or_set_nonce"}

what we have tried.

 try {
        await (tKeyInstance.serviceProvider as any).init(
          ethereumPrivateKeyProvider,
        );
      } catch (error) {
        console.error(error);
      }

above as initialization code. Login code as mentioned below.

 const OAuthShareKey = await (
        tKeyInstance.serviceProvider as SfaServiceProvider
      ).connect({
        verifier,
        verifierId,
        idToken,
      });

chain id config →

const chainConfig = {
  chainId: '0x1',
  rpcTarget: 'https://rpc.ankr.com/eth',
  displayName: 'testnet',
  blockExplorer: 'https://etherscan.io/',
  ticker: 'ETH',
  tickerName: 'Ethereum',
};

web3Auth options →

const web3AuthOptions: any = {
  clientId, // Get your Client ID from Web3Auth Dashboard
  chainConfig,
  web3AuthNetwork: 'testnet', // ["cyan", "testnet"]
};

Earlier we have tried below example code and it was working for us.

But now this code is showing the above same error.

Let us know what else we have to change , to make this code work.