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: force flag for enroll:revoke #564

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/at_commons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 4.0.9
- feat: enroll verb syntax change for enroll:revoke:force
## 4.0.8
- fix: Add shared_key.atsign@atsign to reservedKey regex
## 4.0.7
Expand Down
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>(?:(request|approve|deny|revoke|update|list|fetch)))(?::)?((?<enrollParams>.+)|(<=list:)<enrollParams>.?)?$';
r'^enroll:(?<operation>(?:(request|approve|deny|revoke|update|list|fetch)))(:(?<force>force))?(?::)?((?<enrollParams>.+)|(<=list:)<enrollParams>.?)?$';
static const otp =
r'^otp:(?<operation>get|put)(:(?<otp>(?<=put:)\w{6,}))?(:(?:ttl:(?<ttl>\d+)))?$';
static const keys = r'^keys:((?<operation>put|get|delete):?)'
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: 4.0.8
version: 4.0.9
repository: https://github.com/atsign-foundation/at_libraries
homepage: https://atsign.dev

Expand Down
10 changes: 10 additions & 0 deletions packages/at_commons/test/syntax_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,16 @@ void main() {
expect(verbParams['enrollmentId'], '1234');
});

test('A test to verify enroll revoke with force flag', () {
String command = 'enroll:revoke:force:{"enrollmentId":"1234"}\n';
var enrollVerbParams =
VerbUtil.getVerbParam(VerbSyntax.enroll, command.trim())!;
expect(enrollVerbParams['operation'], 'revoke');
expect(enrollVerbParams['force'], 'force');
var verbParams = jsonDecode(enrollVerbParams['enrollParams']!);
expect(verbParams['enrollmentId'], '1234');
});

test('A test to assert enroll list command', () {
String command = 'enroll:list\n';
var enrollVerbParams =
Expand Down