👻How it works ?
How tonspack wallet works ?
Tonspack is a telegram base mulity chains support wallet .
Auth user base on telegram-webapp-initdata
and telegram-BiometricManager
.
How Tonspack work ?
The core of Tonspack wallet is Web3auth base telegram webapp initData MPC . Details of MPC part can be found here .
Tonspack working flow
Login telegram webapp
Auth telegram webapp initData into Tonspack-mpc-auth-middleware . Generate JWT token.
Redirect JWT token into Tonspack wallet font-end .
Tonspack wallet font-end request Web3auth for it's privateKey part . And culcuate the privateKey in local font-end .
Using BIP-44 to generate the different keypair for chains in local font-end .
Do follow connect/sign message/send transaction in font-end .
How Tonspack using Bip-44 works ?
Example code how it works base on BIP44
function getKp(sk:string)
{
const master = hd.hdkey.fromMasterSeed(Buffer.from(sk,'hex'));
const derive = master.deriveChild(derivePath)
const evmWallet = derive.getWallet()
const naclKp = nacl.sign.keyPair.fromSeed(evmWallet.getPrivateKey())
return {
naclKp : naclKp,
evmKp : {
address : evmWallet.getAddressString(),
privateKey : evmWallet.getPrivateKeyString()
},
solKp : {
address : bs58.encode(naclKp.publicKey),
privateKey :bs58.encode(naclKp.secretKey),
},
tonKp : ton.getTonWalletV4KeyPair(
Buffer.from(naclKp.secretKey),0),
btcKp : btc.getKeyPair(
Buffer.from(evmWallet.getPrivateKey())
)
} as objKP
The init sk comes from Web3auth SDK generate .
And it can generate different keypair by BIP-44 rules .
Last updated