encryptMessage method

Uint8List encryptMessage(
  1. Uint8List message,
  2. String passphrase,
  3. Uint8List salt
)

Implementation

static Uint8List encryptMessage(
    Uint8List message, String passphrase, Uint8List salt) {
  var keyBytes = SodiumUtils.pwhash(passphrase, salt);
  var nonce = SodiumUtils.nonce();
  var s = SodiumUtils.close(message, nonce, keyBytes);

  return new Uint8List.fromList(nonce.toList() + s.toList());
}