diff --git a/at_commons/CHANGELOG.md b/at_commons/CHANGELOG.md index 3a5bff82..9b4da7a5 100644 --- a/at_commons/CHANGELOG.md +++ b/at_commons/CHANGELOG.md @@ -1,3 +1,8 @@ +## 3.0.23 +* fix: bug fixes to AtKey.fromString static method and various toString instance methods +* feat: When validating AtKeys, allow _namespace_ to be optional, for legacy app code which depends on keys without namespaces +* feat: Added _getKeyType_ to AtKey + ## 3.0.22 - Add ENCODING to update verb regex, update verb builder and Metadata to support encoding of new line character - Add AtKeyNotFoundException for non-existent keys in secondary diff --git a/at_commons/lib/src/at_message.dart b/at_commons/lib/src/at_message.dart index dfdf62a0..8456ee39 100644 --- a/at_commons/lib/src/at_message.dart +++ b/at_commons/lib/src/at_message.dart @@ -12,41 +12,41 @@ enum AtMessage { extension AtMessageExtension on AtMessage { String get text { - const _notFoundMsg = 'No message found'; - const _wrongVerbMsg = + const notFoundMsg = 'No message found'; + const wrongVerbMsg = 'Available verbs are: lookup:, from:, pol:, llookup:, plookup:, update:, delete:, scan and exit. '; - const _closingConnectionMsg = 'Closing the connection. '; - const _cleanExitMsg = 'Exited cleanly, closing the connection. '; - const _moreThanOneAt = + const closingConnectionMsg = 'Closing the connection. '; + const cleanExitMsg = 'Exited cleanly, closing the connection. '; + const moreThanOneAt = 'invalid @sign: Cannot Contain more than one @ character'; - const _whiteSpaceNotAllowed = + const whiteSpaceNotAllowed = 'invalid @sign: Cannot Contain whitespace characters'; - const _reservedCharacterUsed = + const reservedCharacterUsed = 'invalid @sign: Cannot contain \!\*\'`\(\)\;\:\&\=\+\$\,\/\?\#\[\]\{\} characters'; - const _noAtSign = + const noAtSign = 'invalid @sign: must include one @ character and at least one character on the right'; - const _controlCharacter = + const controlCharacter = 'invalid @sign: must not include control characters'; switch (this) { case AtMessage.wrongVerb: - return _wrongVerbMsg; + return wrongVerbMsg; case AtMessage.closingConnection: - return _closingConnectionMsg; + return closingConnectionMsg; case AtMessage.cleanExit: - return _cleanExitMsg; + return cleanExitMsg; case AtMessage.moreThanOneAt: - return _moreThanOneAt; + return moreThanOneAt; case AtMessage.whiteSpaceNotAllowed: - return _whiteSpaceNotAllowed; + return whiteSpaceNotAllowed; case AtMessage.reservedCharacterUsed: - return _reservedCharacterUsed; + return reservedCharacterUsed; case AtMessage.noAtSign: - return _noAtSign; + return noAtSign; case AtMessage.controlCharacter: - return _controlCharacter; + return controlCharacter; default: - return _notFoundMsg; + return notFoundMsg; } } } diff --git a/at_commons/lib/src/keystore/at_key.dart b/at_commons/lib/src/keystore/at_key.dart index 30e89c83..28003cea 100644 --- a/at_commons/lib/src/keystore/at_key.dart +++ b/at_commons/lib/src/keystore/at_key.dart @@ -432,7 +432,8 @@ class Metadata { metaData.pubKeyCS = json[SHARED_WITH_PUBLIC_KEY_CHECK_SUM]; metaData.encoding = json[ENCODING]; } catch (error) { - print('AtMetaData.fromJson error: ' + error.toString()); + // TODO swallowing the error does not seem like the right thing to do + print('AtMetaData.fromJson error: ${error.toString()}'); } return metaData; } diff --git a/at_commons/lib/src/validators/at_key_validation_impl.dart b/at_commons/lib/src/validators/at_key_validation_impl.dart index 21f46e4e..b6652a3b 100644 --- a/at_commons/lib/src/validators/at_key_validation_impl.dart +++ b/at_commons/lib/src/validators/at_key_validation_impl.dart @@ -1,5 +1,4 @@ import 'package:at_commons/at_commons.dart'; -import 'package:at_commons/src/keystore/key_type.dart'; import 'package:at_commons/src/utils/at_key_regex_utils.dart'; /// Returns an instance of [AtKeyValidator] diff --git a/at_commons/lib/src/verb/config_verb_builder.dart b/at_commons/lib/src/verb/config_verb_builder.dart index fedcf7a0..d45e3749 100644 --- a/at_commons/lib/src/verb/config_verb_builder.dart +++ b/at_commons/lib/src/verb/config_verb_builder.dart @@ -25,9 +25,8 @@ class ConfigVerbBuilder implements VerbBuilder { command += '${VerbUtil.formatAtSign(atSign)}'; } } - command = command.trim(); - command = command + '\n'; - return command; + + return '${command.trim()}\n'; } @override diff --git a/at_commons/pubspec.yaml b/at_commons/pubspec.yaml index 150eaca3..221155c8 100644 --- a/at_commons/pubspec.yaml +++ b/at_commons/pubspec.yaml @@ -1,6 +1,6 @@ name: at_commons description: A library of Dart and Flutter utility classes that are used across other components of the @‎platform. -version: 3.0.22 +version: 3.0.23 repository: https://github.com/atsign-foundation/at_tools homepage: https://atsign.dev @@ -8,9 +8,9 @@ environment: sdk: '>=2.12.0 <3.0.0' dependencies: - uuid: ^3.0.4 + uuid: ^3.0.6 dev_dependencies: - lints: ^1.0.1 - test: ^1.17.0 - test_process: ^2.0.0 + lints: ^2.0.0 + test: ^1.21.4 + test_process: ^2.0.2 diff --git a/at_commons/test/at_key_test.dart b/at_commons/test/at_key_test.dart index 1a669235..6f00e7cd 100644 --- a/at_commons/test/at_key_test.dart +++ b/at_commons/test/at_key_test.dart @@ -1,6 +1,5 @@ import 'package:at_commons/at_commons.dart'; import 'package:at_commons/src/keystore/at_key_builder_impl.dart'; -import 'package:at_commons/src/keystore/key_type.dart'; import 'package:test/test.dart'; void main() { diff --git a/at_commons/test/at_key_type_test.dart b/at_commons/test/at_key_type_test.dart index 7dd5b9fb..0cba8428 100644 --- a/at_commons/test/at_key_type_test.dart +++ b/at_commons/test/at_key_type_test.dart @@ -1,5 +1,4 @@ import 'package:at_commons/at_commons.dart'; -import 'package:at_commons/src/keystore/key_type.dart'; import 'package:test/test.dart'; void main() {