diff --git a/packages/at_onboarding_cli/example/apkam_examples/enroll_app_listen.dart b/packages/at_onboarding_cli/example/apkam_examples/enroll_app_listen.dart index 1caae872..107b1899 100644 --- a/packages/at_onboarding_cli/example/apkam_examples/enroll_app_listen.dart +++ b/packages/at_onboarding_cli/example/apkam_examples/enroll_app_listen.dart @@ -1,11 +1,11 @@ import 'dart:convert'; +import 'dart:io'; import 'package:args/args.dart'; import 'package:at_auth/at_auth.dart'; +import 'package:at_auth/src/auth_constants.dart' as auth_constants; import 'package:at_chops/at_chops.dart'; import 'package:at_client/at_client.dart'; -import 'dart:io'; -import 'package:at_auth/src/auth_constants.dart' as auth_constants; import '../util/atsign_preference.dart'; import '../util/custom_arg_parser.dart'; @@ -33,7 +33,8 @@ void main(List args) async { atClientManager.atClient.notificationService .subscribe(regex: '.__manage') .listen((notification) { - _notificationCallback(notification, atClientManager.atClient, atAuthKeys); + _notificationCallback( + notification, atClientManager.atClient, atAuthKeys, atChops); }); } on Exception catch (e, trace) { print(e.toString()); @@ -44,7 +45,7 @@ void main(List args) async { } Future _notificationCallback(AtNotification notification, - AtClient atClient, AtAuthKeys atAuthKeys) async { + AtClient atClient, AtAuthKeys atAuthKeys, AtChops atChops) async { print('alice enroll notification received: ${notification.toString()}'); final notificationKey = notification.key; final enrollmentId = @@ -64,8 +65,10 @@ Future _notificationCallback(AtNotification notification, encryptedAPKAMSymmetricKey = jsonDecode(notification.value!)['encryptedApkamSymmetricKey']; } - final apkamSymmetricKey = EncryptionUtil.decryptKey( - encryptedAPKAMSymmetricKey, atAuthKeys.defaultEncryptionPrivateKey!); + + final apkamSymmetricKey = atChops + .decryptString(encryptedAPKAMSymmetricKey, EncryptionKeyType.rsa2048) + .result; print('decrypted apkam symmetric key: $apkamSymmetricKey'); var encryptedDefaultPrivateEncKey = EncryptionUtil.encryptValue( atAuthKeys.defaultEncryptionPrivateKey!, apkamSymmetricKey); diff --git a/packages/at_onboarding_cli/lib/at_onboarding_cli.dart b/packages/at_onboarding_cli/lib/at_onboarding_cli.dart index ebf04397..e02b7cef 100644 --- a/packages/at_onboarding_cli/lib/at_onboarding_cli.dart +++ b/packages/at_onboarding_cli/lib/at_onboarding_cli.dart @@ -1,7 +1,7 @@ -library at_onboarding_cli; +library; -export 'src/onboard/at_onboarding_service_impl.dart'; export 'src/onboard/at_onboarding_service.dart'; -export 'src/util/at_onboarding_preference.dart'; +export 'src/onboard/at_onboarding_service_impl.dart'; export 'src/register_cli/register.dart'; +export 'src/util/at_onboarding_preference.dart'; export 'src/util/auth_key_type.dart'; diff --git a/packages/at_onboarding_cli/lib/src/util/at_onboarding_exceptions.dart b/packages/at_onboarding_cli/lib/src/util/at_onboarding_exceptions.dart index 2329ecb2..2927e5ae 100644 --- a/packages/at_onboarding_cli/lib/src/util/at_onboarding_exceptions.dart +++ b/packages/at_onboarding_cli/lib/src/util/at_onboarding_exceptions.dart @@ -1,26 +1,20 @@ import 'package:at_client/at_client.dart'; class AtOnboardingException extends AtClientException { - AtOnboardingException(message, - {Intent? intent, ExceptionScenario? exceptionScenario}) - : super.message(message, - intent: intent, exceptionScenario: exceptionScenario); + AtOnboardingException(super.message, {super.intent, super.exceptionScenario}) + : super.message(); } class AtActivateException extends AtOnboardingException { - AtActivateException(message, - {Intent? intent, ExceptionScenario? exceptionScenario}) - : super(message, intent: intent, exceptionScenario: exceptionScenario); + AtActivateException(super.message, {super.intent, super.exceptionScenario}); } class AtAuthenticationFailureException extends AtOnboardingException { - AtAuthenticationFailureException(message, - {Intent? intent, ExceptionScenario? exceptionScenario}) - : super(message, intent: intent, exceptionScenario: exceptionScenario); + AtAuthenticationFailureException(super.message, + {super.intent, super.exceptionScenario}); } class InvalidResourceException extends AtOnboardingException { - InvalidResourceException(message, - {Intent? intent, ExceptionScenario? exceptionScenario}) - : super(message, intent: intent, exceptionScenario: exceptionScenario); + InvalidResourceException(super.message, + {super.intent, super.exceptionScenario}); } diff --git a/packages/at_onboarding_cli/pubspec.yaml b/packages/at_onboarding_cli/pubspec.yaml index 40aff253..7de808db 100644 --- a/packages/at_onboarding_cli/pubspec.yaml +++ b/packages/at_onboarding_cli/pubspec.yaml @@ -28,7 +28,7 @@ dependencies: at_lookup: ^3.0.49 at_server_status: ^1.0.5 at_utils: ^3.0.19 - at_persistence_secondary_server: ^3.0.65 + at_persistence_secondary_server: ^3.0.66 duration: ^4.0.3 crypto: ^3.0.5 chalkdart: ^2.0.9