Skip to content

Conversation

XavierChanth
Copy link
Member

@XavierChanth XavierChanth commented Jun 17, 2025

- What I did

  • Added a cram auth screen to the app
  • Added a button to use cram auth instead from the otp screen
  • Automatic fallback to cram screen when registrar url / api key is missing
  • Added a starter flatpak setup for testing, since I'm testing from linux
  • Added command-line parser to NoPorts Desktop, which takes 3 flags/options:
    • help
    • register-root - register a new root domain / registrar / apiKey into the app
    • no-include-default-roots - removes the default roots from the app
      (root.atsign.org & vip.ve.atsign.zone)
  • fixed an onboarding bug in the dedicated branch of at_onboarding_flutter for NoPorts:
    atsign-foundation/at_widgets@1e244eb
    • We also pass in the appropriate variables related to the bug in this function.
  • Disable the Try test profile widget when not onboarded with a prod atSign.

When registering a root it is useful to note that only the domain and description are required. When registrarUrl / apiKey is missing for a root, the app will fallback to the new cram screen.

- How I did it

- How to verify it

Tested cram activation with prod. Tested register-root via staging.

How to test this branch:

  1. Checkout the branch
  2. cd packages/dart/npt_flutter && flutter pub get
  3. Build in release mode: flutter build <OS> --release
  4. Run the release via command-line with these arguments for NoPorts to add staging to the list of root-domains in the app:
    npt_flutter --register-root 'domain:root.atsign.wtf;description:Staging'
    You may also replace the root's values with a private environment or add another, comma separated:
    npt_flutter --register-root 'domain:my.private.root.wtf;description:My private root'
    or
npt_flutter --register-root \
'domain:root.atsign.wtf;description:Staging,domain:my.private.root.wtf;description:My private root'
  1. Test production without OTP:
    5.1. Enter an unactivated prod atSign with prod root-domain set
    5.2. Click the option below the pin code form to "use a license key instead"
    5.3. Copy the cram key from the registrar
    5.4. Paste the cram key
    5.5. Ensure activation was successful
  2. Test staging with CRAM
    6.1. Enter an unactivated staging atSign with staging root-domain set
    6.2. Copy the cram key from the registrar
    6.3. Paste the cram key
    6.4. Ensure activation was successful

Note that as of this update, there is no code in NoPorts Desktop that implies staging should work, thus staging serves as a suitable test for a private environment. There are some uses of the staging url in other dependencies, but they should be ignored at this point, since NoPorts should be passing explicit values in all of these places.

- Description for the changelog
feat: Noports desktop cram auth

@XavierChanth XavierChanth force-pushed the noports-desktop-cram-auth branch 6 times, most recently from 1c17e15 to ef503f6 Compare June 23, 2025 23:29
@XavierChanth XavierChanth requested review from gkc and cpswan June 23, 2025 23:37
@XavierChanth XavierChanth marked this pull request as ready for review June 23, 2025 23:37
Copy link
Member Author

Choose a reason for hiding this comment

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

renamed to activate_otp_dialog.dart, with some minor modifications to reflect the changes in 'constants.dart'

Comment on lines 250 to 262
builder: (context) => (root?.registrarUrl == null || apiKey == null)
? ActivateCramDialog(
atSign: atsign,
config: util.config,
onboardingUtil: util,
)
: ActivateOtpDialog(
atSign: atsign,
apiKey: apiKey,
config: util.config,
registrarUrl: root!.registrarUrl!,
onboardingUtil: util,
waitForTeapot: initialStatus != AtSignStatus.teapot,
),
Copy link
Member Author

Choose a reason for hiding this comment

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

Here's where we pick the activation screen based on whether apikey & reg url are known or not.

Copy link
Member Author

@XavierChanth XavierChanth Jun 23, 2025

Choose a reason for hiding this comment

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

For localization:

I sorted with the unix sort command, which has changed the order in instances where: "yaml" and "yamlRecommended" occur. However it was previously sorted, had a different sort order for " vs alpha.

The three new entries are:

  • "orSpace"
  • "activateUsingLicense"
  • "typePasteLicense"

@@ -1,5 +1,5 @@
# Project-level configuration.
Copy link
Member Author

Choose a reason for hiding this comment

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

regenerated the linux directory with flutter create.

${TARGET}
PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>"
)
target_compile_options(${TARGET} PRIVATE -Wno-error=deprecated-declarations) # Allow deprecated warnings for tray_manager package
Copy link
Member Author

Choose a reason for hiding this comment

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

This line is added to allow builds despite usage of a deprecated libadwaita api in the tray_manager plugin.

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
Copy link
Member Author

Choose a reason for hiding this comment

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

