getDecodedPayload static method

Map<String, dynamic> getDecodedPayload(
  1. String input,
  2. Nonce nonce,
  3. ChaCha20? chaCha20, {
  4. bool compressed = true,
})

decrypt and decompress target input.

Implementation

static Map<String, dynamic> getDecodedPayload(
    String input, Nonce nonce, ChaCha20? chaCha20,
    {bool compressed = true}) {
  if (chaCha20 == null) compressed = false;
  if (chaCha20 != null) {
    input = chaCha20.decrypt(input, nonce);
  }

  if (compressed) {
    ZLibDecoder zlibE = ZLibDecoder();
    input = utf8.decode(zlibE.convert(base64Decode(input)));
  }

  return jsonDecode(input);
}