generateBridgeToken function

String generateBridgeToken()

A random per-checkout secret the host page adds to every bridge message. Native code drops messages without it, so other frames (the checkout iframe, bank pages), which cannot read the host page's script, cannot send results even where the bridge is visible to them.

Implementation

String generateBridgeToken() {
  final random = Random.secure();
  return List.generate(16, (_) => random.nextInt(256).toRadixString(16).padLeft(2, '0')).join();
}