deserializeCombinedCipherFromString function

ASECombinedCipher deserializeCombinedCipherFromString(
  1. String jsonString
)

Deserializes the combined ciphertext from a JSON string The string should contain a JSON object with the keys 'kemCt', 'nonce', 'ciphertext', and 'salt'.

Implementation

ASECombinedCipher deserializeCombinedCipherFromString(String jsonString) {
  var m = jsonDecode(jsonString) as Map<String, dynamic>;
  if (!m.containsKey('kemCt') ||
      !m.containsKey('nonce') ||
      !m.containsKey('ciphertext') ||
      !m.containsKey('salt')) {
    throw FormatException('Invalid ciphertext format');
  }
  return deserializeCombinedCipherFromJson(m);
}