diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..298eed7 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "name": "at_talk", + "request": "launch", + "type": "dart", + "program": "bin/at_talk.dart", + "args": ["-a", "@acidrock2", "-t", "@iot_device03"] + + } + ] +} \ No newline at end of file diff --git a/bin/at_talk.dart b/bin/at_talk.dart index c382895..7715412 100644 --- a/bin/at_talk.dart +++ b/bin/at_talk.dart @@ -20,6 +20,7 @@ import 'package:at_talk/check_file_exists.dart'; void main(List args) async { //starting secondary in a zone var logger = AtSignLogger('atTalk sender '); + logger.logger.level = Level.SHOUT; runZonedGuarded(() async { await atTalk(args); }, (error, stackTrace) { @@ -36,10 +37,16 @@ Future atTalk(List args) async { var parser = ArgParser(); // Args parser.addOption('key-file', - abbr: 'k', mandatory: false, help: 'Your @sign\'s atKeys file if not in ~/.atsign/keys/'); + abbr: 'k', + mandatory: false, + help: 'Your @sign\'s atKeys file if not in ~/.atsign/keys/'); parser.addOption('atsign', abbr: 'a', mandatory: true, help: 'Your atSign'); - parser.addOption('toatsign', abbr: 't', mandatory: true, help: 'Talk to this @sign'); - parser.addOption('root-domain', abbr: 'd', mandatory: false, help: 'Root Domain (defaults to root.atsign.org)'); + parser.addOption('toatsign', + abbr: 't', mandatory: true, help: 'Talk to this @sign'); + parser.addOption('root-domain', + abbr: 'd', + mandatory: false, + help: 'Root Domain (defaults to root.atsign.org)'); parser.addFlag('verbose', abbr: 'v', help: 'More logging'); // Check the arguments @@ -49,7 +56,7 @@ Future atTalk(List args) async { String fromAtsign = 'unknown'; String toAtsign = 'unknown'; String? homeDirectory = getHomeDirectory(); - String nameSpace = 'attalk'; + String nameSpace = 'ai6bh'; String rootDomain = 'root.atsign.org'; try { @@ -80,7 +87,7 @@ Future atTalk(List args) async { } // Now on to the @platform startup - AtSignLogger.root_level = 'SEVERE'; + AtSignLogger.root_level = 'SHOUT'; if (results['verbose']) { _logger.logger.level = Level.INFO; @@ -99,7 +106,8 @@ Future atTalk(List args) async { ..rootDomain = rootDomain ..atKeysFilePath = atsignFile; - AtOnboardingService onboardingService = AtOnboardingServiceImpl(fromAtsign, atOnboardingConfig); + AtOnboardingService onboardingService = + AtOnboardingServiceImpl(fromAtsign, atOnboardingConfig); await onboardingService.authenticate(); @@ -137,21 +145,27 @@ Future atTalk(List args) async { } }); - notificationService.subscribe(regex: 'attalk.$nameSpace@', shouldDecrypt: true).listen(((notification) async { + notificationService + .subscribe(regex: 'attalk.$nameSpace@', shouldDecrypt: true) + .listen(((notification) async { String keyAtsign = notification.key; //Uint8List buffer; keyAtsign = keyAtsign.replaceAll(notification.to + ':', ''); keyAtsign = keyAtsign.replaceAll('.' + nameSpace + notification.from, ''); if (keyAtsign == 'attalk') { - _logger.info('atTalk update received from ' + notification.from + ' notification id : ' + notification.id); + _logger.info('atTalk update received from ' + + notification.from + + ' notification id : ' + + notification.id); var talk = notification.value!; - print(chalk.brightGreen.bold('\r${notification.from}: ') + chalk.brightGreen(talk)); + print(chalk.brightGreen.bold('\r${notification.from}: ') + + chalk.brightGreen(talk)); pipePrint('$fromAtsign: '); } }), - onError: (e) => _logger.severe('Notification Failed:' + e.toString()), - onDone: () => _logger.info('Notification listener stopped')); + onError: (e) => _logger.severe('Notification Failed:' + e.toString()), + onDone: () => _logger.info('Notification listener stopped')); String input = ""; pipePrint('$fromAtsign: '); @@ -182,13 +196,15 @@ Future atTalk(List args) async { ..key = 'attalk' ..sharedBy = fromAtsign ..sharedWith = toAtsign - ..namespace = atClient?.getPreferences()?.namespace + ..namespace = nameSpace ..metadata = metaData; if (!(input == "")) { try { pendingSend++; - await notificationService.notify(NotificationParams.forUpdate(key, value: input), onSuccess: (notification) { + await notificationService + .notify(NotificationParams.forUpdate(key, value: input), + onSuccess: (notification) { _logger.info('SUCCESS:' + notification.toString()); }, onError: (notification) { _logger.info('ERROR:' + notification.toString()); diff --git a/pubspec.lock b/pubspec.lock index 08871f4..204668f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "42.0.0" + version: "43.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "4.3.0" + version: "4.3.1" archive: dependency: transitive description: @@ -53,19 +53,17 @@ packages: at_client: dependency: "direct main" description: - path: at_client - ref: trunk - resolved-ref: "531cd25470409d9894fb4cd78ff60e07fbb60b4e" - url: "https://github.com/atsign-foundation/at_client_sdk.git" - source: git - version: "3.0.30" + name: at_client + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.32" at_commons: dependency: transitive description: name: at_commons url: "https://pub.dartlang.org" source: hosted - version: "3.0.20" + version: "3.0.21" at_lookup: dependency: transitive description: @@ -79,14 +77,14 @@ packages: name: at_onboarding_cli url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.1" at_persistence_secondary_server: dependency: transitive description: name: at_persistence_secondary_server url: "https://pub.dartlang.org" source: hosted - version: "3.0.30" + version: "3.0.31" at_persistence_spec: dependency: transitive description: @@ -380,7 +378,7 @@ packages: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.3.2" shelf_packages_handler: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b44023a..0d5340f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,11 +9,11 @@ environment: dependency_overrides: # at_client: # path: ../at_client_sdk/at_client - at_client: - git: - url: https://github.com/atsign-foundation/at_client_sdk.git - path: at_client - ref: trunk + # at_client: + # git: + # url: https://github.com/atsign-foundation/at_client_sdk.git + # path: at_client + # ref: trunk dependencies: at_client: ^3.0.30