textMessageAnoymizer function

TextMessage textMessageAnoymizer(
  1. Data data
)

A TextMessage anonymizer function. Anonymizes:

  • address
  • body

Implementation

TextMessage textMessageAnoymizer(Data data) {
  assert(data is TextMessage);
  var msg = data as TextMessage;
  if (msg.address != null) {
    msg.address = sha1.convert(utf8.encode(msg.address!)).toString();
  }
  if (msg.body != null) {
    msg.body = sha1.convert(utf8.encode(msg.body!)).toString();
  }

  return msg;
}