Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const createVault = async (password, mnemonic) => {
const keyRingController = new KeyringController({});
const controller = await keyRingController.createNewVaultAndRestore(password, mnemonic);
const vault = keyRingController.store.getState();
storeKeyData(JSON.stringify(vault));
return keyRingController;
}
export const restoreVault = async (password) => {
const keyStore = JSON.parse(getKeyData());
const keyRingController = new KeyringController({
initState: keyStore
});
const controller = await keyRingController.submitPassword(password);
return keyRingController;
}