diff --git a/at_end2end_test/test/commons.dart b/at_end2end_test/test/commons.dart index 0ce8ca343..65d268165 100644 --- a/at_end2end_test/test/commons.dart +++ b/at_end2end_test/test/commons.dart @@ -17,7 +17,7 @@ Future socket_connection(host, port) async { context.setTrustedCertificates('lib/secondary/base/certs/cacert.pem'); context.usePrivateKey('lib/secondary/base/certs/privkey.pem'); context.useCertificateChain('lib/secondary/base/certs/fullchain.pem'); - return await SecureSocket.connect(host, port , context: context ); + return await SecureSocket.connect(host, port, context: context); } void clear() { @@ -26,8 +26,7 @@ void clear() { } ///Secure Socket Connection -Future secure_socket_connection( - host, port) async { +Future secure_socket_connection(host, port) async { var socket; while (true) { try { diff --git a/at_end2end_test/test/update_verb_test.dart b/at_end2end_test/test/update_verb_test.dart index a857135d4..c45de7162 100644 --- a/at_end2end_test/test/update_verb_test.dart +++ b/at_end2end_test/test/update_verb_test.dart @@ -33,21 +33,24 @@ void main() { await prepare(_socket_first_atsign, first_atsign); //Socket connection for second atsign - _socket_second_atsign = - await secure_socket_connection(second_atsign_server, second_atsign_port); + _socket_second_atsign = await secure_socket_connection( + second_atsign_server, second_atsign_port); socket_listener(_socket_second_atsign); await prepare(_socket_second_atsign, second_atsign); }); test('update-llookup verb with public key', () async { /// UPDATE VERB - await socket_writer(_socket_first_atsign, 'update:public:location$first_atsign Hyderabad'); + await socket_writer( + _socket_first_atsign, 'update:public:location$first_atsign Hyderabad'); var response = await read(); print('update verb response : $response'); - assert((!response.contains('Invalid syntax')) && (!response.contains('null'))); + assert( + (!response.contains('Invalid syntax')) && (!response.contains('null'))); ///LLOOKUP VERB - await socket_writer(_socket_first_atsign, 'llookup:public:location$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:public:location$first_atsign'); response = await read(); print('llookup verb response : $response'); expect(response, contains('data:Hyderabad')); @@ -55,13 +58,16 @@ void main() { test('update-llookup with private key', () async { /// UPDATE VERB - await socket_writer(_socket_first_atsign, 'update:$second_atsign:country$first_atsign India'); + await socket_writer(_socket_first_atsign, + 'update:$second_atsign:country$first_atsign India'); var response = await read(); print('update verb response $response'); - assert((!response.contains('Invalid syntax')) && (!response.contains('null'))); + assert( + (!response.contains('Invalid syntax')) && (!response.contains('null'))); ///LLOOKUP VERB - with @sign returns value - await socket_writer(_socket_first_atsign, 'llookup:$second_atsign:country$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:$second_atsign:country$first_atsign'); response = await read(); print('llookup verb response with private key in llookup verb: $response'); expect(response, contains('data:India')); @@ -76,27 +82,33 @@ void main() { test('update verb with special characters', () async { ///UPDATE VERB - await socket_writer(_socket_first_atsign, 'update:public:passcode$first_atsign @!ice^&##'); + await socket_writer( + _socket_first_atsign, 'update:public:passcode$first_atsign @!ice^&##'); var response = await read(); print('update verb response : $response'); - assert((!response.contains('Invalid syntax')) && (!response.contains('null'))); + assert( + (!response.contains('Invalid syntax')) && (!response.contains('null'))); ///LLOOKUP VERB - await socket_writer(_socket_first_atsign, 'llookup:public:passcode$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:public:passcode$first_atsign'); response = await read(); print('llookup verb response : $response'); - expect(response,contains('data:@!ice^&##')); + expect(response, contains('data:@!ice^&##')); }, timeout: Timeout(Duration(seconds: 90))); test('update verb with unicode characters', () async { ///UPDATE VERB - await socket_writer(_socket_first_atsign, 'update:public:unicode$first_atsign U+0026'); + await socket_writer( + _socket_first_atsign, 'update:public:unicode$first_atsign U+0026'); var response = await read(); print('update verb response : $response'); - assert((!response.contains('Invalid syntax')) && (!response.contains('null'))); + assert( + (!response.contains('Invalid syntax')) && (!response.contains('null'))); ///LLOOKUP VERB - await socket_writer(_socket_first_atsign, 'llookup:public:unicode$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:public:unicode$first_atsign'); response = await read(); print('llookup verb response : $response'); expect(response, contains('data:U+0026')); @@ -108,19 +120,22 @@ void main() { 'update:public:address$first_atsign "plot no-103,Essar enclave,Hyderabad-500083"'); var response = await read(); print('update verb response : $response'); - assert((!response.contains('Invalid syntax')) && (!response.contains('null'))); + assert( + (!response.contains('Invalid syntax')) && (!response.contains('null'))); ///LLOOKUP VERB - await socket_writer(_socket_first_atsign, 'llookup:public:address$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:public:address$first_atsign'); response = await read(); print('llookup verb response : $response'); - expect(response,contains( - 'data:"plot no-103,Essar enclave,Hyderabad-500083"')); + expect(response, + contains('data:"plot no-103,Essar enclave,Hyderabad-500083"')); }, timeout: Timeout(Duration(seconds: 90))); test('update verb without value should throw a error ', () async { ///UPDATE VERB - await socket_writer(_socket_first_atsign, 'update:public:key-1$first_atsign'); + await socket_writer( + _socket_first_atsign, 'update:public:key-1$first_atsign'); var response = await read(); print('update verb response : $response'); expect(response, contains('Invalid syntax')); @@ -128,13 +143,16 @@ void main() { test('update verb by passing emoji as value ', () async { ///UPDATE VERB - await socket_writer(_socket_first_atsign, 'update:public:emoji$first_atsign πŸ¦„'); + await socket_writer( + _socket_first_atsign, 'update:public:emoji$first_atsign πŸ¦„'); var response = await read(); print('update verb response : $response'); - assert((!response.contains('Invalid syntax')) && (!response.contains('null'))); + assert( + (!response.contains('Invalid syntax')) && (!response.contains('null'))); ///LLOOKUP VERB - await socket_writer(_socket_first_atsign, 'llookup:public:emoji$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:public:emoji$first_atsign'); response = await read(); print('llookup verb response : $response'); expect(response, contains('data:πŸ¦„')); @@ -142,13 +160,16 @@ void main() { test('update verb by passing japanese input as value ', () async { ///UPDATE VERB - await socket_writer(_socket_first_atsign, 'update:public:japanese$first_atsign "γƒ‘γƒΌγƒ‹γƒžγ±γƒΌγ«γΎ"'); + await socket_writer( + _socket_first_atsign, 'update:public:japanese$first_atsign "γƒ‘γƒΌγƒ‹γƒžγ±γƒΌγ«γΎ"'); var response = await read(); print('update verb response : $response'); - assert((!response.contains('Invalid syntax')) && (!response.contains('null'))); + assert( + (!response.contains('Invalid syntax')) && (!response.contains('null'))); ///LLOOKUP VERB - await socket_writer(_socket_first_atsign, 'llookup:public:japanese$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:public:japanese$first_atsign'); response = await read(); print('llookup verb response : $response'); expect(response, contains('data:"γƒ‘γƒΌγƒ‹γƒžγ±γƒΌγ«γΎ"')); @@ -156,19 +177,23 @@ void main() { test('update verb by sharing a cached key ', () async { ///UPDATE VERB - await socket_writer(_socket_first_atsign, 'update:ttr:-1:$second_atsign:xbox1$first_atsign player123'); + await socket_writer(_socket_first_atsign, + 'update:ttr:-1:$second_atsign:xbox1$first_atsign player123'); var response = await read(); print('update verb response : $response'); - assert((!response.contains('Invalid syntax')) && (!response.contains('null'))); + assert( + (!response.contains('Invalid syntax')) && (!response.contains('null'))); // ///LLOOKUP VERB in the same secondary - await socket_writer(_socket_first_atsign, 'llookup:$second_atsign:xbox1$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:$second_atsign:xbox1$first_atsign'); response = await read(); print('llookup verb response : $response'); expect(response, contains('data:player123')); //LOOKUP VERB in the shared secondary - await socket_writer(_socket_second_atsign, 'llookup:cached:$second_atsign:xbox1$first_atsign'); + await socket_writer(_socket_second_atsign, + 'llookup:cached:$second_atsign:xbox1$first_atsign'); response = await read(); print('llookup verb response : $response'); expect(response, contains('data:player123')); @@ -176,7 +201,8 @@ void main() { test('update verb by passing 2 @ symbols ', () async { ///UPDATE VERB - await socket_writer(_socket_first_atsign, 'update:public:country@$first_atsign USA'); + await socket_writer( + _socket_first_atsign, 'update:public:country@$first_atsign USA'); var response = await read(); print('update verb response : $response'); assert(response.contains('Invalid syntax')); @@ -184,13 +210,16 @@ void main() { test('update-llookup for private key for an emoji atsign ', () async { ///UPDATE VERB - await socket_writer(_socket_first_atsign, 'update:@πŸ¦„:emoji.name$first_atsign unicorn'); + await socket_writer( + _socket_first_atsign, 'update:@πŸ¦„:emoji.name$first_atsign unicorn'); var response = await read(); print('update verb response : $response'); - assert((!response.contains('Invalid syntax')) && (!response.contains('null'))); + assert( + (!response.contains('Invalid syntax')) && (!response.contains('null'))); ///LLOOKUP VERB - await socket_writer(_socket_first_atsign, 'llookup:@πŸ¦„:emoji.name$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:@πŸ¦„:emoji.name$first_atsign'); response = await read(); print('llookup verb response : $response'); expect(response, contains('data:unicorn')); @@ -198,19 +227,23 @@ void main() { test('update-llookup for ttl ', () async { ///UPDATE VERB - await socket_writer(_socket_first_atsign, 'update:ttl:3000:$second_atsign:offer$first_atsign 3seconds'); + await socket_writer(_socket_first_atsign, + 'update:ttl:3000:$second_atsign:offer$first_atsign 3seconds'); var response = await read(); print('update verb response : $response'); - assert((!response.contains('Invalid syntax')) && (!response.contains('null'))); + assert( + (!response.contains('Invalid syntax')) && (!response.contains('null'))); ///LLOOKUP:META verb - await socket_writer(_socket_first_atsign, 'llookup:meta:$second_atsign:offer$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:meta:$second_atsign:offer$first_atsign'); response = await read(); print('llookup meta response : $response'); expect(response, contains('"ttl":3000')); ///LLOOKUP VERB - Before 3 seconds - await socket_writer(_socket_first_atsign, 'llookup:$second_atsign:offer$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:$second_atsign:offer$first_atsign'); response = await read(); print('llookup verb response before 3 seconds : $response'); expect(response, contains('data:3seconds')); @@ -218,7 +251,8 @@ void main() { ///LLOOKUP VERB - After 3 seconds //Waiting till the ttl time is up await Future.delayed(Duration(seconds: 2)); - await socket_writer(_socket_first_atsign, 'llookup:$second_atsign:offer$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:$second_atsign:offer$first_atsign'); response = await read(); print('llookup verb response after 3 seconds : $response'); expect(response, contains('data:null')); @@ -226,19 +260,23 @@ void main() { test('update-llookup for ttb ', () async { ///UPDATE VERB - await socket_writer(_socket_first_atsign, 'update:ttb:2000:$second_atsign:auth-code$first_atsign 3289'); + await socket_writer(_socket_first_atsign, + 'update:ttb:2000:$second_atsign:auth-code$first_atsign 3289'); var response = await read(); print('update verb response : $response'); - assert((!response.contains('Invalid syntax')) && (!response.contains('null'))); + assert( + (!response.contains('Invalid syntax')) && (!response.contains('null'))); ///LLOOKUP VERB - Before 2 seconds - await socket_writer(_socket_first_atsign, 'llookup:$second_atsign:auth-code$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:$second_atsign:auth-code$first_atsign'); response = await read(); print('llookup verb response before 2 seconds : $response'); expect(response, contains('data:null')); ///LLOOKUP VERB - After 2 seconds - await socket_writer(_socket_first_atsign, 'llookup:$second_atsign:auth-code$first_atsign'); + await socket_writer( + _socket_first_atsign, 'llookup:$second_atsign:auth-code$first_atsign'); response = await read(); print('llookup verb response after 2 seconds : $response'); expect(response, contains('data:3289')); @@ -246,13 +284,13 @@ void main() { ///LLookup:META FOR TTB //waiting till ttb time is up await Future.delayed(Duration(seconds: 2)); - await socket_writer(_socket_first_atsign, 'llookup:meta:$second_atsign:auth-code$first_atsign'); + await socket_writer(_socket_first_atsign, + 'llookup:meta:$second_atsign:auth-code$first_atsign'); response = await read(); print('llookup meta verb response for ttb is : $response'); expect(response, contains('"ttb":2000')); }, timeout: Timeout(Duration(seconds: 90))); - tearDown(() { //Closing the client socket connection clear(); diff --git a/at_root/at_root_server/lib/src/server/at_root_config.dart b/at_root/at_root_server/lib/src/server/at_root_config.dart index 1e9eb5c96..89b861b13 100644 --- a/at_root/at_root_server/lib/src/server/at_root_config.dart +++ b/at_root/at_root_server/lib/src/server/at_root_config.dart @@ -8,10 +8,11 @@ class AtRootConfig { static bool? _useSSL = true; static String _certificateChainLocation = 'certs/fullchain.pem'; static String _privateKeyLocation = 'certs/privkey.pem'; - static String? _root_server_version = (ConfigUtil.getPubspecConfig() != null && - ConfigUtil.getPubspecConfig()!['version'] != null) - ? ConfigUtil.getPubspecConfig()!['version'] - : null; + static String? _root_server_version = + (ConfigUtil.getPubspecConfig() != null && + ConfigUtil.getPubspecConfig()!['version'] != null) + ? ConfigUtil.getPubspecConfig()!['version'] + : null; static final Map _envVars = Platform.environment; diff --git a/at_secondary/at_secondary_server/lib/src/server/at_certificate_validation.dart b/at_secondary/at_secondary_server/lib/src/server/at_certificate_validation.dart index d6be02dcd..4cf0efddd 100644 --- a/at_secondary/at_secondary_server/lib/src/server/at_certificate_validation.dart +++ b/at_secondary/at_secondary_server/lib/src/server/at_certificate_validation.dart @@ -70,7 +70,8 @@ class AtCertificateValidationJob { // Run the cron job twice a day. cron.schedule(Schedule(hours: [certsJobHour, certsJobHour + 12]), () { if (file.existsSync()) { - logger.info('Restart file found. Initializing secondary server restart process'); + logger.info( + 'Restart file found. Initializing secondary server restart process'); mainIsolateSendPort.send(true); } }); diff --git a/at_secondary/at_secondary_server/pubspec.yaml b/at_secondary/at_secondary_server/pubspec.yaml index 497839b07..0d76f8168 100644 --- a/at_secondary/at_secondary_server/pubspec.yaml +++ b/at_secondary/at_secondary_server/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: collection: ^1.15.0 basic_utils: ^3.0.2 at_persistence_secondary_server: ^3.0.0 - at_lookup: ^3.0.0 + at_lookup: ^3.0.2 at_server_spec: ^3.0.0 #dependency_overrides: