Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new error code and description for 'Invalid Enrollment Status' #414

Merged
merged 8 commits into from
Sep 29, 2023
3 changes: 3 additions & 0 deletions packages/at_commons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.0.56
- feat: Introduce "AtInvalidEnrollmentException" which is thrown when an enrollment is expired or invalid
- feat: Introduce error code 'AT0030' for Invalid Enrollment Status
## 3.0.55
- feat: Introduce "AtThrottleLimitExceeded" exception which is thrown when enrollment request exceeds the limit
- feat: Introduce new error codes for apkam enrollments
Expand Down
5 changes: 5 additions & 0 deletions packages/at_commons/lib/src/exception/at_exceptions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ class AtEnrollmentException extends AtException {
AtEnrollmentException(message) : super(message);
}

/// Exception thrown when an Enrollment_id is expired or invalid
class AtInvalidEnrollmentException extends AtException {
AtInvalidEnrollmentException(message) : super(message);
}

/// Exception thrown when the enrollment requests exceed the limit
/// in the given time window
class AtThrottleLimitExceeded extends AtException {
Expand Down
8 changes: 5 additions & 3 deletions packages/at_commons/lib/src/exception/error_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const Map error_codes = {
'IllegalArgumentException': 'AT0022',
'AtTimeoutException': 'AT0023',
'ServerIsPausedException': 'AT0024',
'AtThrottleLimitException': 'AT0028'
'AtThrottleLimitException': 'AT0028',
'AtInvalidEnrollmentException': 'AT0029',
};

// ignore: constant_identifier_names
Expand Down Expand Up @@ -50,6 +51,7 @@ const Map error_description = {
'AT0025': 'Apkam Auth Denied',
'AT0026': 'Apkam Auth Failed',
'AT0027': 'Apkam Access Revoked',
'AT0028': 'Apkam Enrollment Expired',
'AT0029': 'Too Many Requests'
'AT0028': 'Too Many Requests',
'AT0029': 'Apkam Enrollment Expired',
'AT0030': 'Invalid Enrollment Status'
};
2 changes: 1 addition & 1 deletion packages/at_commons/lib/src/verb/operation_enum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum MessageTypeEnum { key, text }
String getMessageType(MessageTypeEnum? messageTypeEnum) =>
'$messageTypeEnum'.split('.').last;

enum EnrollOperationEnum { request, approve, deny, revoke, list }
enum EnrollOperationEnum { request, approve, deny, revoke, list, update }

String getEnrollOperation(EnrollOperationEnum? enrollOperationEnum) =>
'$enrollOperationEnum'.split('.').last;
2 changes: 1 addition & 1 deletion packages/at_commons/lib/src/verb/syntax.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class VerbSyntax {
static const notifyRemove = r'notify:remove:(?<id>[\w\d\-\_]+)';
static const enroll =
// The non-capturing group (?::)? matches ":" if the operation is request|approve|deny|revoke
r'^enroll:(?<operation>(?:list$|(request|approve|deny|revoke)))(?::)?(?<enrollParams>.+)?$';
r'^enroll:(?<operation>(?:list$|(request|approve|deny|revoke|update)))(?::)?(?<enrollParams>.+)?$';
static const otp = r'^otp:(?<operation>get|validate)(:(?<otp>\w+))?$';
static const keys = r'^keys:((?<operation>put|get|delete):?)'
r'(?:(?<visibility>public|private|self):?)?'
Expand Down
2 changes: 1 addition & 1 deletion packages/at_commons/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: at_commons
description: A library of Dart and Flutter utility classes that are used across other components of the atPlatform.
version: 3.0.55
version: 3.0.56
repository: https://github.com/atsign-foundation/at_libraries
homepage: https://atsign.dev

Expand Down