Skip to content

Commit

Permalink
chore(dep): update uuid dependency version range (#4194)
Browse files Browse the repository at this point in the history
* chore(dep): update uuid dependency version range
  • Loading branch information
NikaHsn authored Dec 5, 2023
1 parent 3e23919 commit 4d4e7a6
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/amplify_core/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies:
meta: ^1.7.0
retry: ^3.1.0
stack_trace: ^1.10.0
uuid: ">=3.0.6 <=3.0.7"
uuid: ">=3.0.6 <5.0.0"

dev_dependencies:
amplify_lints: ">=3.0.1 <3.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
path: ^1.8.0
smithy: ">=0.6.1 <0.7.0"
smithy_aws: ">=0.6.0 <0.7.0"
uuid: ">=3.0.6 <=3.0.7"
uuid: ">=3.0.6 <5.0.0"

dev_dependencies:
amplify_lints: ">=3.0.0 <3.1.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/amplify_auth_cognito_dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies:
smithy: ">=0.6.0 <0.7.0"
smithy_aws: ">=0.6.0 <0.7.0"
stream_transform: ^2.0.0
uuid: ">=3.0.6 <=3.0.7"
uuid: ">=3.0.6 <5.0.0"
win32: ">=4.1.2 <6.0.0"
win32_registry: ^1.1.0
worker_bee: ">=0.2.0+5 <0.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dev_dependencies:
integration_test:
sdk: flutter
stream_transform: ^2.0.0
uuid: ">=3.0.6 <=3.0.7"
uuid: ">=3.0.6 <5.0.0"

flutter:
uses-material-design: true
Expand Down
18 changes: 14 additions & 4 deletions packages/aws_common/lib/src/util/uuid.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

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

import 'package:uuid/uuid.dart';
import 'package:uuid/uuid_util.dart';

/// Generates a UUID (v4).
///
/// If [secure] is `true`, uses a crypto-secure RNG at the cost of worse
/// performance (5-100x, depending on the platform).
String uuid({bool secure = false}) => const Uuid().v4(
// ignore: deprecated_member_use
options: !secure
? null
// Use the crypto-secure RNG per `package:uuid` docs:
// https://github.com/Daegalus/dart-uuid/blob/d7bc930942afc752edd0fd15f8bf8234d81dfeda/example/example.dart#L21
: const <String, Object>{
'rng': UuidUtil.cryptoRNG,
'rng': _cryptoRNG,
'positionalArgs': [],
'namedArgs': <Symbol, dynamic>{},
},
);

/// Creates 16 digit cryptographically secure random number.
Uint8List _cryptoRNG() {
return Uint8List.fromList(
List<int>.generate(16, (i) => Random.secure().nextInt(256)),
);
}
2 changes: 1 addition & 1 deletion packages/aws_common/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:
os_detect: ^2.0.0
path: ^1.8.0
stream_transform: ^2.0.0
uuid: ">=3.0.6 <=3.0.7"
uuid: ">=3.0.6 <5.0.0"

dev_dependencies:
amplify_lints: ">=3.0.0 <3.1.0"
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies:
sqlite3: ^2.0.0
source_gen: ^1.3.2
stack_trace: ^1.10.0
uuid: ">=3.0.6 <=3.0.7"
uuid: ">=3.0.6 <5.0.0"
win32: ">=4.1.2 <6.0.0"
xml: 6.3.0
test: ^1.22.1
Expand Down

0 comments on commit 4d4e7a6

Please sign in to comment.