changePassword method
change password of account
Implementation
Future<KeyPairData?> changePassword(
Keyring keyring, String passOld, passNew) async {
final acc = keyring.current;
// 1. change password of keyPair in webView
final res = await service!.changePassword(acc.pubKey, passOld, passNew);
if (res == null) {
return null;
}
// 2. if success in webView, then update encrypted seed in local storage.
keyring.store.updateEncryptedSeed(acc.pubKey, passOld, passNew);
// update json meta data
service!.updateKeyPairMetaData(res, acc.name);
// update keyPair date in storage
keyring.store.updateAccount(res);
return KeyPairData.fromJson(res as Map<String, dynamic>);
}