messageId static method

String messageId(
  1. String identity,
  2. String cid
)

The id the engine gives a message: rm:<base64url identity>:<cid>, or rm:~:<cid> for a very long identity. The kit builds it before sending so it can drop its own echo on the socket and on the data channel.

Implementation

static String messageId(String identity, String cid) {
  final b64 = base64Url.encode(utf8.encode(identity)).replaceAll('=', '');
  return 'rm:${b64.length <= 160 ? b64 : '~'}:$cid';
}