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 8d5ff9c9..1caae872 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 @@ -56,8 +56,14 @@ Future _notificationCallback(AtNotification notification, var enrollParamsJson = {}; enrollParamsJson['enrollmentId'] = enrollmentId; if (approveResponse == 'yes') { - final encryptedAPKAMSymmetricKey = + var encryptedAPKAMSymmetricKey = jsonDecode(notification.value!)['encryptedAPKAMSymmetricKey']; + // workaround for a server issue where it may send encryptedAPKAMSymmetricKey or encryptedApkamSymmetricKey + if (encryptedAPKAMSymmetricKey == null || + encryptedAPKAMSymmetricKey.isEmpty) { + encryptedAPKAMSymmetricKey = + jsonDecode(notification.value!)['encryptedApkamSymmetricKey']; + } final apkamSymmetricKey = EncryptionUtil.decryptKey( encryptedAPKAMSymmetricKey, atAuthKeys.defaultEncryptionPrivateKey!); print('decrypted apkam symmetric key: $apkamSymmetricKey');