authenticate method
Implementation
@override
Future<void> authenticate(semantic.AgentAuthentication selection) async {
_requireOpen();
final advertised = _initialized.authMethods ?? const <wire.AuthMethod>[];
final selected = advertised.whereType<wire.AuthMethodAgentVariant>().any(
(method) => method.id.value == selection.id,
);
if (!selected) {
throw AgentCapabilityException(
'Authentication method `${selection.id}` was not advertised.',
);
}
try {
await _connection.authenticate(
wire.AuthenticateRequest(methodId: wire.AuthMethodId(selection.id)),
);
} catch (error, stackTrace) {
throwWrappedAcpConnection(error, stackTrace);
}
}