Skip to content

Commit

Permalink
Merge pull request #584 from atsign-foundation/apkam_notification_bug
Browse files Browse the repository at this point in the history
fix: onboarding_cli example workaround for apkam notification  bug
  • Loading branch information
gkc committed May 22, 2024
2 parents 4f13a6e + 7930634 commit 5621f4f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ Future<void> _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');
Expand Down

0 comments on commit 5621f4f

Please sign in to comment.