Onboarding a new Atsign
Learn how to do the initial onboard for an Atsign in your Dart application using AtAuth.onboard
What is onboarding?
Onboarding is the one-time process of activating an Atsign. An "onboarded" or "activated" Atsign means the .atKeys file for the corresponding Atsign and atServer is generated. To onboard the same Atsign again, the Atsign needs to be reset.
Every later authentication uses Authenticating an existing Atsign. If you are building an application that only uses and assumes already-onboarded Atsigns, then move onto the next section: Authenticating an existing Atsign.
Prerequisites
A registered, but not yet activated Atsign.
Its CRAM Key (also known as the CRAM secret/license key/activation secret)
The core classes
AtAuth
Object that holds onboarding/authentication logic. Contains AtAuth.onboard which we will be covering in this section.
AtOnboardingRequest
Represents a request to onboard an Atsign
AtOnboardingResponse
Represents a response after AtAuth.onboard was executed
Onboarding flows
There are a ton of different ways to parameterize AtAuth.onboard either by manipulating AtOnboardingRequest or passing different values into the AtAuth.onboard's function.
Simple Atsign onboard, use all defaults
Customize the output .atKeys file path
Use a custom atDirectory host:port
Save .atKeys file behind a password
Implement retry and timeout functionality to AtAuth.onboard
Listen for events during the AtAuth.onboard process
Save .atKeys to memory instead of to a file. Good for ephemeral enrollments. Not recommended for beginners.
Do the first part of CRAM onboarding, then delay the creation of cryptographic keys. Good for Atsign developer debugging. Not recommended for beginners.
The minimal flow
Copy and paste the code below. Be sure to replace the values of the variables atsign and cramKey accordingly to the Atsign you registered and the CRAM key which can be fetched from the dashboard.
Custom keys path
Specify a different output directory using FileAtKeysIo.
Custom root domain
Specify a different atDirectory host:port
Password-protected file
You can implement password protected .atKeys files by passing a passPhrase to FileAtKeysIo
Custom retry/timeout
Use retryOptions in AtOnobardingRequest to offer a good user experience for your users in your Dart application.
Progress listening
Listen for events using atAuth.progressStream.listen .
In-memory keys
The main use for InMemoryAtKeysIo is for saving the cryptographic .atKeys in memory.
Deferred activation
This flow is useful for when you want to add more logging or developer testing. This flow is generally not recommended because an adequate amount of logging already occurs in onboarding, but is available if need be. For progress listening and logging, it is recommended to use Progress listening flow instead.
Onboarding again
If you want to test your onboarding flow again with the same Atsign, you must reset your Atsign. Note that this will completely wipe your Atsign's atServer, all of its data, and also render your current set of .atKeys incapable of authenticating to its Atsign. See our section on Resetting your Atsign.
Last updated