fetchAatl function

Future<PdfAatlSnapshot> fetchAatl({
  1. required Future<Uint8List> fetch(
    1. Uri url
    ),
  2. DateTime? now,
  3. Duration maxAge = PdfAatl.maxAge,
  4. String rootFingerprint = PdfAatl.adobeRootFingerprint,
})

Downloads the AATL from PdfAatl.url through the host's fetch (the library performs no I/O), verifies that its signature chains to Adobe Root CA G2 and that it was signed within maxAge of now, and returns its trusted roots. Throws FormatException when verification fails.

This fetches Adobe's own published file on the user's device; nothing about the documents being validated is sent. dart-pdf never bundles or redistributes the list.

Implementation

Future<PdfAatlSnapshot> fetchAatl({
  required Future<Uint8List> Function(Uri url) fetch,
  DateTime? now,
  Duration maxAge = PdfAatl.maxAge,
  String rootFingerprint = PdfAatl.adobeRootFingerprint,
}) async {
  final at = (now ?? DateTime.now()).toUtc();
  final snapshot = parseAatlSecuritySettings(await fetch(PdfAatl.url),
      maxAge: maxAge, now: at, rootFingerprint: rootFingerprint);
  return PdfAatlSnapshot(snapshot.anchors,
      signedAt: snapshot.signedAt, signer: snapshot.signer, fetchedAt: at);
}