I am using custom verification , and i need to create a verifier Id that has to be same accross all jwt token . but I need someting dynamic. not fixed value how to achive that.
and form where i will get user information that actually created
@sheikh Thanks for your recent post.
Your request has been forwarded to our Dev team and we will get back with further updates.
VerifierId needs to be different for different users and every time during login, it should contain the same verifierId in the JWT for that particular user.
Thats what i am doing,
But it is returning same credentials for every user .
I have created a custom field name cons with 297 value.
But in my token there is userId filed unique for each user.
Instead of returning different credentials it is returning same credentials for each user.
Let me know you want to see my code
Please share your implementation code
// IMP START - Quick Start
const { Web3Auth } = require("@web3auth/node-sdk");
const { EthereumPrivateKeyProvider } = require("@web3auth/ethereum-provider");
// IMP END - Quick Start
const jwt = require("jsonwebtoken");
const fs = require("fs");
// IMP START - Dashboard Registration
const clientId =
"BKHZMdxp4EID5q76oP0TyMFymVOKmTqeTEPRMks5kUklP07lSZKNrR91wrg7Z7lSTlBgAwMz8ldVeBTce_ZhaiA"; // Get your Client ID from Web3Auth Dashboard
// IMP END - Dashboard Registration
// IMP START - Verifier Creation
const verifier = "bowled-custom-test";
// IMP END - Verifier Creation
// IMP START - SDK Initialization
const web3auth = new Web3Auth({
clientId,
web3AuthNetwork: "sapphire_devnet", // Get your Network ID from Web3Auth Dashboard
});
const ethereumProvider = new EthereumPrivateKeyProvider({
config: {
chainConfig: {
chainId: "0xaa36a7",
rpcTarget: "https://rpc.ankr.com/eth_sepolia",
displayName: "Ethereum Sepolia",
blockExplorer: "https://sepolia.etherscan.io/",
ticker: "ETH",
tickerName: "Ethereum",
},
},
});
web3auth.init({ provider: ethereumProvider });
// IMP END - SDK Initialization
// IMP START - Auth Provider Login
var privateKey = fs.readFileSync("privatekey.pem");
var token = jwt.sign(
{
userId: "8d50d20d-f2a6-4da3",
iat: Math.floor(Date.now() / 1000),
exp: Math.floor(Date.now() / 1000) + 60 * 60,
cons: "297",
},
privateKey,
{ algorithm: "RS256", keyid: "8d50d20d-f2a6-4da5-80aa-8b15e13f0447" }
);
console.log("token :: ", token);
// IMP END - Auth Provider Login
const connect = async () => {
// IMP START - Login
const provider = await web3auth.connect({
verifier: verifier, // replace with your verifier name
verifierId: "297", // replace with your verifier id's value, for example, sub value of JWT Token, or email address.
idToken: token, // replace with your newly created unused JWT Token.
});
console.log("check ::");
// IMP END - Login
const eth_private_key = await provider.request({ method: "eth_private_key" });
console.log("ETH PrivateKey: ", eth_private_key);
const eth_address = await provider.request({ method: "eth_accounts" });
console.log("ETH Address: ", eth_address[0]);
process.exit(0);
};
connect();
userId will uinique for each user.
i want to achive : I am trying to create wallet with jwt token for user , and i am want wallet addres and private key back.
Any update regarding this topic ?
The created verifier uses cons for both validation and verifierId, you should use userId
as verifierId. Please update your verifier.
I have tried with updating.
That…
In verifier id I have to give specific value .
And it is looking for that value in every token.
In my case verified id will be dynamic
Do i need to change my code?
Hey @sheikh,
It’s crucial that the Verifier ID is unique for each user. If it remains the same across all users, it will result in identical wallet addresses and private keys for everyone, which is not secure. To ensure each user receives a unique wallet address, the Verifier ID should be a value that’s distinct for each user. A great example of such a unique identifier could be the user’s email address. By implementing this, you’ll ensure that each user gets a unique wallet address and private key.
If you need a reference, please have a look at the example here which is using the same SDK you are using.
Do i need to re initialize verifier id for each user in my dashboard?
In our scenario…
userId is unique for all the token.
But the thing is…
While setting it in dashboard i am using custom verifier id.
I.e. userId and then i have provide some value…
And it is checking that value for every token…
So do i need to re initialize the userId value after getting wallet cred
hello,
is there any solution for .
me how i can achive that
Please put the verifier ID as user ID in the code. Also, on the Web3Auth dashboard update your verifier to include user ID as the verifier ID. @sheikh