Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ries into ws_version2
  • Loading branch information
purnimavenkatasubbu committed Oct 16, 2024
2 parents df4658d + 089713f commit ab88f5e
Show file tree
Hide file tree
Showing 22 changed files with 626 additions and 135 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/at_libraries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- at_contact
- at_server_status
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 # v1.6.5
with:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
- at_commons
- at_utils
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 # v1.6.5
with:
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
- at_onboarding_cli_functional_tests

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 # v1.6.5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
egress-policy: audit

- name: 'Checkout Repository'
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: 'Dependency Review'
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4
2 changes: 1 addition & 1 deletion .github/workflows/melos_bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
melos-bootstrap:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0
with:
channel: "stable"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
persist-credentials: false

Expand All @@ -59,14 +59,14 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11
uses: github/codeql-action/upload-sarif@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13
with:
sarif_file: results.sarif
4 changes: 4 additions & 0 deletions packages/at_cli_commons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.2.0
- feat: Add `standardAtClientStoragePath` and `standardAtClientStorageDir`
to utils.dart

## 1.1.0

- feat: Add `maxConnectAttempts` parameter to CLIBase. The default is 20,
Expand Down
48 changes: 30 additions & 18 deletions packages/at_cli_commons/lib/src/cli_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,31 @@ class CLIBase {
..addOption('atsign',
abbr: 'a', mandatory: true, help: 'This client\'s atSign')
..addOption('namespace', abbr: 'n', mandatory: true, help: 'Namespace')
..addOption('key-file',
abbr: 'k',
mandatory: false,
..addOption(
'key-file',
abbr: 'k',
mandatory: false,
help: 'Your atSign\'s atKeys file if not in ~/.atsign/keys/')
..addOption('cram-secret',
abbr: 'c', mandatory: false, help: 'atSign\'s cram secret')
..addOption('home-dir', abbr: 'h', mandatory: false, help: 'home directory')
..addOption('storage-dir',
abbr: 's',
mandatory: false,
..addOption(
'storage-dir',
abbr: 's',
mandatory: false,
help: 'directory for this client\'s local storage files')
..addOption('root-domain',
abbr: 'd',
mandatory: false,
help: 'Root Domain',
..addOption(
'root-domain',
abbr: 'd',
mandatory: false,
help: 'Root Domain',
defaultsTo: 'root.atsign.org')
..addFlag('verbose', abbr: 'v', negatable: false, help: 'More logging')
..addFlag('never-sync', negatable: false, help: 'Do not run sync')
..addOption('max-connect-attempts',
help: 'Number of times to attempt to initially connect to atServer.'
' Note: there is a 3-second delay between connection attempts.',
..addOption(
'max-connect-attempts',
help: 'Number of times to attempt to initially connect to atServer.'
' Note: there is a 3-second delay between connection attempts.',
defaultsTo: defaultMaxConnectAttempts.toString());

/// Constructs a CLIBase from a list of command-line arguments
Expand Down Expand Up @@ -149,11 +153,19 @@ class CLIBase {
}

atKeysFilePathToUse =
atKeysFilePath ?? '$homeDir/.atsign/keys/${this.atSign}_key.atKeys';
localStoragePathToUse =
storageDir ?? '$homeDir/.$nameSpace/${this.atSign}/storage';
(atKeysFilePath ?? '$homeDir/.atsign/keys/${this.atSign}_key.atKeys')
.replaceAll('/', Platform.pathSeparator);
localStoragePathToUse = (storageDir ??
standardAtClientStoragePath(
baseDir: homeDir!,
atSign: this.atSign,
progName: nameSpace,
uniqueID: 'single',
))
.replaceAll('/', Platform.pathSeparator);
downloadPathToUse =
downloadDir ?? '$homeDir/.$nameSpace/${this.atSign}/files';
(downloadDir ?? '$homeDir!/.atsign/downloads/${this.atSign}/$nameSpace')
.replaceAll('/', Platform.pathSeparator);

AtSignLogger.defaultLoggingHandler = AtSignLogger.stdErrLoggingHandler;

Expand Down Expand Up @@ -181,7 +193,7 @@ class CLIBase {
..namespace = nameSpace
..downloadPath = downloadPathToUse
..isLocalStoreRequired = true
..commitLogPath = '$localStoragePathToUse/commitLog'
..commitLogPath = '$localStoragePathToUse/commitLog'.replaceAll('/', Platform.pathSeparator)
..rootDomain = rootDomain
..fetchOfflineNotifications = true
..atKeysFilePath = atKeysFilePathToUse
Expand Down
38 changes: 38 additions & 0 deletions packages/at_cli_commons/lib/src/utils.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
import 'dart:io';
import 'package:at_client/at_client.dart';
import 'package:path/path.dart' as path;

String standardAtClientStoragePath({
required String baseDir,
required String atSign,
required String progName, // e.g. npt, sshnp, sshnpd, srvd etc
String uniqueID = 'single',
}) {
return path.normalize('$baseDir'
'/.atsign'
'/storage'
'/$atSign'
'/.$progName'
'/$uniqueID'
.replaceAll('/', Platform.pathSeparator));
}

Directory standardAtClientStorageDir({
required String atSign,
required String progName, // e.g. npt, sshnp, sshnpd, srvd etc
required String uniqueID,
}) {
if (Platform.isWindows) {
return Directory(standardAtClientStoragePath(
baseDir: Platform.environment['TEMP']!,
atSign: atSign,
progName: progName,
uniqueID: uniqueID,
));
} else {
return Directory(standardAtClientStoragePath(
baseDir: getHomeDirectory()!,
atSign: atSign,
progName: progName,
uniqueID: uniqueID,
));
}
}

/// Get the home directory or null if unknown.
String? getHomeDirectory({bool throwIfNull = false}) {
Expand Down
3 changes: 2 additions & 1 deletion packages/at_cli_commons/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: at_cli_commons
description: Library of useful stuff when building cli programs which use the AtClient SDK
version: 1.1.0
version: 1.2.0

repository: https://github.com/atsign-foundation/at_libraries/tree/trunk/packages/at_cli_commons
homepage: https://docs.atsign.com/
Expand All @@ -17,6 +17,7 @@ dependencies:
version: ^3.0.2
logging: ^1.2.0
meta: ^1.11.0
path: ^1.9.0

dev_dependencies:
lints: ^3.0.0
Expand Down
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 @@
## 5.0.1
- fix: export regex utils class
## 5.0.0
- [Breaking Change]feat: Emit the isEncrypted value in the metadata if it is false
- fix: update pkam regex to accept sha512 as hashing algo
Expand Down
1 change: 1 addition & 0 deletions packages/at_commons/lib/at_commons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export 'package:at_commons/src/verb/verb_util.dart';
export 'package:at_commons/src/auth/auth_mode.dart';
export 'package:at_commons/src/verb/enroll_params.dart';
export 'package:at_commons/src/enroll/enrollment.dart';
export 'package:at_commons/src/utils/at_key_regex_utils.dart';
@experimental
export 'package:at_commons/src/telemetry/at_telemetry.dart';
export 'package:at_commons/src/utils/string_utils.dart';
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: 5.0.0
version: 5.0.1
repository: https://github.com/atsign-foundation/at_libraries
homepage: https://atsign.dev

Expand Down
5 changes: 5 additions & 0 deletions packages/at_onboarding_cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.8.0
- feat: add `unrevoke` command to the activate CLI
- feat: add `delete` command to the activate CLI
## 1.7.0
- feat: add `auto` command to the activate CLI
## 1.6.4
- build[deps]: upgrade: \
at_client to 3.2.2 | at_commons to 5.0.0 | at_lookup to 3.0.49 | at_utils to 3.0.19 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import 'package:at_onboarding_cli/at_onboarding_cli.dart';
import 'package:at_onboarding_cli/src/util/at_onboarding_exceptions.dart';
import 'package:at_utils/at_logger.dart';

@Deprecated('Use auth_cli')
Future<void> main(List<String> arguments) async {
int exitCode = await wrappedMain(arguments);
exit(exitCode);
}

@Deprecated('Use auth_cli')
Future<int> wrappedMain(List<String> arguments) async {
//defaults
String rootServer = 'root.atsign.org';
Expand Down Expand Up @@ -57,6 +59,7 @@ Future<int> wrappedMain(List<String> arguments) async {
return await activate(argResults);
}

@Deprecated('Use auth_cli')
Future<int> activate(ArgResults argResults,
{AtOnboardingService? atOnboardingService}) async {
stdout.writeln('[Information] Root server is ${argResults['rootServer']}');
Expand Down
Loading

0 comments on commit ab88f5e

Please sign in to comment.