computeMetadataSync method

BlobMetadata computeMetadataSync(
  1. Uint8List data,
  2. int numShards
)

Synchronous version of computeMetadata suitable for use in Isolate.run() to avoid blocking the main thread.

Implementation

BlobMetadata computeMetadataSync(Uint8List data, int numShards) {
  // Generate a random nonce for upload relay auth.
  // Mirrors TS SDK: crypto.getRandomValues(new Uint8Array(32))
  final nonce = Uint8List(32);
  final rng = Random.secure();
  for (var i = 0; i < 32; i++) {
    nonce[i] = rng.nextInt(256);
  }

  return _computeMetadataFFI(data, numShards, nonce);
}