onboard method
- @Deprecated('Use AtAuthService.onboard method')
- required AtClientPreference atClientPreference,
- String? atsign,
Returns true
on successfully completing onboarding.
Throws OnboardingStatus.atSignNotFound
exception if atsign not found.
Throws OnboardingStatus.privateKeyNotFound
exception if privatekey not found.
Implementation
@Deprecated('Use AtAuthService.onboard method')
Future<bool> onboard(
{required AtClientPreference atClientPreference, String? atsign}) async {
AtChops? atChops;
// If optional argument "atSign" is null, fetches the atSign from the keyChainManager
if (atsign.isNull) {
atsign = await keyChainManager.getAtSign();
}
atsign = _formatAtSign(atsign);
if (atsign.isNull) {
_logger.severe('$atsign atSign is not found');
throw OnboardingStatus.ATSIGN_NOT_FOUND;
}
atChops = createAtChops(await getKeysFromKeyChainManager(atsign));
await _init(atsign, atClientPreference, atChops);
await persistKeys(atsign);
var keyRestorePolicyStatus = await getKeyRestorePolicy(atsign);
if (keyRestorePolicyStatus == OnboardingStatus.ACTIVATE ||
keyRestorePolicyStatus == OnboardingStatus.RESTORE) {
throw (keyRestorePolicyStatus);
}
await _sync();
return true;
}