You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since wallet onboarding, persistent wallet authentication requires many configuration and many dependencies are required. @p2pV1 and @13x54n concluded to build custom non-custodial web3 wallet.
@13x54n has already built the basic versioned web3 wallet. It won't be hassle and even the users don't need frequent interaction with external wallets, it'll be much easier for both tech and non-tech platform users. Here's the basic understanding blog of custom web3 wallet by @13x54n.
Updated Workflow
The older version of wallet by @13x54n is production ready but is not persistent thus I updated a workflow.
Basic Snippet
Remember to install the crypto-js library before running the React app:
npm install crypto-js
Though, crypto-js has stopped providing updates, the recent version of it is more than powerful for our wallet to work.
importReact,{useState}from'react';importcryptofrom'crypto';constApp=()=>{const[privateKey,setPrivateKey]=useState('');const[encryptedPrivateKey,setEncryptedPrivateKey]=useState('');const[decryptedPrivateKey,setDecryptedPrivateKey]=useState('');// Define a helper function to encrypt the private keyconstencryptPrivateKey=(privateKey,encryptionKey)=>{constcipher=crypto.createCipher('aes-256-cbc',encryptionKey);letencrypted=cipher.update(privateKey,'utf8','hex');encrypted+=cipher.final('hex');returnencrypted;};// Define a helper function to decrypt the private keyconstdecryptPrivateKey=(encryptedPrivateKey,encryptionKey)=>{constdecipher=crypto.createDecipher('aes-256-cbc',encryptionKey);letdecrypted=decipher.update(encryptedPrivateKey,'hex','utf8');decrypted+=decipher.final('utf8');returndecrypted;};// Handle encryption and decryptionconsthandleEncryptDecrypt=()=>{constencryptionKey='your-encryption-key';//@dev Replace with user chosen password// Encrypt the private keyconstencryptedKey=encryptPrivateKey(privateKey,encryptionKey);setEncryptedPrivateKey(encryptedKey);// Decrypt the private keyconstdecryptedKey=decryptPrivateKey(encryptedKey,encryptionKey);setDecryptedPrivateKey(decryptedKey);};return(<div><h1>Private Key Encryption</h1><div><label>Private Key:</label><inputtype="text"value={privateKey}onChange={(e)=>setPrivateKey(e.target.value)}/></div><buttononClick={handleEncryptDecrypt}>Encrypt/Decrypt</button><div><label>Encrypted Private Key:</label><inputtype="text"value={encryptedPrivateKey}readOnly/></div><div><label>Decrypted Private Key:</label><inputtype="text"value={decryptedPrivateKey}readOnly/></div></div>);};exportdefaultApp;
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Custom Non-Custodial Web3 Wallet
Since wallet onboarding, persistent wallet authentication requires many configuration and many dependencies are required. @p2pV1 and @13x54n concluded to build custom non-custodial web3 wallet.
@13x54n has already built the basic versioned web3 wallet. It won't be hassle and even the users don't need frequent interaction with external wallets, it'll be much easier for both tech and non-tech platform users. Here's the basic understanding blog of custom web3 wallet by @13x54n.
Updated Workflow
The older version of wallet by @13x54n is production ready but is not persistent thus I updated a workflow.
Basic Snippet
Remember to install the
crypto-js
library before running the React app:Though,
crypto-js
has stopped providing updates, the recent version of it is more than powerful for our wallet to work.Beta Was this translation helpful? Give feedback.
All reactions