Skip to content

Commit

Permalink
add namedArgs and positionalArgs as they are required parameter in uu…
Browse files Browse the repository at this point in the history
…id v4, these parameter are optional in uuid v3
  • Loading branch information
Nika Hassani committed Dec 4, 2023
1 parent 7844ba3 commit f562c6b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/aws_common/lib/src/util/uuid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import 'dart:math';
import 'dart:typed_data';

import 'package:uuid/uuid.dart';

Expand All @@ -15,10 +16,14 @@ String uuid({bool secure = false}) => const Uuid().v4(
? null
: const <String, Object>{
'rng': _cryptoRNG,
'positionalArgs': [],
'namedArgs': <Symbol, dynamic>{},
},
);

/// Creates 16 digit cryptographically secure random number.
List<int> _cryptoRNG() {
return List<int>.generate(16, (i) => Random.secure().nextInt(256));
Uint8List _cryptoRNG() {
return Uint8List.fromList(
List<int>.generate(16, (i) => Random.secure().nextInt(256)),
);
}

0 comments on commit f562c6b

Please sign in to comment.