Skip to content

Commit

Permalink
Add Choose a security key -page
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnurmi committed Oct 19, 2021
1 parent cdf76d1 commit d347e6b
Show file tree
Hide file tree
Showing 19 changed files with 724 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/ubuntu_desktop_installer/lib/installer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class _UbuntuDesktopInstallerWizardState
Routes.updatesOtherSoftware: UpdatesOtherSoftwarePage.create,
if (model.hasSecureBoot)
Routes.configureSecureBoot: ConfigureSecureBootPage.create,
if (model.hasEncryption)
Routes.chooseSecurityKey: ChooseSecurityKeyPage.create,
if (model.hasBitLocker)
Routes.turnOffBitlocker: TurnOffBitLockerPage.create,
Routes.installationType: InstallationTypePage.create,
Expand Down Expand Up @@ -139,6 +141,8 @@ class _UbuntuDesktopInstallerModel extends ChangeNotifier {
bool get hasBitLocker => _hasBitLocker;
// TODO: add secure boot support
bool get hasSecureBoot => false;
// TODO: add encryption support
bool get hasEncryption => false;

Future<void> init() {
return Future.wait([
Expand Down
14 changes: 14 additions & 0 deletions packages/ubuntu_desktop_installer/lib/l10n/app_en_US.arb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@
"installThirdPartyTitle": "Install third-party software for graphics and Wi-Fi hardware, as well as additional media formats",
"installThirdPartySubtitle": "This software is subject to license terms included with its documentation. Some are proprietary.",

"chooseSecurityKeyTitle": "Choose a security key",
"chooseSecurityKeyHeader": "Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.\n\nAny files outside of Ubuntu will not be encrypted.",
"chooseSecurityKeyHint": "Choose a security key",
"chooseSecurityKeyConfirmHint": "Confirm the security key",
"chooseSecurityKeyRequired": "A security key is required",
"chooseSecurityKeyMismatch": "The security keys do not match",
"chooseSecurityKeyWarning": "<font color=\"{color}\">Warning</font>: If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.",
"@chooseSecurityKeyWarning": {
"type": "text",
"placeholders": {
"color": {}
}
},

"installationTypeTitle": "Installation type",
"installationTypeOSDetected": "This computer currently has {os} on it. What would you like to do?",
"@installationTypeOSDetected": {
Expand Down
42 changes: 42 additions & 0 deletions packages/ubuntu_desktop_installer/lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,48 @@ abstract class AppLocalizations {
/// **'This software is subject to license terms included with its documentation. Some are proprietary.'**
String get installThirdPartySubtitle;

/// No description provided for @chooseSecurityKeyTitle.
///
/// In en_US, this message translates to:
/// **'Choose a security key'**
String get chooseSecurityKeyTitle;

/// No description provided for @chooseSecurityKeyHeader.
///
/// In en_US, this message translates to:
/// **'Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.\n\nAny files outside of Ubuntu will not be encrypted.'**
String get chooseSecurityKeyHeader;

/// No description provided for @chooseSecurityKeyHint.
///
/// In en_US, this message translates to:
/// **'Choose a security key'**
String get chooseSecurityKeyHint;

/// No description provided for @chooseSecurityKeyConfirmHint.
///
/// In en_US, this message translates to:
/// **'Confirm the security key'**
String get chooseSecurityKeyConfirmHint;

/// No description provided for @chooseSecurityKeyRequired.
///
/// In en_US, this message translates to:
/// **'A security key is required'**
String get chooseSecurityKeyRequired;

/// No description provided for @chooseSecurityKeyMismatch.
///
/// In en_US, this message translates to:
/// **'The security keys do not match'**
String get chooseSecurityKeyMismatch;

/// No description provided for @chooseSecurityKeyWarning.
///
/// In en_US, this message translates to:
/// **'<font color=\"{color}\">Warning</font>: If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.'**
String chooseSecurityKeyWarning(Object color);

/// No description provided for @installationTypeTitle.
///
/// In en_US, this message translates to:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,29 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get installThirdPartySubtitle => 'This software is subject to license terms included with its documentation. Some are proprietary.';

@override
String get chooseSecurityKeyTitle => 'Choose a security key';

@override
String get chooseSecurityKeyHeader => 'Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.\n\nAny files outside of Ubuntu will not be encrypted.';

@override
String get chooseSecurityKeyHint => 'Choose a security key';

@override
String get chooseSecurityKeyConfirmHint => 'Confirm the security key';

@override
String get chooseSecurityKeyRequired => 'A security key is required';

@override
String get chooseSecurityKeyMismatch => 'The security keys do not match';

@override
String chooseSecurityKeyWarning(Object color) {
return '<font color=\"$color\">Warning</font>: If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.';
}

@override
String get installationTypeTitle => 'Installation type';

Expand Down Expand Up @@ -633,6 +656,29 @@ class AppLocalizationsEnUs extends AppLocalizationsEn {
@override
String get installThirdPartySubtitle => 'This software is subject to license terms included with its documentation. Some are proprietary.';

@override
String get chooseSecurityKeyTitle => 'Choose a security key';

@override
String get chooseSecurityKeyHeader => 'Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.\n\nAny files outside of Ubuntu will not be encrypted.';

@override
String get chooseSecurityKeyHint => 'Choose a security key';

@override
String get chooseSecurityKeyConfirmHint => 'Confirm the security key';

@override
String get chooseSecurityKeyRequired => 'A security key is required';

@override
String get chooseSecurityKeyMismatch => 'The security keys do not match';

@override
String chooseSecurityKeyWarning(Object color) {
return '<font color=\"$color\">Warning</font>: If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.';
}

@override
String get installationTypeTitle => 'Installation type';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,29 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get installThirdPartySubtitle => 'This software is subject to license terms included with its documentation. Some are proprietary.';

@override
String get chooseSecurityKeyTitle => 'Choose a security key';

@override
String get chooseSecurityKeyHeader => 'Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.\n\nAny files outside of Ubuntu will not be encrypted.';

@override
String get chooseSecurityKeyHint => 'Choose a security key';

@override
String get chooseSecurityKeyConfirmHint => 'Confirm the security key';

@override
String get chooseSecurityKeyRequired => 'A security key is required';

@override
String get chooseSecurityKeyMismatch => 'The security keys do not match';

@override
String chooseSecurityKeyWarning(Object color) {
return '<font color=\"$color\">Warning</font>: If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.';
}

@override
String get installationTypeTitle => 'Installation type';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,29 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get installThirdPartySubtitle => 'This software is subject to license terms included with its documentation. Some are proprietary.';

@override
String get chooseSecurityKeyTitle => 'Choose a security key';

@override
String get chooseSecurityKeyHeader => 'Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.\n\nAny files outside of Ubuntu will not be encrypted.';

@override
String get chooseSecurityKeyHint => 'Choose a security key';

@override
String get chooseSecurityKeyConfirmHint => 'Confirm the security key';

@override
String get chooseSecurityKeyRequired => 'A security key is required';

@override
String get chooseSecurityKeyMismatch => 'The security keys do not match';

@override
String chooseSecurityKeyWarning(Object color) {
return '<font color=\"$color\">Warning</font>: If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.';
}

@override
String get installationTypeTitle => 'Installation type';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,29 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get installThirdPartySubtitle => 'This software is subject to license terms included with its documentation. Some are proprietary.';

@override
String get chooseSecurityKeyTitle => 'Choose a security key';

@override
String get chooseSecurityKeyHeader => 'Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.\n\nAny files outside of Ubuntu will not be encrypted.';

@override
String get chooseSecurityKeyHint => 'Choose a security key';

@override
String get chooseSecurityKeyConfirmHint => 'Confirm the security key';

@override
String get chooseSecurityKeyRequired => 'A security key is required';

@override
String get chooseSecurityKeyMismatch => 'The security keys do not match';

@override
String chooseSecurityKeyWarning(Object color) {
return '<font color=\"$color\">Warning</font>: If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.';
}

@override
String get installationTypeTitle => 'Installation type';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,29 @@ class AppLocalizationsNl extends AppLocalizations {
@override
String get installThirdPartySubtitle => 'This software is subject to license terms included with its documentation. Some are proprietary.';

@override
String get chooseSecurityKeyTitle => 'Choose a security key';

@override
String get chooseSecurityKeyHeader => 'Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.\n\nAny files outside of Ubuntu will not be encrypted.';

@override
String get chooseSecurityKeyHint => 'Choose a security key';

@override
String get chooseSecurityKeyConfirmHint => 'Confirm the security key';

@override
String get chooseSecurityKeyRequired => 'A security key is required';

@override
String get chooseSecurityKeyMismatch => 'The security keys do not match';

@override
String chooseSecurityKeyWarning(Object color) {
return '<font color=\"$color\">Warning</font>: If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.';
}

@override
String get installationTypeTitle => 'Installation type';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,29 @@ class AppLocalizationsOc extends AppLocalizations {
@override
String get installThirdPartySubtitle => 'This software is subject to license terms included with its documentation. Some are proprietary.';

@override
String get chooseSecurityKeyTitle => 'Choose a security key';

@override
String get chooseSecurityKeyHeader => 'Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.\n\nAny files outside of Ubuntu will not be encrypted.';

@override
String get chooseSecurityKeyHint => 'Choose a security key';

@override
String get chooseSecurityKeyConfirmHint => 'Confirm the security key';

@override
String get chooseSecurityKeyRequired => 'A security key is required';

@override
String get chooseSecurityKeyMismatch => 'The security keys do not match';

@override
String chooseSecurityKeyWarning(Object color) {
return '<font color=\"$color\">Warning</font>: If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.';
}

@override
String get installationTypeTitle => 'Installation type';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,29 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get installThirdPartySubtitle => 'This software is subject to license terms included with its documentation. Some are proprietary.';

@override
String get chooseSecurityKeyTitle => 'Choose a security key';

@override
String get chooseSecurityKeyHeader => 'Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.\n\nAny files outside of Ubuntu will not be encrypted.';

@override
String get chooseSecurityKeyHint => 'Choose a security key';

@override
String get chooseSecurityKeyConfirmHint => 'Confirm the security key';

@override
String get chooseSecurityKeyRequired => 'A security key is required';

@override
String get chooseSecurityKeyMismatch => 'The security keys do not match';

@override
String chooseSecurityKeyWarning(Object color) {
return '<font color=\"$color\">Warning</font>: If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.';
}

@override
String get installationTypeTitle => 'Installation type';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,29 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get installThirdPartySubtitle => 'This software is subject to license terms included with its documentation. Some are proprietary.';

@override
String get chooseSecurityKeyTitle => 'Choose a security key';

@override
String get chooseSecurityKeyHeader => 'Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.\n\nAny files outside of Ubuntu will not be encrypted.';

@override
String get chooseSecurityKeyHint => 'Choose a security key';

@override
String get chooseSecurityKeyConfirmHint => 'Confirm the security key';

@override
String get chooseSecurityKeyRequired => 'A security key is required';

@override
String get chooseSecurityKeyMismatch => 'The security keys do not match';

@override
String chooseSecurityKeyWarning(Object color) {
return '<font color=\"$color\">Warning</font>: If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.';
}

@override
String get installationTypeTitle => 'Installation type';

Expand Down
1 change: 1 addition & 0 deletions packages/ubuntu_desktop_installer/lib/pages.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export 'pages/allocate_disk_space/allocate_disk_space_page.dart';
export 'pages/choose_security_key/choose_security_key_page.dart';
export 'pages/choose_your_look_page.dart';
export 'pages/configure_secure_boot/configure_secure_boot_page.dart';
export 'pages/installation_complete/installation_complete_page.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'package:flutter/foundation.dart';
import 'package:subiquity_client/subiquity_client.dart';

/// View model for [ChooseSecurityKeyPage].
class ChooseSecurityKeyModel extends ChangeNotifier {
/// Creates the model with the given client.
ChooseSecurityKeyModel(this._client) {
Listenable.merge([
_securityKey,
_confirmedSecurityKey,
]).addListener(notifyListeners);
}

final SubiquityClient _client;
final _securityKey = ValueNotifier('');
final _confirmedSecurityKey = ValueNotifier('');

/// The current security key.
String get securityKey => _securityKey.value;
set securityKey(String value) => _securityKey.value = value;

/// The confirmed security key for validation.
String get confirmedSecurityKey => _confirmedSecurityKey.value;
set confirmedSecurityKey(String value) => _confirmedSecurityKey.value = value;

/// Whether the current input is valid.
bool get isValid => securityKey == confirmedSecurityKey;

/// Loads the security key.
Future<void> loadSecurityKey() async {}

/// Saves the security key.
Future<void> saveSecurityKey() async {}
}

0 comments on commit d347e6b

Please sign in to comment.