Torus authentication

Hi everyone,

Does anyone have a code sample of the authentication of a dapp with Torus (https://tor.us/) ?
I have seen it on Entrepot and would like to implement it myself on my app.

I think this would greatly benefit the community !

Have a great day,
Anthony

I use Torus OpenLogin. Works great! They have docs on how to integrate. It really depends on whether you want to use OpenLogin or CustomAuth.

BTW, they rebranded to Web3auth

2 Likes

I think Openlogin can be really useful since every web2 users could authenticate easily.
Do you mind sharing your “Internet Computer Adapter” code ?
We have to generate a public/private key and pass it to web3auth ? I just don’t want to introduce a big security risk :rofl:

I use React Native so a lot of the boilerplate code may not apply. I would check their docs depending on your platform.

But assuming the user logs in successfully, the OpenLogin library will return a privKey, which you then can do…

import {fromHexString} from '@dfinity/candid/lib/cjs/utils/buffer';
import {Secp256k1KeyIdentity} from '@dfinity/identity';

const identity = Secp256k1KeyIdentity.fromSecretKey(fromHexString(privKey));
const agent = new HttpAgent({host: getHost(), identity});
5 Likes

Alright i was not sure on that part ! Thanks

I’m assuming that Torus & Web3auth is done on a separate blockchain.

After looking this up on their docsite here, this is what their current architecture looks like for integrating with the Torus network

I haven’t been able to find much information/documentation on the actual Torus network itself and how it is architected, how decentralized it is, etc. (please point me to docs if you’ve found them!).

I definitely see a potential benefit in de-risking your application by having user auth and user data on different blockchains (especially given the friction and performance around adopting Internet Identity), but I would be wary to use Web3Auth if it’s architecture is more centralized or less documented (even if it does provide a great user workflow and experience).

Furthermore, navigating to the Torus repo GitHub - Web3Auth/Web3Auth: Simple infrastructure that enables Web3 wallets and applications to provide seamless user logins for both mainstream and Web3.0 users., I don’t see any software licenses attached to the software - so what happens if they come out and put a super restrictive/pay for license on their libraries/sdks after you’ve already built it into your workflow.

I think this looks like a promising auth route, just want to make sure I understand all of the pros/cons for any projects I might build before thinking about or using Torus Web3Auth, as well as for others who are reading this thread in the future because they are considering using Torus Web3Auth for their applications.

I’m looking at Web3Auth as a more user friendly login for my app, my users aren’t particularly familiar with web3. I’m wondering how you got on? My frontend will be a React webapp and a React Native mobile version.

@jzxchiang did you face issues with edge cases on different devices and OS versions?