diff --git a/client/lib/libphylum/util/uuid.dart b/client/lib/libphylum/util/uuid.dart index b40849a7..cbb8fe20 100644 --- a/client/lib/libphylum/util/uuid.dart +++ b/client/lib/libphylum/util/uuid.dart @@ -10,10 +10,18 @@ final List _byteToHex = List.generate(256, (i) { return i.toRadixString(16).padLeft(2, '0'); }); +/// Generates a V7 UUID. +/// +/// Issue on JS web for the 2 most significant bytes. +/// More details [here](https://dart.dev/resources/language/number-representation#bitwise-operations) String generateUuid() { var buf = Uint8List(16); final (ms, seq) = _getV7Time(); + // Workaround for JS web: + // final msHigh = (ms / pow(2, 32)).toInt(); + // buf[0] = msHigh >> 8; + // buf[1] = msHigh; buf[0] = ms >> 40; buf[1] = ms >> 32; buf[2] = ms >> 24;