Torus authentication

Hi everyone,

Does anyone have a code sample of the authentication of a dapp with Torus ( ?
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,

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


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});

Alright i was not sure on that part ! Thanks