A Flutter extension to the at_client library which adds support for mobile, desktop, and IoT devices.
SDK that provides the essential methods for building an app using The atProtocol. You may also want to look at at_client.
at_client_mobile package is written in Dart, supports Flutter, and follows the atPlatform's decentralized, edge computing model with the following features:
- Cryptographic control of data access through personal data stores
- No application backend needed
- End to end encryption where only the data owner has the keys
- Private and surveillance free connectivity
We call giving people control of access to their data "flipping the internet".
Before using this package for the first time, you should follow the getting started guide
You may find it useful to read the atPlatform overview.
This package is available on pub.dev at https://pub.dev/packages/at_client_mobile
- Get
KeyChainManager
instance to manage your keys while switching between atSigns.
import 'package:at_client_mobile/at_client_mobile.dart';
static final KeyChainManager _keyChainManager = KeyChainManager.getInstance();
/// Fetch atsign from the keychain manager
String atSign = await _keyChainManager.getAtSign();
- Delete atSign from the keychain manager
await _keyChainManager.deleteAtSignFromKeychain(atsign);
- Fetch List of atSigns from the keychain manager.
List<String>? atSignsList = await _keyChainManager.getAtSignListFromKeychain();
- Make an atSign primary in device storage.
AtClientManager.getInstance().setCurrentAtSign(atsign, AppConstants.appNamespace, AtClientPreference());
bool isAtsignSetPrimary = await _keyChainManager.makeAtSignPrimary(atsign);
print(isAtsignSetPrimary); // Prints true if set primary.
- Get atSign status from device storage.
Map<String, bool?> atSignsWithState = await _keyChainManager.getAtsignsWithStatus();
print(atSignsWithState); // Prints a map of atSigns with their status.
/// Output:
/// {
/// "@atSign1": true, // atSign1 is set as primary
/// "@atSign2": false,
/// "@atSign3": false
/// }
- Reset atSigns from device storage.
for (String atsign in atSignsList) {
await _keyChainManager.resetAtSignFromKeychain(atsign);
}
- Get
AtClientService
instance to manage your atSigns.
OnboardingWidgetService
is used to onboard your atSigns. Ckeck out the at_onboarding_flutter for more details.
Map<String?, AtClientService> atClientServiceMap = {};
/// Onboarding widget
OnboardingWidgetService().onboarding(
fistTimeAuthNextScreen: FirstTimeScreen(),
nextScreen: null,
atsign: myAtSign,
onboard: (value, atsign) async {
atClientServiceMap = value;
//... YOUR CODE ...//
},
onError: (error) {
print(error);
},
);
- Remove an atSign from the AtClientService.
await _keyChainManager.deleteAtSignFromKeychain(atsign);
atClientServiceMap.remove(atsign);
- Check if an atSign is onboarded.
bool isOnboarded = atClientServiceMap.containsKey(atsign);
print(isOnboarded); // Prints true if onboarded.
- Format of the .env file
NAMESPACE = "at_client_demo"
ROOT_DOMAIN = "root.atsign.org"
- Adding the .env file to pubspec.yaml
flutter:
assets:
- .env
- If your app supports windows platform then add
biometric_storage
in app's dependencies
dependencies:
biometric_storage: ^4.1.3
We have a good example with explanation in the at_client_mobile package.