getVaultKey method
Implementation
Future<List<int>> getVaultKey(Map user, String password) async {
if (_vaultKey != null) {
return _vaultKey!;
}
encVaultKey = vault['enc_vault_key'];
if (encVaultKey.isEmpty) {
throw Exception("Empty encrypted vault key.");
}
String pkPem = await Robomotion().getPrivateKey(
user,
password,
);
final vk = await rsa.RSA.decryptOAEPBytes(
base64Decode(encVaultKey),
"",
rsa.Hash.SHA256,
pkPem,
);
_vaultKey = vk.toList();
return _vaultKey!;
}