SealedBox.fromCombined constructor

SealedBox.fromCombined(
  1. List<int> combined, {
  2. int tagLength = 16,
})

Splits ciphertext || tag with a tagLength-byte tag (16 by default).

Implementation

factory SealedBox.fromCombined(List<int> combined, {int tagLength = 16}) {
  if (combined.length < tagLength) {
    throw ArgumentError.value(
      combined.length,
      'combined',
      'shorter than the $tagLength byte tag',
    );
  }
  final split = combined.length - tagLength;
  return SealedBox(
    Uint8List.fromList(combined.sublist(0, split)),
    Uint8List.fromList(combined.sublist(split)),
  );
}