signPersonalMessage method

Uint8List signPersonalMessage(
  1. Uint8List payload, {
  2. required int networkId,
})

Signs an Core Block Chain specific signature. This method is equivalent to sign, but with a special prefix so that this method can't be used to sign, for instance, transactions.

Implementation

Uint8List signPersonalMessage(Uint8List payload, {required int networkId}) {
  final prefix = _messagePrefix + payload.length.toString();
  final prefixBytes = ascii.encode(prefix);

  // will be a Uint8List, see the documentation of Uint8List.+
  final concat = uint8ListFromList(prefixBytes + payload);

  return sign(concat, networkId: networkId);
}