decodePayload static method

Payload decodePayload(
  1. List<int> bytes
)

Implementation

static Payload decodePayload(List<int> bytes) {
  final nonce = bytes.sublist(0, nonceLength);
  return PayloadLocal(
    secretBox: SecretBox.fromConcatenation(
      bytes,
      nonceLength: nonceLength,
      macLength: macLength,
    ).withNonce(Uint8List.fromList(nonce.sublist(0, halfNonceLength))),
    nonce: Mac(nonce),
    mac: Hash(bytes.sublist(bytes.length - macLength, bytes.length)),
  );
}