Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: atSign activation #948

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open

fix: atSign activation #948

wants to merge 2 commits into from

Conversation

XavierChanth
Copy link
Member

- What I did

  • Changed activation references to use onboard method instead of authenticate method
  • Fixed a regression to revert back to the original atSign when activation fails

- How I did it

- How to verify it

  • Ran the example app with a valid api key in .env
  • Activated an atSign by OTP

- Description for the changelog
fix: atSign activation

atSignStatus == ServerStatus.teapot) {
_onboardingService.setAtsign = previousAtsign;
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual change for this file is here, the rest is formatting from 120 to 80, as this is a published package. (559 old file : 604 new file)

Comment on lines -222 to +228
authResponse = await _onboardingService.authenticate(atsign,
cramSecret: secret, status: OnboardingStatus.ACTIVATE);
String? previousAtsign = _onboardingService.currentAtsign;
_onboardingService.setAtsign = atsign;
authResponse = await _onboardingService.onboard(
cramSecret: secret,
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to onboard

Comment on lines +243 to +247
if (authResponse != AtOnboardingResponseStatus.authSuccess ||
atSignStatus == ServerStatus.teapot) {
_onboardingService.setAtsign = previousAtsign;
}

Copy link
Member Author

@XavierChanth XavierChanth Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert to previous atsign on a failed activation (authSuccess + teapot at this point is considered a timeout failure)

Comment on lines -477 to +482
authResponse = await _onboardingService.authenticate(
verifiedAtSign,
cramSecret: cramSecret,
status: OnboardingStatus.ACTIVATE,
String? previousAtsign = _onboardingService.currentAtsign;
_onboardingService.setAtsign = verifiedAtSign;
authResponse = await _onboardingService.onboard(
cramSecret: secret,
);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Comment on lines -497 to +502
} else if (authResponse == AtOnboardingResponseStatus.serverNotReached) {
} else {
_onboardingService.setAtsign = previousAtsign;
}

if (authResponse == AtOnboardingResponseStatus.serverNotReached) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as revert above, slightly different semantic structure in this part of the code, so the change looks different

await _showAlertDialog(
AtOnboardingLocalizations.current.msg_atSign_unreachable,
);
} else if (authResponse == AtOnboardingResponseStatus.authFailed) {
await _showAlertDialog(
AtOnboardingLocalizations.current.error_authenticated_failed,
);
} else {
} else if (authResponse != AtOnboardingResponseStatus.authSuccess) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

breaking the if-else chain requires an explicit check for non-success on our catch-all error check

Comment on lines -85 to +88
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;
Copy link
Member Author

@XavierChanth XavierChanth Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was misformatted, corrected from 120 to 80, I've marked the actual changes with a comment near line 600

Copy link
Contributor

@CurtlyCritchlow CurtlyCritchlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@gkc gkc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@gkc gkc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops spoke too soon ... one of the 'stable' checks is failing https://github.com/atsign-foundation/at_widgets/actions/runs/12036898481/job/33559158729?pr=948

Analyzing at_onboarding_flutter...                              

warning • Unused import: 'package:at_auth/at_auth.dart' • lib/screen/at_onboarding_activate_screen.dart:4:8 • unused_import
warning • Unused import: 'package:at_client_mobile/at_client_mobile.dart' • lib/screen/at_onboarding_activate_screen.dart:5:8 • unused_import
warning • The value of the local variable 'cramSecret' isn't used • lib/screen/at_onboarding_generate_screen.dart:458:12 • unused_local_variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants