at_onboarding_cli 1.0.0 copy "at_onboarding_cli: ^1.0.0" to clipboard
at_onboarding_cli: ^1.0.0 copied to clipboard

outdated

Library to authenticate and onboard @sign.

Now for some internet optimism. #

at_onboarding_cli #

Introduction #

at_onboarding_cli is a ibrary to authenticate and onboard @signs.

Get Started #

To add this package as the dependency in your pubspec.yaml

dependencies:
  at_onboarding_cli: ^1.0.0

Getting Dependencies

dart pub get 

To import the library in your application code

import 'package:at_onboarding_cli/at_onboarding_cli.dart';

Usage #

Use cases for at_cli_onboarding:
1) Authentication
2) Onboarding

Setting valid preferences: #

  1. isLocalStorageRequired needs to be set to true as AtClient now needs a local secondary in order to work.
  2. As a result of Step 1, one also needs to provide commitLogPath and hiveStoragePath.
  3. One must set the namespace variable to match the name of their app.
  4. atKeysFile path should contain the file name.
  5. downloadPath should only contain name of the dirctory where the .atKeysFile is expected to be generated.
  • Set AtOnboardingPreference to your preferred settings. These preferences will be used to configure the AtOnboardingService.
 AtOnboardingPreference atOnboardingPreference = AtOnboardingPreference()
       ..rootDomain = 'root.atsign.org
       ..qrCodePath = 'storage/qr_code.png'
       ..hiveStoragePath = 'storage/hive'
       ..namespace = 'example'
       ..downloadPath = 'storage/files'
       ..isLocalStoreRequired = true
       ..commitLogPath = 'storage/commitLog'
       ..cramSecret = '<your cram secret>'
       ..privateKey = '<your private key here>'
       ..atKeysFilePath = 'storage/alice_key.atKeys';

Authentication: #

Proving that one actually owns the @sign. User needs to authenticate before performing operations on that @sign. Operations include reading, writing, deleting or updating data in the atsign's keystore and sending notifications from that @sign.

Steps to Authenticate

  1. Import at_cli_onboarding.
  2. Set preferences using AtOnboardingPreference. Either of secret key or path to .atKeysFile need to be provided to authenticate.
  3. Instantiate AtOnboardingServiceImpl using the required @sign and a valid instance of AtOnboardingPreference.
  4. Call the authenticate method on AtOnboardingService.
  5. Use getAtLookup/getAtClient to get authenticated instances of AtLookup and AtClient respectively which can be used to perform more complex operations on the @sign.
AtOnboardingService atOnboardingService = AtOnboardingServiceImpl('@alice', atOnboardingPreference);
atOnboardingService.authenticate();
AtClient? atClient = await atOnboardingService.getAtClient();
AtLookup? atLookup = atOnboardingService.getAtLookup();

Onboarding: #

Performing initial one-time authentication using cram secret encoded in the qr_code. This process activates the @sign making it ready to use.

Steps to onboard:

  1. Import at_cli_onboarding.
  2. Set preferences using AtOnboardingPreference. Either of cram_secret or path to qr_code containing cram_secret need to be provided in order to activate the @sign.
  3. Setting the download path is mandatory in AtOnboardingPreference in order to save the .atKeysFile which contains necessary keys to authenticate.
  4. Instantiate AtOnboardingServiceImpl using the required @sign and a valid instance of AtOnboardingPreference.
  5. Call the onboard on AtOnboardingServiceImpl.
  6. Use getAtLookup/getAtClient to get authenticated instances of AtLookup and AtClient respectively which can be used to perform more complex operations on the @sign.
AtOnboardingService atOnboardingService = AtOnboardingServiceImpl('@alice', atOnboardingPreference);
atOnboardingService.onboard();
AtClient? atClient = await atOnboardingService.getAtClient();
AtLookup? atLookup = atOnboardingService.getAtLookup();

Please refer to example for more details.

Open source usage and contributions #

This is freely licensed open source code, so feel free to use it as is, suggest changes or enhancements or create your own version. See CONTRIBUTING.md for detailed guidance on how to setup tools, tests and make a pull request.