Authentication

How to authenticate to an atServer

Dart

Package Installation

In Dart we provide the at_onboarding_cli package which handles onboarding to the atServer via files stored in the ~/.atsign/keys directory

Add the package to your project automatically using pub:

dart pub add at_onboarding_cli

Usage

Set up the preferences to onboard to the atServer.

 AtOnboardingPreference atOnboardingConfig = AtOnboardingPreference()
    ..hiveStoragePath = '$homeDirectory/.$nameSpace/$fromAtsign/storage'
    ..namespace = nameSpace
    ..downloadPath = '$homeDirectory/.$nameSpace/files'
    ..isLocalStoreRequired = true
    ..commitLogPath = '$homeDirectory/.$nameSpace/$fromAtsign/storage/commitLog'
    ..rootDomain = rootDomain
    ..fetchOfflineNotifications = true
    ..atKeysFilePath = atsignFile
    ..atProtocolEmitted = Version(2, 0, 0);

Next get the onboardingService

Finally wait to be onboarded, this returns true once complete.

This can be wrapped to check that the onboard was successful with the code snippet below.

Last updated