From b7fa3960dd3892ff587f47d9979ffe11355fdaa5 Mon Sep 17 00:00:00 2001 From: Ivar Derksen Date: Tue, 5 Dec 2023 16:00:56 +0100 Subject: [PATCH] Fix: errors related to the keyshare server enrollment not shown to the user --- CHANGELOG.md | 1 + lib/src/data/irma_client_bridge.dart | 5 +++++ lib/src/data/session_repository.dart | 24 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a2b18d8..ab73e7e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Fixed - irmagobridge's Stop method is not called on iOS when the app is terminated +- Errors related to the keyshare server enrollment not shown to the user ## [7.5.3] - 2023-11-16 ### Changed diff --git a/lib/src/data/irma_client_bridge.dart b/lib/src/data/irma_client_bridge.dart index 3b95b2e8..4bfe2699 100644 --- a/lib/src/data/irma_client_bridge.dart +++ b/lib/src/data/irma_client_bridge.dart @@ -52,7 +52,12 @@ class IrmaClientBridge extends IrmaBridge { PairingRequiredSessionEvent: (j) => PairingRequiredSessionEvent.fromJson(j), SuccessSessionEvent: (j) => SuccessSessionEvent.fromJson(j), CanceledSessionEvent: (j) => CanceledSessionEvent.fromJson(j), + + KeyshareEnrollmentMissingSessionEvent: (j) => KeyshareEnrollmentMissingSessionEvent.fromJson(j), + KeyshareEnrollmentDeletedSessionEvent: (j) => KeyshareEnrollmentDeletedSessionEvent.fromJson(j), KeyshareBlockedSessionEvent: (j) => KeyshareBlockedSessionEvent.fromJson(j), + KeyshareEnrollmentIncompleteSessionEvent: (j) => KeyshareEnrollmentIncompleteSessionEvent.fromJson(j), + ClientReturnURLSetSessionEvent: (j) => ClientReturnURLSetSessionEvent.fromJson(j), FailureSessionEvent: (j) => FailureSessionEvent.fromJson(j), diff --git a/lib/src/data/session_repository.dart b/lib/src/data/session_repository.dart index 5e4e04b8..2ff96e0e 100644 --- a/lib/src/data/session_repository.dart +++ b/lib/src/data/session_repository.dart @@ -70,6 +70,30 @@ class SessionRepository { status: SessionStatus.error, error: event.error, ); + } else if (event is KeyshareEnrollmentMissingSessionEvent) { + return prevState.copyWith( + status: SessionStatus.error, + error: SessionError( + errorType: 'keyshareEnrollmentMissing', + info: 'user not activated at the keyshare server of scheme ${event.schemeManagerID}', + ), + ); + } else if (event is KeyshareEnrollmentIncompleteSessionEvent) { + return prevState.copyWith( + status: SessionStatus.error, + error: SessionError( + errorType: 'keyshareEnrollmentIncomplete', + info: 'user enrollment incomplete at the keyshare server of scheme ${event.schemeManagerID}', + ), + ); + } else if (event is KeyshareEnrollmentDeletedSessionEvent) { + return prevState.copyWith( + status: SessionStatus.error, + error: SessionError( + errorType: 'keyshareEnrollmentDeleted', + info: 'user deleted at the keyshare server of scheme ${event.schemeManagerID}', + ), + ); } else if (event is StatusUpdateSessionEvent) { return prevState.copyWith( status: event.status.toSessionStatus(),