From 770fb872563f207d8a68e28c56f1ff3660fb20da Mon Sep 17 00:00:00 2001 From: xavierchanth Date: Tue, 26 Nov 2024 13:26:54 -0500 Subject: [PATCH 1/9] fix: atSign activation --- .../screen/at_onboarding_activate_screen.dart | 18 ++- .../screen/at_onboarding_generate_screen.dart | 15 ++- .../lib/screen/at_onboarding_home_screen.dart | 122 +++++++++++++----- 3 files changed, 111 insertions(+), 44 deletions(-) diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_activate_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_activate_screen.dart index eb7cad86..c3e6ee2b 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_activate_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_activate_screen.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:io'; +import 'package:at_auth/at_auth.dart'; import 'package:at_client_mobile/at_client_mobile.dart'; import 'package:at_onboarding_flutter/at_onboarding_result.dart'; import 'package:at_onboarding_flutter/localizations/generated/l10n.dart'; @@ -103,7 +104,8 @@ class _AtOnboardingActivateScreenState ), const SizedBox(height: 10), Text( - AtOnboardingLocalizations.current.msg_wait_fetching_atSign, + AtOnboardingLocalizations + .current.msg_wait_fetching_atSign, ), ], ), @@ -146,7 +148,7 @@ class _AtOnboardingActivateScreenState data = jsonDecode(data); AtOnboardingOTPResult? result; - if(context.mounted) { + if (context.mounted) { result = await AtOnboardingOTPScreen.push( context: context, atSign: atsign ?? (widget.atSign ?? ''), @@ -219,8 +221,11 @@ class _AtOnboardingActivateScreenState _onboardingService.setAtClientPreference = widget.config.atClientPreference; - authResponse = await _onboardingService.authenticate(atsign, - cramSecret: secret, status: OnboardingStatus.ACTIVATE); + String? previousAtsign = _onboardingService.currentAtsign; + _onboardingService.setAtsign = atsign; + authResponse = await _onboardingService.onboard( + cramSecret: secret, + ); int round = 1; atSignStatus = await _onboardingService.checkAtSignServerStatus(atsign); @@ -235,6 +240,11 @@ class _AtOnboardingActivateScreenState debugPrint("currentAtSignStatus: $atSignStatus"); } + if (authResponse != AtOnboardingResponseStatus.authSuccess || + atSignStatus == ServerStatus.teapot) { + _onboardingService.setAtsign = previousAtsign; + } + if (authResponse == AtOnboardingResponseStatus.authSuccess) { if (atSignStatus == ServerStatus.teapot) { await _showAlertDialog( diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart index a3cf1a1f..6f756282 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart @@ -474,11 +474,12 @@ class _AtOnboardingGenerateScreenState await Future.delayed(const Duration(seconds: 10)); - authResponse = await _onboardingService.authenticate( - verifiedAtSign, - cramSecret: cramSecret, - status: OnboardingStatus.ACTIVATE, + String? previousAtsign = _onboardingService.currentAtsign; + _onboardingService.setAtsign = verifiedAtSign; + authResponse = await _onboardingService.onboard( + cramSecret: secret, ); + _inprogressDialog.close(); if (authResponse == AtOnboardingResponseStatus.authSuccess) { if (!mounted) return; @@ -494,7 +495,11 @@ class _AtOnboardingGenerateScreenState if (!mounted) return; Navigator.pop( context, AtOnboardingResult.success(atsign: verifiedAtSign)); - } else if (authResponse == AtOnboardingResponseStatus.serverNotReached) { + } else { + _onboardingService.setAtsign = previousAtsign; + } + + if (authResponse == AtOnboardingResponseStatus.serverNotReached) { await _showAlertDialog( AtOnboardingLocalizations.current.msg_atSign_unreachable, ); diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_home_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_home_screen.dart index 593407de..b5114458 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_home_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_home_screen.dart @@ -82,8 +82,10 @@ class _AtOnboardingHomeScreenState extends State { String? _pairingAtsign; ServerStatus? atSignStatus; - final String _incorrectKeyFile = AtOnboardingLocalizations.current.msg_cannot_fetch_keys_from_chosen_file; - final String _failedFileProcessing = AtOnboardingLocalizations.current.error_processing_files; + final String _incorrectKeyFile = + AtOnboardingLocalizations.current.msg_cannot_fetch_keys_from_chosen_file; + final String _failedFileProcessing = + AtOnboardingLocalizations.current.error_processing_files; late AtSyncDialog _inprogressDialog; @@ -142,7 +144,8 @@ class _AtOnboardingHomeScreenState extends State { // width: _dialogWidth, decoration: BoxDecoration( color: theme.primaryColor.withOpacity(0.1), - borderRadius: BorderRadius.circular(AtOnboardingDimens.borderRadius)), + borderRadius: + BorderRadius.circular(AtOnboardingDimens.borderRadius)), padding: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), margin: const EdgeInsets.all(AtOnboardingDimens.paddingNormal), constraints: const BoxConstraints( @@ -165,7 +168,9 @@ class _AtOnboardingHomeScreenState extends State { key: keyUploadAtSign, height: 48, borderRadius: 24, - onPressed: (Platform.isMacOS || Platform.isLinux || Platform.isWindows) + onPressed: (Platform.isMacOS || + Platform.isLinux || + Platform.isWindows) ? _uploadKeyFileForDesktop : _uploadKeyFile, isLoading: loading, @@ -206,8 +211,10 @@ class _AtOnboardingHomeScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - AtOnboardingLocalizations.current.btn_activate_atSign, - style: const TextStyle(fontSize: AtOnboardingDimens.fontLarge), + AtOnboardingLocalizations + .current.btn_activate_atSign, + style: const TextStyle( + fontSize: AtOnboardingDimens.fontLarge), ), const Icon(Icons.arrow_right_alt_rounded) ], @@ -228,7 +235,9 @@ class _AtOnboardingHomeScreenState extends State { required String secret, }) { String cramSecret = secret.split(':').last; - String atsign = atSign.startsWith('@') ? atSign : '@$atSign'; + String atsign = atSign.startsWith('@') + ? atSign + : '@$atSign'; _processSharedSecret(atsign, cramSecret); }, config: widget.config, @@ -291,8 +300,8 @@ class _AtOnboardingHomeScreenState extends State { String decodeQrCode(String imagepath) { var image = img.decodePng(File(imagepath).readAsBytesSync())!; - LuminanceSource source = RGBLuminanceSource( - image.width, image.height, image.getBytes(order: img.ChannelOrder.abgr).buffer.asInt32List()); + LuminanceSource source = RGBLuminanceSource(image.width, image.height, + image.getBytes(order: img.ChannelOrder.abgr).buffer.asInt32List()); var bitmap = BinaryBitmap(HybridBinarizer(source)); var reader = QRCodeReader(); @@ -350,7 +359,8 @@ class _AtOnboardingHomeScreenState extends State { child: Text( (Platform.isAndroid || Platform.isIOS) ? AtOnboardingLocalizations.current.tutorial_scan_QRCode - : AtOnboardingLocalizations.current.tutorial_upload_image_QRCode, + : AtOnboardingLocalizations + .current.tutorial_upload_image_QRCode, style: const TextStyle( color: Colors.white, fontWeight: FontWeight.w500, @@ -378,7 +388,8 @@ class _AtOnboardingHomeScreenState extends State { builder: (context, controller) { return Center( child: Text( - AtOnboardingLocalizations.current.tutorial_activate_your_atSign, + AtOnboardingLocalizations + .current.tutorial_activate_your_atSign, style: const TextStyle( color: Colors.white, fontWeight: FontWeight.w500, @@ -425,7 +436,8 @@ class _AtOnboardingHomeScreenState extends State { } Future showErrorDialog(String? errorMessage) async { - return AtOnboardingDialog.showError(context: context, message: errorMessage ?? ''); + return AtOnboardingDialog.showError( + context: context, message: errorMessage ?? ''); } bool skipTutorial() { @@ -437,13 +449,15 @@ class _AtOnboardingHomeScreenState extends State { if (widget.config.tutorialDisplay == AtOnboardingTutorialDisplay.always) { await Future.delayed(const Duration(milliseconds: 300)); _showTutorial(); - } else if (widget.config.tutorialDisplay == AtOnboardingTutorialDisplay.never) { + } else if (widget.config.tutorialDisplay == + AtOnboardingTutorialDisplay.never) { return; } else { final result = await AtOnboardingTutorialService.checkShowTutorial(); if (!result) { await Future.delayed(const Duration(milliseconds: 300)); - final result = await AtOnboardingTutorialService.hasShowTutorialSignIn(); + final result = + await AtOnboardingTutorialService.hasShowTutorialSignIn(); if (!result) { _showTutorial(); } @@ -477,7 +491,8 @@ class _AtOnboardingHomeScreenState extends State { await _checkShowTutorial(); } - Future _processAESKey(String? atsign, String? aesKey, String contents) async { + Future _processAESKey( + String? atsign, String? aesKey, String contents) async { dynamic authResponse; assert(aesKey != null || aesKey != ''); assert(atsign != null || atsign != ''); @@ -494,7 +509,8 @@ class _AtOnboardingHomeScreenState extends State { return; } - _onboardingService.setAtClientPreference = widget.config.atClientPreference; + _onboardingService.setAtClientPreference = + widget.config.atClientPreference; authResponse = await _onboardingService.authenticate( atsign, @@ -549,16 +565,22 @@ class _AtOnboardingHomeScreenState extends State { bool isExist = await _onboardingService.isExistingAtsign(atsign); if (isExist) { _inprogressDialog.close(); - await _showAlertDialog(AtOnboardingErrorToString().pairedAtsign(atsign)); + await _showAlertDialog( + AtOnboardingErrorToString().pairedAtsign(atsign)); return; } //Delay for waiting for ServerStatus change to teapot when activating an atsign await Future.delayed(const Duration(seconds: 10)); - _onboardingService.setAtClientPreference = widget.config.atClientPreference; + _onboardingService.setAtClientPreference = + widget.config.atClientPreference; - authResponse = await _onboardingService.authenticate(atsign, cramSecret: secret, status: widget.onboardStatus); + String? previousAtsign = _onboardingService.currentAtsign; + _onboardingService.setAtsign = atsign; + authResponse = await _onboardingService.onboard( + cramSecret: secret, + ); int round = 1; atSignStatus = await _onboardingService.checkAtSignServerStatus(atsign); @@ -574,6 +596,12 @@ class _AtOnboardingHomeScreenState extends State { } _inprogressDialog.close(); + + if (authResponse != AtOnboardingResponseStatus.authSuccess || + atSignStatus == ServerStatus.teapot) { + _onboardingService.setAtsign = previousAtsign; + } + if (authResponse == AtOnboardingResponseStatus.authSuccess) { if (atSignStatus == ServerStatus.teapot) { await _showAlertDialog( @@ -615,7 +643,8 @@ class _AtOnboardingHomeScreenState extends State { e, title: AtOnboardingLocalizations.current.msg_auth_failed, ); - } else if (e == AtOnboardingResponseStatus.serverNotReached && _isContinue) { + } else if (e == AtOnboardingResponseStatus.serverNotReached && + _isContinue) { await _processSharedSecret(atsign, secret); } else if (e == AtOnboardingResponseStatus.timeOut) { await _showAlertDialog( @@ -670,8 +699,10 @@ class _AtOnboardingHomeScreenState extends State { } Future _showAlertDialog(dynamic errorMessage, {String? title}) async { - String? messageString = AtOnboardingErrorToString().getErrorMessage(errorMessage); - return AtOnboardingDialog.showError(context: context, title: title, message: messageString); + String? messageString = + AtOnboardingErrorToString().getErrorMessage(errorMessage); + return AtOnboardingDialog.showError( + context: context, title: title, message: messageString); } void _showReferenceWebview() { @@ -717,7 +748,8 @@ class _AtOnboardingHomeScreenState extends State { } _isContinue = true; String? fileContents, aesKey, atsign; - FilePickerResult? result = await FilePicker.platform.pickFiles(type: FileType.any); + FilePickerResult? result = + await FilePicker.platform.pickFiles(type: FileType.any); if ((result?.files ?? []).isEmpty) { //User cancelled => do nothing return; @@ -745,7 +777,9 @@ class _AtOnboardingHomeScreenState extends State { for (ArchiveFile file in archive) { if (file.name.contains('atKeys')) { fileContents = String.fromCharCodes(file.content); - } else if (aesKey == null && atsign == null && file.name.contains('_private_key.png')) { + } else if (aesKey == null && + atsign == null && + file.name.contains('_private_key.png')) { List bytes = file.content as List; String path = (await path_provider.getTemporaryDirectory()).path; File file1 = await File('${path}test').create(); @@ -760,7 +794,9 @@ class _AtOnboardingHomeScreenState extends State { } } else if (pickedFile.name.contains('atKeys')) { fileContents = File(path.toString()).readAsStringSync(); - } else if (aesKey == null && atsign == null && pickedFile.name.contains('_private_key.png')) { + } else if (aesKey == null && + atsign == null && + pickedFile.name.contains('_private_key.png')) { //read scan QRcode and extract atsign,aeskey var result = decodeQrCode(path); @@ -783,7 +819,10 @@ class _AtOnboardingHomeScreenState extends State { } if (aesKey == null && atsign == null && fileContents != null) { List keyData = fileContents.split(',"@'); - List params = keyData[1].toString().substring(0, keyData[1].length - 2).split('":"'); + List params = keyData[1] + .toString() + .substring(0, keyData[1].length - 2) + .split('":"'); atsign = "@${params[0]}"; Map keyMap = jsonDecode(fileContents); aesKey = keyMap[AtOnboardingConstants.atSelfEncryptionKey]; @@ -794,8 +833,11 @@ class _AtOnboardingHomeScreenState extends State { loading = false; }); return; - } else if (OnboardingService.getInstance().formatAtSign(atsign) != _pairingAtsign && _pairingAtsign != null) { - await showErrorDialog(AtOnboardingErrorToString().atsignMismatch(_pairingAtsign)); + } else if (OnboardingService.getInstance().formatAtSign(atsign) != + _pairingAtsign && + _pairingAtsign != null) { + await showErrorDialog( + AtOnboardingErrorToString().atsignMismatch(_pairingAtsign)); setState(() { loading = false; }); @@ -841,7 +883,10 @@ class _AtOnboardingHomeScreenState extends State { // ignore: unnecessary_null_comparison if (aesKey == null && atsign == null && fileContents.isNotEmpty) { List keyData = fileContents.split(',"@'); - List params = keyData[1].toString().substring(0, keyData[1].length - 2).split('":"'); + List params = keyData[1] + .toString() + .substring(0, keyData[1].length - 2) + .split('":"'); atsign = "@${params[0]}"; Map keyMap = jsonDecode(fileContents); aesKey = keyMap[AtOnboardingConstants.atSelfEncryptionKey]; @@ -852,8 +897,11 @@ class _AtOnboardingHomeScreenState extends State { loading = false; }); return; - } else if (OnboardingService.getInstance().formatAtSign(atsign) != _pairingAtsign && _pairingAtsign != null) { - await showErrorDialog(AtOnboardingErrorToString().atsignMismatch(_pairingAtsign)); + } else if (OnboardingService.getInstance().formatAtSign(atsign) != + _pairingAtsign && + _pairingAtsign != null) { + await showErrorDialog( + AtOnboardingErrorToString().atsignMismatch(_pairingAtsign)); setState(() { loading = false; }); @@ -873,10 +921,14 @@ class _AtOnboardingHomeScreenState extends State { } bool _validatePickedFileContents(String fileContents) { - bool result = fileContents.contains(BackupKeyConstants.PKAM_PRIVATE_KEY_FROM_KEY_FILE) && - fileContents.contains(BackupKeyConstants.PKAM_PUBLIC_KEY_FROM_KEY_FILE) && - fileContents.contains(BackupKeyConstants.ENCRYPTION_PRIVATE_KEY_FROM_FILE) && - fileContents.contains(BackupKeyConstants.ENCRYPTION_PUBLIC_KEY_FROM_FILE) && + bool result = fileContents + .contains(BackupKeyConstants.PKAM_PRIVATE_KEY_FROM_KEY_FILE) && + fileContents + .contains(BackupKeyConstants.PKAM_PUBLIC_KEY_FROM_KEY_FILE) && + fileContents + .contains(BackupKeyConstants.ENCRYPTION_PRIVATE_KEY_FROM_FILE) && + fileContents + .contains(BackupKeyConstants.ENCRYPTION_PUBLIC_KEY_FROM_FILE) && fileContents.contains(BackupKeyConstants.SELF_ENCRYPTION_KEY_FROM_FILE); return result; } From d0b6f02b93d915fcbebf3eca68cafc8994ea2e98 Mon Sep 17 00:00:00 2001 From: xavierchanth Date: Tue, 26 Nov 2024 13:33:57 -0500 Subject: [PATCH 2/9] fix: don't show error on success --- .../lib/screen/at_onboarding_generate_screen.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart index 6f756282..cc7ef216 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart @@ -507,7 +507,7 @@ class _AtOnboardingGenerateScreenState await _showAlertDialog( AtOnboardingLocalizations.current.error_authenticated_failed, ); - } else { + } else if (authResponse != AtOnboardingResponseStatus.authSuccess) { await showErrorDialog( AtOnboardingLocalizations.current.msg_response_time_out, ); From 4a83f47a8ddf48e8b7a7416d86995c82fb04196e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 10:50:44 +0000 Subject: [PATCH 3/9] build(deps): bump the github-actions group with 2 updates Bumps the github-actions group with 2 updates: [subosito/flutter-action](https://github.com/subosito/flutter-action) and [github/codeql-action](https://github.com/github/codeql-action). Updates `subosito/flutter-action` from 2.17.0 to 2.18.0 - [Release notes](https://github.com/subosito/flutter-action/releases) - [Commits](https://github.com/subosito/flutter-action/compare/74af56c5ed2697ba4621264652728e8d217e53d3...f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff) Updates `github/codeql-action` from 3.27.5 to 3.27.6 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/f09c1c0a94de965c15400f5634aa42fac8fb8f88...aa578102511db1f4524ed59b8cc2bae4f6e88195) --- updated-dependencies: - dependency-name: subosito/flutter-action dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/melos_bootstrap.yaml | 2 +- .github/workflows/scorecards.yml | 2 +- .github/workflows/static_analysis.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/melos_bootstrap.yaml b/.github/workflows/melos_bootstrap.yaml index ecaae5c2..6bd0c899 100644 --- a/.github/workflows/melos_bootstrap.yaml +++ b/.github/workflows/melos_bootstrap.yaml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 # v2.17.0 + - uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # v2.18.0 with: channel: "stable" - name: flutter pub get diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index d9afeba4..dd59e3e5 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 + uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6 with: sarif_file: results.sarif diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index bdb0ba58..1b265bd5 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -40,7 +40,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 # v2.17.0 + - uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # v2.18.0 with: channel: "${{ matrix.flutter-channel}}" - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 From f455b8b0c0ca739b5ea5a3eb67525c81d96dd46a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:10:30 +0000 Subject: [PATCH 4/9] build(deps): bump the github-actions group with 2 updates Bumps the github-actions group with 2 updates: [github/codeql-action](https://github.com/github/codeql-action) and [actions/setup-go](https://github.com/actions/setup-go). Updates `github/codeql-action` from 3.27.6 to 3.27.7 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/aa578102511db1f4524ed59b8cc2bae4f6e88195...babb554ede22fd5605947329c4d04d8e7a0b8155) Updates `actions/setup-go` from 5.1.0 to 5.2.0 - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed...3041bf56c941b39c61721a86cd11f3bb1338122a) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/scorecards.yml | 2 +- .github/workflows/static_analysis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index dd59e3e5..b9e39188 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6 + uses: github/codeql-action/upload-sarif@babb554ede22fd5605947329c4d04d8e7a0b8155 # v3.27.7 with: sarif_file: results.sarif diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 1b265bd5..e7c0cf6f 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -43,7 +43,7 @@ jobs: - uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # v2.18.0 with: channel: "${{ matrix.flutter-channel}}" - - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: 'stable' cache-dependency-path: tools/osv-scanner/go.sum From 7e84969a76bb29abac6defa3658c674c2f070043 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 10:57:51 +0000 Subject: [PATCH 5/9] build(deps): bump github/codeql-action in the github-actions group Bumps the github-actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action). Updates `github/codeql-action` from 3.27.7 to 3.27.9 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/babb554ede22fd5605947329c4d04d8e7a0b8155...df409f7d9260372bd5f19e5b04e83cb3c43714ae) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index b9e39188..707003c1 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@babb554ede22fd5605947329c4d04d8e7a0b8155 # v3.27.7 + uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9 with: sarif_file: results.sarif From 5a84d2b2a9892ff1e55c6109b73fbf0bf1d5e4f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:59:50 +0000 Subject: [PATCH 6/9] build(deps): bump actions/upload-artifact in the github-actions group Bumps the github-actions group with 1 update: [actions/upload-artifact](https://github.com/actions/upload-artifact). Updates `actions/upload-artifact` from 4.4.3 to 4.5.0 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882...6f51ac03b9356f520e9adb1b1b7802705f340c2b) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 707003c1..9bf5d8c8 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -59,7 +59,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: SARIF file path: results.sarif From 585ddf6d0ce68a0327d568f14eed1aa720858c2b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 10:02:19 +0000 Subject: [PATCH 7/9] build(deps): bump github/codeql-action in the github-actions group Bumps the github-actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action). Updates `github/codeql-action` from 3.27.9 to 3.28.0 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/df409f7d9260372bd5f19e5b04e83cb3c43714ae...48ab28a6f5dbc2a99bf1e0131198dd8f1df78169) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 9bf5d8c8..b5413fc5 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9 + uses: github/codeql-action/upload-sarif@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 with: sarif_file: results.sarif From f1aecfb612cce6ef0baaf55ba505ea673f82dc1c Mon Sep 17 00:00:00 2001 From: Doug Todd Date: Mon, 6 Jan 2025 14:19:48 +0000 Subject: [PATCH 8/9] fix: Removed loading spinner logic when selecting atsign after activation fix: formatting --- .../example/ios/Podfile.lock | 34 ++--- .../screen/at_onboarding_accounts_screen.dart | 140 +++++++++--------- .../screen/at_onboarding_activate_screen.dart | 2 - .../screen/at_onboarding_generate_screen.dart | 1 - 4 files changed, 84 insertions(+), 93 deletions(-) diff --git a/packages/at_onboarding_flutter/example/ios/Podfile.lock b/packages/at_onboarding_flutter/example/ios/Podfile.lock index d3e09e90..648f6400 100644 --- a/packages/at_onboarding_flutter/example/ios/Podfile.lock +++ b/packages/at_onboarding_flutter/example/ios/Podfile.lock @@ -138,29 +138,29 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/webview_flutter_wkwebview/darwin" SPEC CHECKSUMS: - at_backupkey_flutter: 2fc3d01138175e41bce8b574387a47544c53e01b - at_file_saver: c0e052c72d8c0296318bd70f2ae7f510887014ce - at_onboarding_flutter: e8219b6d0bfb236d3837ec3528871aebdcc56e8d - biometric_storage: 1400f1382af3a4cc2bf05340e13c3d8de873ceb9 - device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d + at_backupkey_flutter: 48921a75415718560c801a16374cd504b714c5aa + at_file_saver: 7341b40c09bde071008a40555d3e38fa0646e65e + at_onboarding_flutter: 2cbfcd94971fed75fb1360871481381e5fa51998 + biometric_storage: 662167ef947fba48891850f0b3042f892a839e9a + device_info_plus: 71ffc6ab7634ade6267c7a93088ed7e4f74e5896 DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 - file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655 - file_selector_ios: f0670c1064a8c8450e38145d8043160105d0b97c + file_picker: 9b3292d7c8bc68c8a7bf8eb78f730e49c8efc517 + file_selector_ios: f92e583d43608aebc2e4a18daac30b8902845502 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - flutter_keychain: 01aabf894ffe8b01adfda1d9df21c210c1b4b452 + flutter_keychain: 082382ca04745cc72ed13aa3598c151bb2eb426b MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb - package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c - path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 - permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 - qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e + package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499 + path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 + permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d + qr_code_scanner: d77f94ecc9abf96d9b9b8fc04ef13f611e5a147a SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866 - share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad - shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 + share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a + shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7 SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780 - url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe - webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4 + url_launcher_ios: 694010445543906933d732453a59da0a173ae33d + webview_flutter_wkwebview: 44d4dee7d7056d5ad185d25b38404436d56c547c PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048 -COCOAPODS: 1.14.3 +COCOAPODS: 1.16.2 diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_accounts_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_accounts_screen.dart index 62a4d92b..05c1e9cd 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_accounts_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_accounts_screen.dart @@ -27,10 +27,12 @@ class AtOnboardingAccountsScreen extends StatefulWidget { }) : super(key: key); @override - State createState() => _AtOnboardingAccountsScreenState(); + State createState() => + _AtOnboardingAccountsScreenState(); } -class _AtOnboardingAccountsScreenState extends State { +class _AtOnboardingAccountsScreenState + extends State { List pairedAtsignsList = []; Object? lastSelectedIndex; late int greyStartIndex; @@ -66,80 +68,68 @@ class _AtOnboardingAccountsScreenState extends State ), body: Padding( padding: const EdgeInsets.all(16), - child: pairedAtsignsList.isEmpty - ? Center( - child: Column( - children: [ - CircularProgressIndicator(valueColor: AlwaysStoppedAnimation(theme.primaryColor)), - Text( - AtOnboardingLocalizations.current.loading_atSigns, - style: const TextStyle( - fontSize: AtOnboardingDimens.fontLarge, - fontWeight: FontWeight.bold, - ), - ), - ], - ), + child: Column( + children: [ + Text( + widget.message ?? + AtOnboardingLocalizations.current.title_select_atSign, + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: AtOnboardingDimens.fontNormal, + ), + ), + const SizedBox(height: 10), + if (widget.newAtsign != null) ...[ + const Divider(thickness: 0.8), + RadioListTile( + controlAffinity: ListTileControlAffinity.trailing, + groupValue: lastSelectedIndex, + onChanged: (Object? value) { + setState(() { + lastSelectedIndex = value; + }); + _showAlert(widget.newAtsign!, context); + }, + value: 'new', + activeColor: theme.primaryColor, + title: Text('@${widget.newAtsign}', + style: const TextStyle(fontWeight: FontWeight.bold)), ) - : Column( - children: [ - Text( - widget.message ?? AtOnboardingLocalizations.current.title_select_atSign, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: AtOnboardingDimens.fontNormal, - ), - ), - const SizedBox(height: 10), - if (widget.newAtsign != null) ...[ - const Divider(thickness: 0.8), - RadioListTile( + ], + const Divider(thickness: 0.8), + Expanded( + child: ListView.builder( + itemCount: widget.atsigns.length, + itemBuilder: (BuildContext context, int index) { + String currentItem = '@${widget.atsigns[index]}'; + bool isExist = pairedAtsignsList.contains(currentItem); + return Padding( + padding: const EdgeInsets.symmetric(vertical: 2.0), + child: RadioListTile( controlAffinity: ListTileControlAffinity.trailing, groupValue: lastSelectedIndex, - onChanged: (Object? value) { - setState(() { - lastSelectedIndex = value; - }); - _showAlert(widget.newAtsign!, context); - }, - value: 'new', + onChanged: isExist + ? null + : (Object? value) { + setState(() { + lastSelectedIndex = value; + }); + _showAlert( + widget.atsigns[ + int.parse(lastSelectedIndex.toString())], + context, + ); + }, + value: index, activeColor: theme.primaryColor, - title: Text('@${widget.newAtsign}', style: const TextStyle(fontWeight: FontWeight.bold)), - ) - ], - const Divider(thickness: 0.8), - Expanded( - child: ListView.builder( - itemCount: widget.atsigns.length, - itemBuilder: (BuildContext context, int index) { - String currentItem = '@${widget.atsigns[index]}'; - bool isExist = pairedAtsignsList.contains(currentItem); - return Padding( - padding: const EdgeInsets.symmetric(vertical: 2.0), - child: RadioListTile( - controlAffinity: ListTileControlAffinity.trailing, - groupValue: lastSelectedIndex, - onChanged: isExist - ? null - : (Object? value) { - setState(() { - lastSelectedIndex = value; - }); - _showAlert( - widget.atsigns[int.parse(lastSelectedIndex.toString())], - context, - ); - }, - value: index, - activeColor: theme.primaryColor, - title: Text(currentItem), - ), - ); - }, + title: Text(currentItem), ), - ), - ], + ); + }, ), + ), + ], + ), ), ), ); @@ -163,11 +153,15 @@ class _AtOnboardingAccountsScreenState extends State style: theme.textTheme.bodyLarge, children: [ TextSpan( - text: AtOnboardingLocalizations.current.title_pair_atSign_prev, + text: + AtOnboardingLocalizations.current.title_pair_atSign_prev, ), - TextSpan(text: ' $atsign ', style: const TextStyle(fontWeight: FontWeight.bold)), TextSpan( - text: AtOnboardingLocalizations.current.title_pair_atSign_next, + text: ' $atsign ', + style: const TextStyle(fontWeight: FontWeight.bold)), + TextSpan( + text: + AtOnboardingLocalizations.current.title_pair_atSign_next, ) ], ), diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_activate_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_activate_screen.dart index c3e6ee2b..9feeaa04 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_activate_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_activate_screen.dart @@ -1,8 +1,6 @@ import 'dart:convert'; import 'dart:io'; -import 'package:at_auth/at_auth.dart'; -import 'package:at_client_mobile/at_client_mobile.dart'; import 'package:at_onboarding_flutter/at_onboarding_result.dart'; import 'package:at_onboarding_flutter/localizations/generated/l10n.dart'; import 'package:at_onboarding_flutter/screen/at_onboarding_backup_screen.dart'; diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart index cc7ef216..119823db 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart @@ -455,7 +455,6 @@ class _AtOnboardingGenerateScreenState required String secret, }) async { dynamic authResponse; - String cramSecret = secret.split(':').last; String verifiedAtSign = atSign.startsWith('@') ? atSign : '@$atSign'; try { From 73d8201d4303ae596212b6e18c4f8209d8761f88 Mon Sep 17 00:00:00 2001 From: Doug Todd Date: Mon, 6 Jan 2025 15:14:18 +0000 Subject: [PATCH 9/9] fix: Fixed navigational logic after a user is onboarded Bug was that it would always show that the process had timed out. Now the user is correctly taken to the backup screen. --- .../screen/at_onboarding_generate_screen.dart | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart b/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart index 119823db..fdb5978f 100644 --- a/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart +++ b/packages/at_onboarding_flutter/lib/screen/at_onboarding_generate_screen.dart @@ -450,11 +450,10 @@ class _AtOnboardingGenerateScreenState ); } - Future _processSharedSecret({ + Future _processSharedSecret({ required String atSign, required String secret, }) async { - dynamic authResponse; String verifiedAtSign = atSign.startsWith('@') ? atSign : '@$atSign'; try { @@ -475,14 +474,15 @@ class _AtOnboardingGenerateScreenState String? previousAtsign = _onboardingService.currentAtsign; _onboardingService.setAtsign = verifiedAtSign; - authResponse = await _onboardingService.onboard( + + final authResponse = await _onboardingService.onboard( cramSecret: secret, ); _inprogressDialog.close(); - if (authResponse == AtOnboardingResponseStatus.authSuccess) { + if (authResponse) { if (!mounted) return; - Navigator.push( + await Navigator.push( context, MaterialPageRoute( builder: (_) => AtOnboardingBackupScreen( @@ -493,23 +493,14 @@ class _AtOnboardingGenerateScreenState if (!mounted) return; Navigator.pop( - context, AtOnboardingResult.success(atsign: verifiedAtSign)); + context, + AtOnboardingResult.success(atsign: verifiedAtSign), + ); } else { _onboardingService.setAtsign = previousAtsign; - } - - if (authResponse == AtOnboardingResponseStatus.serverNotReached) { - await _showAlertDialog( - AtOnboardingLocalizations.current.msg_atSign_unreachable, - ); - } else if (authResponse == AtOnboardingResponseStatus.authFailed) { await _showAlertDialog( AtOnboardingLocalizations.current.error_authenticated_failed, ); - } else if (authResponse != AtOnboardingResponseStatus.authSuccess) { - await showErrorDialog( - AtOnboardingLocalizations.current.msg_response_time_out, - ); } } catch (e) { _inprogressDialog.close(); @@ -531,7 +522,6 @@ class _AtOnboardingGenerateScreenState ); } } - return authResponse; } Future _showAlertDialog(dynamic errorMessage, {String? title}) async {