documentID property

Uint8List get documentID

Generates or returns the document ID.

Implementation

Uint8List get documentID {
  if (_documentID == null) {
    final now = Uint8List.fromList(DateTime.now().toIso8601String().codeUnits);
    final random = PdfCrypto.randomBytes(32);
    final seed = Uint8List(now.length + random.length);
    seed.setRange(0, now.length, now);
    seed.setRange(now.length, seed.length, random);
    _documentID = PdfCrypto.sha256(seed);
  }

  return _documentID!;
}