encryptPayload method
Encrypts the data payload to be sent to Phantom Wallet.
Implementation
Uint8List? encryptPayload(Map<String, dynamic> data, Uint8List? nonce) {
if (_sharedSecretBox == null) {
return null;
}
final n = nonce ?? _core.crypto.getUtils().randomBytes(24);
final payload = jsonEncode(data).codeUnits;
final encryptedPayload = _sharedSecretBox?.encrypt(
Uint8List.fromList(payload),
nonce: n,
);
return encryptedPayload?.cipherText.asTypedList;
}