This script isn't 100% finished, but my changeset for this was mixed in with the cram auth work, so I'm pushing with intention to complete at a later point.

@@ -0,0 +1,42 @@
id: com.atsign.NoPortsDesktop
Copy link
Member Author

Choose a reason for hiding this comment

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

spec to generate a flatpak manifest from.

@XavierChanth XavierChanth marked this pull request as draft June 24, 2025 13:28
@XavierChanth
Copy link
Member Author

Converted back to draft to test a few more edge cases.

@XavierChanth XavierChanth force-pushed the noports-desktop-cram-auth branch 2 times, most recently from ffb81d6 to 0a6c599 Compare June 24, 2025 21:01
@XavierChanth
Copy link
Member Author

XavierChanth commented Jun 24, 2025

Related commit in at_onboarding_flutter: atsign-foundation/at_widgets@1e244eb

@XavierChanth XavierChanth self-assigned this Jun 24, 2025
@XavierChanth XavierChanth marked this pull request as ready for review June 24, 2025 21:06
@XavierChanth XavierChanth requested a review from cconstab June 24, 2025 21:18
Comment on lines +59 to +76
{
"name": "NoPorts Desktop Staging",
"type": "dart",
"request": "launch",
"program": "packages/dart/npt_flutter/lib/main.dart",
"args": [
"--debug",
"-a",
"--register-root",
"-a",
"domain:root.atsign.wtf;description:Staging",
"-a",
"--register-root",
"-a",
"domain:fake.atsign.wtf;description:fake",
"-a",
"--no-include-default-roots"
]
Copy link
Member Author

Choose a reason for hiding this comment

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

Debugging profile against staging for NoPorts Desktop

Comment on lines +250 to +262
builder: (context) => (root?.registrarUrl == null || apiKey == null)
? ActivateCramDialog(
atSign: atsign,
config: util.config,
)
: ActivateOtpDialog(
atSign: atsign,
apiKey: apiKey,
config: util.config,
registrarUrl: root!.registrarUrl!,
onboardingUtil: util,
waitForTeapot: initialStatus != AtSignStatus.teapot,
),
Copy link
Member Author

Choose a reason for hiding this comment

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

Where we determine whether to show OTP or CRAM screen immediately

Comment on lines +67 to +72
if (_showCram) {
return ActivateCramDialog(
atSign: widget.atSign,
config: widget.config,
);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

OTP screen has an internal switch to show the cram screen instead

Comment on lines 199 to 200
ref: at_onboarding_flutter_layers
resolved-ref: "3b22ed2d8608b11203d7a3fa767d5a64406eef01"
ref: "1e244eb5f522d31d9d0eb3c67990d7d6bd612446"
resolved-ref: "1e244eb5f522d31d9d0eb3c67990d7d6bd612446"
Copy link
Member Author

Choose a reason for hiding this comment

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

New commit in at_onboarding_flutter layers, I've switched to using the commit ref, because pub doesn't check the remote for new changes on a branch, nor should it to be fair. Pinning to a commit is safer, and ensures that pub fetches new changes when we tell it to.

Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops, please ignore this, deprecated app, so it doesn't really matter. I accidentally ran pub get in this package.

@@ -9,6 +9,8 @@ import 'package:at_onboarding_flutter/src/utils/at_onboarding_response_status.da
import 'package:at_server_status/at_server_status.dart';
import 'package:http/http.dart';
import 'package:http/io_client.dart';
// ignore: implementation_imports
import 'package:at_onboarding_flutter/src/utils/at_onboarding_app_constants.dart';
Copy link
Member Author

Choose a reason for hiding this comment

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

This is exposed so we can set the root domain in one of the places in at_onboarding_flutter

@XavierChanth XavierChanth force-pushed the noports-desktop-cram-auth branch from 0a6c599 to 9e3f5eb Compare June 25, 2025 11:41
@XavierChanth XavierChanth marked this pull request as draft June 26, 2025 12:14
@XavierChanth XavierChanth force-pushed the noports-desktop-cram-auth branch 2 times, most recently from f0673ba to 0396443 Compare July 1, 2025 17:03
@XavierChanth XavierChanth force-pushed the noports-desktop-cram-auth branch from 3adaccf to ef2c682 Compare July 3, 2025 18:08
@XavierChanth XavierChanth marked this pull request as ready for review July 8, 2025 18:13
gkc
gkc previously approved these changes Jul 8, 2025
@XavierChanth XavierChanth force-pushed the noports-desktop-cram-auth branch 4 times, most recently from 0b97b1f to e74d0e8 Compare July 29, 2025 20:10
@XavierChanth XavierChanth force-pushed the noports-desktop-cram-auth branch 2 times, most recently from d0a48f1 to b689a3b Compare July 31, 2025 19:51
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.

2 participants