encryptionStrategyFromString function Null safety

EncryptionStrategy encryptionStrategyFromString(
  1. String strategy
)

Given a string from Cryppo's seralization format, return the corresponding EncryptionStrategy

Implementation

EncryptionStrategy encryptionStrategyFromString(String strategy) {
  switch (strategy) {
    case 'Aes256Gcm':
      return EncryptionStrategy.aes256Gcm;
    case 'Aes256Cbc':
      return EncryptionStrategy.aes256Cbc;
    case 'Aes256Ctr':
      return EncryptionStrategy.aes256Ctr;
    case 'Rsa4096':
      return EncryptionStrategy.rsa4096;
  }
  throw 'Strategy "$strategy" not registered';
}