AtClient class abstract
Interface for a client application that can communicate with a secondary server.
- Implementers
- Available extensions
Constructors
- AtClient()
Properties
- atKeysIo → AtKeysIo?
-
The client's key source (
package:at_auth), given at construction throughAtClientImpl.create(atKeysIo:), which requires one.CryptoRuntimethreads it to providers asCryptoContext.io.no setter - atSign → Atsign
-
no setter
- connection → AtConnection
-
Whether this client has reached its atServer: online, offline or
refused, as a current value and a stream of changes, with a way to try
again now.
no setter
-
dataEvents
→ Stream<
DataEvent> -
Stream of DataEvents —
DataUpdatedfor every successful local keystore mutation that passes through the update path,DataDeletedfor every successful one that passes through the delete path. Subscribers see local app writes AND sync-applied remote changes via a single uniform stream. Internal-bookkeeping writes (e.g.putValue) intentionally do NOT emit — see the DataEvent dartdoc.no setter - encryptionService → EncryptionService?
-
no setter
- enrollmentId ↔ String?
-
Enrollment id for apkam enrolled clients
getter/setter pair
- enrollments → Enrollments
-
Available on AtClient, provided by the AtClientEnrollments extension
no setter - enrollmentService ↔ EnrollmentService?
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- isStopped → bool
-
Whether stop has run.
no setter
- notificationService ↔ NotificationService
-
getter/setter pair
-
pendingEmissions
→ Future<
void> -
Resolves once every event currently in-flight on dataEvents
has been delivered to all listeners. Useful for callers that
just performed a write and want to observe the resulting event
before continuing —
await atClient.pendingEmissionsgives "watch streams up-to-date" semantics without sync-emission's re-entrancy / listener-stalls-writer hazards.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- syncService ↔ SyncService
-
getter/setter pair
Methods
-
collection<
T> (String namespace, Duration defaultExpiration, {EventSource eventSource = EventSource.both, T fromJson(Map< String, dynamic> )?, String? typeTag, String? writeTypeTag, bool cleanupOrphansOnCreation = false}) → Future<AtCollection< T> > -
Returns an AtCollection of CItems for the given
namespace. -
delete(
AtKey key, {DeleteRequestOptions? deleteRequestOptions}) → Future< bool> -
Deletes
keyfrom local storage, and sync later pushes the removal to the atServer; DeleteRequestOptions.useRemoteAtServer sends it to the atServer directly, as aremoteOnlypreference does when it is unset. Alocal:key is only ever deleted from local storage. By default namespace that is used to create the AtClient instance will be appended to the key. phone@alice translates to phone.persona@alice where 'persona' is the namespace. If you want to ignoring the namespace setAtKey.metadata.namespaceAwareto false. -
ensureReachable(
String namespace, {Duration timeout = const Duration(seconds: 30)}) → Future< AtReachabilityResult> -
Waits until other atSigns can seal data to
namespacefor this atSign, doing whatever is missing, and reports what happened. -
get(
AtKey key, {GetRequestOptions? getRequestOptions}) → Future< AtValue> -
Gets the value of
key. An uncached key another Atsign owns is always looked up on the atServer; any other key is read wheregetRequestOptionsand AtClientPreference.remoteLocalPref route it, as getMeta describes: local storage by default. If the key was stored with public access, setAtKey.metadata.isPublicto true. If the key was shared with another atSign set AtKey.sharedWith -
getAtKeys(
{String? regex, bool showHiddenKeys = false, bool useRemoteAtServer = false}) → Future< List< AtKey> > -
Get all the keys stored in user's secondary in AtKey format. If
regexis specified only matching keys are returned. IfsharedByis specified, then gets the keys fromsharedByuser shared with current atClient user. IfsharedWithis specified, then gets the keys shared tosharedWithuser from the current atClient user. The scan reads the atServer whenuseRemoteAtServeris true and local storage when it is false;AtClientImplreads an omitted one as unset and follows AtClientPreference.remoteLocalPref. -
getCurrentAtSign(
) → String? - Note - this method name is misleading as 'current' implies the atSign could change - but an AtClient should only ever have one atSign.
-
getKeys(
{String? regex, bool showHiddenKeys = false, bool useRemoteAtServer = false}) → Future< List< String> > -
Get all the keys stored in user's secondary in string format. If
regexis specified only matching keys are returned. IfsharedByis specified, then gets the keys fromsharedByuser shared with current atClient user. IfsharedWithis specified, then gets the keys shared tosharedWithuser from the current atClient user. The scan reads the atServer whenuseRemoteAtServeris true and local storage when it is false;AtClientImplreads an omitted one as unset and follows AtClientPreference.remoteLocalPref. -
getLocalSecondary(
) → LocalSecondary? - The local store this client reads and writes first.
-
getMeta(
AtKey key, {GetRequestOptions? getRequestOptions}) → Future< Metadata?> -
Gets the metadata of
keywithout its value: nothing is decrypted, so a record this client cannot open still answers. -
getOTP(
) → Future< AtResponse> - Returns an OTP (One-Time Password) from the secondary server.
-
getPreferences(
) → AtClientPreference? - The preferences this client runs on. A client raised to its posture floor runs on its own copy of the preference it was given, so a setting changes through this or setPreferences, not through that object.
-
getRemoteSecondary(
) → RemoteSecondary? - The connection this client sends verbs to its atServer on.
-
keyExists(
AtKey key, bool? useRemoteAtServer) → Future< bool> - Does a key exist
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyList(
{String? fromDate, String? toDate, String? regex}) → Future< String> - Returns the list of received notifications of an atsign, Optionally, notifications can be filtered on from date, to date and regular expression
-
notifyStatus(
String notificationId) → Future< String> - Returns the status of the notification
-
put(
AtKey key, dynamic value, {PutRequestOptions? putRequestOptions}) → Future< bool> -
Updates value of AtKey.key is if it is already present. Otherwise creates a new key. Set AtKey.sharedWith if the key
has to be shared with another atSign. Set
AtKey.metadata.isBinaryif you are updating binary value e.g image,file. By default namespace that is used to create the AtClient instance will be appended to the key. phone@alice will be saved as phone.persona@alice where 'persona' is the namespace. If you want to save by ignoring the namespace setAtKey.metadata.namespaceAwareto false. Additional metadata can be set using AtKey.metadata -
putBinary(
AtKey atKey, List< int> value, {PutRequestOptions? putRequestOptions}) → Future<AtResponse> - Used when storing binary data - e.g. images, files etc. See also AtClient.put and AtClient.putText
-
putMeta(
AtKey key, {PutRequestOptions? putRequestOptions}) → Future< bool> -
Updates the metadata of AtKey.key if it is already present. Otherwise creates a new key without a value.
By default namespace that is used to create the AtClient instance will be appended to the key. phone@alice will be saved as
phone.persona@alice where 'persona' is the namespace. If you want to save by ignoring the namespace set
AtKey.metadata.namespaceAwareto false. -
putText(
AtKey atKey, String value, {PutRequestOptions? putRequestOptions}) → Future< AtResponse> - Used to store the textual data into the keystore. Updates value of AtKey.key is if it is already present. Otherwise creates a new key. Set AtKey.sharedWith if the key has to be shared with another atSign. By default namespace that is used to create the AtClient instance will be appended to the key. phone@alice will be saved as phone.persona@alice where 'persona' is the namespace.
-
schemeOf(
AtKey key) → Future< ReceivedScheme> -
Available on AtClient, provided by the ReceivedSchemes extension
Howkey's value was protected, read from its metadata without decrypting it. -
setPreferences(
AtClientPreference preference) → void -
Sets the preferences this client reads, such as its namespace and its
post-quantum posture. A client below its posture floor is raised to it
again, on its own copy of
preference. -
setSPP(
String otp, {Duration? expiry}) → Future< AtResponse> - Sets a Semi Permanent Passcode (SPP) in the secondary server key-store. An SPP is a 6-character alphanumeric code used when submitting an enrollment request. Only connections with access to the "__manage" namespace are allowed to set an SPP.
-
stop(
) → Future< void> -
Stops everything this client runs: the keystore-event timers, the
data-event stream, the sync and notification services and the
connection, whose state ends as
offline(stopped). Every connection the client opened is closed by the time this returns, the monitor's and sync's included, and so is one it was handed. The client's claim on its storage is released; storage built withclosedByClient: trueis closed, while storage the caller supplied otherwise stays open for the caller to close. -
toString(
) → String -
A string representation of this object.
inherited
-
tryAcquireServerMutex(
AtKey key, {required Duration ttl}) → Future< ServerMutexLease?> -
Available on AtClient, provided by the ServerMutex extension
Takes the lockkeynames forttl, or returns null when an immutable record already exists atkey; a mutable record there is overwritten and taken.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- defaultSppExpiry → const Duration