Skip to content

Commit

Permalink
fix: dart analyzer issues
Browse files Browse the repository at this point in the history
  • Loading branch information
murali-shris committed Oct 12, 2023
1 parent 0d6ce72 commit cda9a8d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
2 changes: 0 additions & 2 deletions packages/at_onboarding_cli/example/apkam_authenticate.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'package:at_client/at_client.dart';
import 'package:at_lookup/at_lookup.dart';
import 'package:at_onboarding_cli/at_onboarding_cli.dart';
import 'package:at_utils/at_logger.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class AtOnboardingServiceImpl implements AtOnboardingService {
bool _isAtsignOnboarded = false;
AtSignLogger logger = AtSignLogger('OnboardingCli');
AtOnboardingPreference atOnboardingPreference;
AtClient? _atClient;
AtLookUp? _atLookUp;

final StreamController<String> _pkamSuccessController =
Expand Down Expand Up @@ -72,13 +71,14 @@ class AtOnboardingServiceImpl implements AtOnboardingService {
_atLookUp?.enrollmentId = enrollmentId;
_atLookUp?.signingAlgoType = atOnboardingPreference.signingAlgoType;
_atLookUp?.hashingAlgoType = atOnboardingPreference.hashingAlgoType;
_atClient ??= atClientManager.atClient;
atClient ??= atClientManager.atClient;
_atLookUp!.atChops = atChops;
}

@override
@Deprecated('Use getter')
Future<AtClient?> getAtClient() async {
return _atClient;
return atClient;
}

@override
Expand Down Expand Up @@ -131,6 +131,7 @@ class AtOnboardingServiceImpl implements AtOnboardingService {
await _generateAtKeysFile(
atOnboardingResponse.enrollmentId, atOnboardingResponse.atAuthKeys!);
}
_isAtsignOnboarded = atOnboardingResponse.isSuccessful;
return _isAtsignOnboarded;
}

Expand Down Expand Up @@ -397,29 +398,29 @@ class AtOnboardingServiceImpl implements AtOnboardingService {
AtAuthKeys atAuthKeys = _decryptAtKeysFile(
(await _readAtKeysFile(atOnboardingPreference.atKeysFilePath)));
//backup keys into local secondary
bool? response = await _atClient
bool? response = await atClient
?.getLocalSecondary()
?.putValue(AtConstants.atPkamPublicKey, atAuthKeys.apkamPublicKey!);
logger.finer('PkamPublicKey persist to localSecondary: status $response');
// save pkam private key only when auth mode is keyFile. if auth mode is sim/any other secure element private key cannot be read and hence will not be part of keys file
if (atOnboardingPreference.authMode == PkamAuthMode.keysFile) {
response = await _atClient
response = await atClient
?.getLocalSecondary()
?.putValue(AtConstants.atPkamPrivateKey, atAuthKeys.apkamPrivateKey!);
logger
.finer('PkamPrivateKey persist to localSecondary: status $response');
}
response = await _atClient?.getLocalSecondary()?.putValue(
response = await atClient?.getLocalSecondary()?.putValue(
'${AtConstants.atEncryptionPublicKey}$_atSign',
atAuthKeys.defaultEncryptionPublicKey!);
logger.finer(
'EncryptionPublicKey persist to localSecondary: status $response');
response = await _atClient?.getLocalSecondary()?.putValue(
response = await atClient?.getLocalSecondary()?.putValue(
AtConstants.atEncryptionPrivateKey,
atAuthKeys.defaultEncryptionPrivateKey!);
logger.finer(
'EncryptionPrivateKey persist to localSecondary: status $response');
response = await _atClient?.getLocalSecondary()?.putValue(
response = await atClient?.getLocalSecondary()?.putValue(
AtConstants.atEncryptionSelfKey, atAuthKeys.defaultSelfEncryptionKey!);
}

Expand All @@ -433,8 +434,7 @@ class AtOnboardingServiceImpl implements AtOnboardingService {
..authMode = atOnboardingPreference.authMode;
var atAuthResponse = await atAuth!.authenticate(atAuthRequest);
logger.finer('Auth response: $atAuthResponse');
if (!_isAtsignOnboarded &&
atAuthResponse.isSuccessful &&
if (atAuthResponse.isSuccessful &&
atOnboardingPreference.atKeysFilePath != null) {
logger.finer('Calling persist keys to local secondary');
await _initAtClient(atAuth!.atChops!,
Expand Down Expand Up @@ -617,7 +617,7 @@ class AtOnboardingServiceImpl implements AtOnboardingService {
await (_atLookUp as AtLookupImpl).close();
}
_atLookUp = null;
_atClient = null;
atClient = null;
logger.info(
'Closing current instance of at_onboarding_cli (exit code: $exitCode)');
}
Expand All @@ -629,18 +629,13 @@ class AtOnboardingServiceImpl implements AtOnboardingService {
}

@override
set atClient(AtClient? atClient) {
_atClient = atClient;
}
AtClient? atClient;

@override
set atLookUp(AtLookUp? atLookUp) {
_atLookUp = atLookUp;
}

@override
AtClient? get atClient => _atClient;

@override
AtLookUp? get atLookUp => _atLookUp;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:at_client/at_client.dart';
import 'package:at_auth/at_auth.dart';
import 'package:test/expect.dart';
import 'package:test/scaffolding.dart';
import 'package:at_demo_data/at_demo_data.dart' as at_demo;

class MockAtLookupImpl extends Mock implements AtLookupImpl {}

Expand Down
14 changes: 13 additions & 1 deletion tests/at_onboarding_cli_functional_tests/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@ environment:
dependencies:
at_onboarding_cli:
path: ../../packages/at_onboarding_cli
at_commons: ^3.0.55
at_commons: ^3.0.56
at_utils: ^3.0.15
at_lookup: ^3.0.40
at_client: ^3.0.65

dependency_overrides:
at_auth:
git:
url: https://github.com/atsign-foundation/at_libraries
path: packages/at_auth
ref: at_auth_new_package
at_chops:
git:
url: https://github.com/atsign-foundation/at_libraries
path: packages/at_chops
ref: at_auth_new_package

dev_dependencies:
lints: ^1.0.0
test: ^1.17.2
Expand Down

0 comments on commit cda9a8d

Please sign in to comment.