feat(useragent): bootstrap / unseal flow implementattion
This commit is contained in:
@@ -6,6 +6,7 @@ part 'bootstrap_token.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class BootstrapToken extends _$BootstrapToken {
|
||||
@override
|
||||
String? build() {
|
||||
return null;
|
||||
}
|
||||
@@ -14,9 +15,13 @@ class BootstrapToken extends _$BootstrapToken {
|
||||
state = token;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
state = null;
|
||||
}
|
||||
|
||||
String? take() {
|
||||
final token = state;
|
||||
state = null;
|
||||
return token;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ final class BootstrapTokenProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$bootstrapTokenHash() => r'a59e679ab0561ed2ab4148660499891571d439db';
|
||||
String _$bootstrapTokenHash() => r'5c09ea4480fc3a7fd0d0a0bced712912542cca5d';
|
||||
|
||||
abstract class _$BootstrapToken extends $Notifier<String?> {
|
||||
String? build();
|
||||
|
||||
@@ -20,12 +20,18 @@ class ConnectionManager extends _$ConnectionManager {
|
||||
}
|
||||
final Connection connection;
|
||||
try {
|
||||
connection = await connectAndAuthorize(serverInfo, key, bootstrapToken: token);
|
||||
connection = await connectAndAuthorize(
|
||||
serverInfo,
|
||||
key,
|
||||
bootstrapToken: token,
|
||||
);
|
||||
if (token != null) {
|
||||
ref.read(bootstrapTokenProvider.notifier).clear();
|
||||
}
|
||||
} catch (e) {
|
||||
talker.handle(e);
|
||||
rethrow;
|
||||
}
|
||||
|
||||
|
||||
ref.onDispose(() {
|
||||
final connection = state.asData?.value;
|
||||
|
||||
@@ -33,7 +33,7 @@ final class ConnectionManagerProvider
|
||||
ConnectionManager create() => ConnectionManager();
|
||||
}
|
||||
|
||||
String _$connectionManagerHash() => r'8923346dff75a9a06127c71a0a39ca65d9733d8c';
|
||||
String _$connectionManagerHash() => r'd01084e550f315bc6cadfe74413a7f959426a80e';
|
||||
|
||||
abstract class _$ConnectionManager extends $AsyncNotifier<Connection?> {
|
||||
FutureOr<Connection?> build();
|
||||
|
||||
Reference in New Issue
Block a user