importAccountFromPrivateKey
Imports an account from a private key.
Usage
- main.ts
import { voi } from '@kibisis/chains';
import { type Account, createKatavault } from '@kibisis/katavault-core';
const katavault = await createKatavault({
chains: [voi],
});
let account: Account;
await katavault.authenticateWithPasskey({
user: {
name: 'Kibi',
username: 'kibi@kibis.is',
},
});
account = await katavault.importAccountFromPrivateKey({
name: 'MyAVMWallet',
privateKey: window.crypto.randomBytes(32),
});
console.log(account);
/*
{
address: 'NWAETAF7ULBD57DVW4JTH5ZENV5C3XOYLU66VLR3WVOUNBJWX5GOJLQZCI',
name: 'MyAVMWallet',
}
*/
Parameters
params
The private key of the account to be imported and an optional name for the account.
Returns
A promise that resolves to the imported account.
Throws
EncryptionError
If the account's private key failed to be encrypted.
NotAuthenticatedError
If the provider has not been authenticated.