diff --git a/packages/amplify_core/pubspec.yaml b/packages/amplify_core/pubspec.yaml index 6f35d01040..495a17934a 100644 --- a/packages/amplify_core/pubspec.yaml +++ b/packages/amplify_core/pubspec.yaml @@ -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" diff --git a/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml b/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml index f74db562de..586452794b 100644 --- a/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml +++ b/packages/analytics/amplify_analytics_pinpoint_dart/pubspec.yaml @@ -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" diff --git a/packages/auth/amplify_auth_cognito_dart/pubspec.yaml b/packages/auth/amplify_auth_cognito_dart/pubspec.yaml index 3a2a02ee5d..3c33c84142 100644 --- a/packages/auth/amplify_auth_cognito_dart/pubspec.yaml +++ b/packages/auth/amplify_auth_cognito_dart/pubspec.yaml @@ -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" diff --git a/packages/authenticator/amplify_authenticator/example/pubspec.yaml b/packages/authenticator/amplify_authenticator/example/pubspec.yaml index dc95b92beb..041887e5e5 100644 --- a/packages/authenticator/amplify_authenticator/example/pubspec.yaml +++ b/packages/authenticator/amplify_authenticator/example/pubspec.yaml @@ -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 diff --git a/packages/aws_common/lib/src/util/uuid.dart b/packages/aws_common/lib/src/util/uuid.dart index 1df3f89da7..ae163778a3 100644 --- a/packages/aws_common/lib/src/util/uuid.dart +++ b/packages/aws_common/lib/src/util/uuid.dart @@ -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 { - 'rng': UuidUtil.cryptoRNG, + 'rng': _cryptoRNG, + 'positionalArgs': [], + 'namedArgs': {}, }, ); + +/// Creates 16 digit cryptographically secure random number. +Uint8List _cryptoRNG() { + return Uint8List.fromList( + List.generate(16, (i) => Random.secure().nextInt(256)), + ); +} diff --git a/packages/aws_common/pubspec.yaml b/packages/aws_common/pubspec.yaml index b8ba12edc7..cc524cec99 100644 --- a/packages/aws_common/pubspec.yaml +++ b/packages/aws_common/pubspec.yaml @@ -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" diff --git a/pubspec.yaml b/pubspec.yaml index dd40c11046..9dfe746452 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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