Data.fromEncrypted constructor
Implementation
factory Data.fromEncrypted({
required String encrypted,
String? encryptionKey,
}) {
if (encryptionKey == null) throw EncryptionKeyException();
EncryptionService encryptionService = EncryptionService();
try {
final json =
encryptionService.decryptPushWithAes(encryptionKey, encrypted);
return Data.fromJson(json);
} catch (e) {
throw EncryptionKeyException();
}
}