Files

18 lines
620 B
Dart

import '../api_gateway.dart';
final _identities = Expando<String>('logical server identity');
/// Aliases share an identity; switching profiles creates a fresh app/gateway.
void bindServerIdentity(ApiGateway gateway, String? id) {
_identities[gateway] = id;
}
String? serverIdentity(ApiGateway gateway) => _identities[gateway];
/// Existing local data belongs only to the migrated original server.
String serverStorageScope(String? id) =>
id == null || id == 'legacy-server' ? '' : id;
String scopedServerKey(String key, String scope) =>
scope.isEmpty ? key : '$key.server.${Uri.encodeComponent(scope)}';