fix(useragent): unsafe, but working implementation of ml-dsa
This commit is contained in:
@@ -50,7 +50,9 @@ class ArbiterUrl {
|
||||
try {
|
||||
return base64Url.decode(base64Url.normalize(cert));
|
||||
} on FormatException catch (error) {
|
||||
throw FormatException("Invalid base64 in 'cert' query parameter: ${error.message}");
|
||||
throw FormatException(
|
||||
"Invalid base64 in 'cert' query parameter: ${error.message}",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,9 @@ Future<Connection> connectAndAuthorize(
|
||||
final solutionResponse = await connection.ask(
|
||||
UserAgentRequest(
|
||||
auth: ua_auth.Request(
|
||||
challengeSolution: ua_auth.AuthChallengeSolution(signature: signature),
|
||||
challengeSolution: ua_auth.AuthChallengeSolution(
|
||||
signature: signature,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -85,7 +85,9 @@ class Connection {
|
||||
if (response.hasId()) {
|
||||
final completer = _pendingRequests.remove(response.id);
|
||||
if (completer == null) {
|
||||
talker.warning('Received response for unknown request id ${response.id}');
|
||||
talker.warning(
|
||||
'Received response for unknown request id ${response.id}',
|
||||
);
|
||||
return;
|
||||
}
|
||||
completer.complete(response);
|
||||
|
||||
@@ -9,9 +9,7 @@ Future<List<WalletEntry>> listEvmWallets(Connection connection) async {
|
||||
UserAgentRequest(evm: ua_evm.Request(walletList: Empty())),
|
||||
);
|
||||
if (!response.hasEvm()) {
|
||||
throw Exception(
|
||||
'Expected EVM response, got ${response.whichPayload()}',
|
||||
);
|
||||
throw Exception('Expected EVM response, got ${response.whichPayload()}');
|
||||
}
|
||||
|
||||
final evmResponse = response.evm;
|
||||
@@ -37,9 +35,7 @@ Future<void> createEvmWallet(Connection connection) async {
|
||||
UserAgentRequest(evm: ua_evm.Request(walletCreate: Empty())),
|
||||
);
|
||||
if (!response.hasEvm()) {
|
||||
throw Exception(
|
||||
'Expected EVM response, got ${response.whichPayload()}',
|
||||
);
|
||||
throw Exception('Expected EVM response, got ${response.whichPayload()}');
|
||||
}
|
||||
|
||||
final evmResponse = response.evm;
|
||||
|
||||
@@ -10,9 +10,7 @@ Future<List<GrantEntry>> listEvmGrants(Connection connection) async {
|
||||
UserAgentRequest(evm: ua_evm.Request(grantList: request)),
|
||||
);
|
||||
if (!response.hasEvm()) {
|
||||
throw Exception(
|
||||
'Expected EVM response, got ${response.whichPayload()}',
|
||||
);
|
||||
throw Exception('Expected EVM response, got ${response.whichPayload()}');
|
||||
}
|
||||
|
||||
final evmResponse = response.evm;
|
||||
@@ -50,9 +48,7 @@ Future<int> createEvmGrant(
|
||||
final resp = await connection.ask(request);
|
||||
|
||||
if (!resp.hasEvm()) {
|
||||
throw Exception(
|
||||
'Expected EVM response, got ${resp.whichPayload()}',
|
||||
);
|
||||
throw Exception('Expected EVM response, got ${resp.whichPayload()}');
|
||||
}
|
||||
|
||||
final evmResponse = resp.evm;
|
||||
@@ -70,15 +66,11 @@ Future<int> createEvmGrant(
|
||||
Future<void> deleteEvmGrant(Connection connection, int grantId) async {
|
||||
final response = await connection.ask(
|
||||
UserAgentRequest(
|
||||
evm: ua_evm.Request(
|
||||
grantDelete: EvmGrantDeleteRequest(grantId: grantId),
|
||||
),
|
||||
evm: ua_evm.Request(grantDelete: EvmGrantDeleteRequest(grantId: grantId)),
|
||||
),
|
||||
);
|
||||
if (!response.hasEvm()) {
|
||||
throw Exception(
|
||||
'Expected EVM response, got ${response.whichPayload()}',
|
||||
);
|
||||
throw Exception('Expected EVM response, got ${response.whichPayload()}');
|
||||
}
|
||||
|
||||
final evmResponse = response.evm;
|
||||
|
||||
@@ -8,9 +8,7 @@ Future<Set<int>> readClientWalletAccess(
|
||||
required int clientId,
|
||||
}) async {
|
||||
final response = await connection.ask(
|
||||
UserAgentRequest(
|
||||
sdkClient: ua_sdk.Request(listWalletAccess: Empty()),
|
||||
),
|
||||
UserAgentRequest(sdkClient: ua_sdk.Request(listWalletAccess: Empty())),
|
||||
);
|
||||
if (!response.hasSdkClient()) {
|
||||
throw Exception(
|
||||
@@ -33,9 +31,7 @@ Future<List<ua_sdk.WalletAccessEntry>> listAllWalletAccesses(
|
||||
Connection connection,
|
||||
) async {
|
||||
final response = await connection.ask(
|
||||
UserAgentRequest(
|
||||
sdkClient: ua_sdk.Request(listWalletAccess: Empty()),
|
||||
),
|
||||
UserAgentRequest(sdkClient: ua_sdk.Request(listWalletAccess: Empty())),
|
||||
);
|
||||
if (!response.hasSdkClient()) {
|
||||
throw Exception(
|
||||
@@ -81,9 +77,7 @@ Future<void> writeClientWalletAccess(
|
||||
UserAgentRequest(
|
||||
sdkClient: ua_sdk.Request(
|
||||
revokeWalletAccess: ua_sdk.RevokeWalletAccess(
|
||||
accesses: [
|
||||
for (final walletId in toRevoke) walletId,
|
||||
],
|
||||
accesses: [for (final walletId in toRevoke) walletId],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -17,9 +17,9 @@ class StoredServerInfo {
|
||||
final int port;
|
||||
final String caCertFingerprint;
|
||||
|
||||
factory StoredServerInfo.fromJson(Map<String, dynamic> json) => _$StoredServerInfoFromJson(json);
|
||||
factory StoredServerInfo.fromJson(Map<String, dynamic> json) =>
|
||||
_$StoredServerInfoFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$StoredServerInfoToJson(this);
|
||||
|
||||
}
|
||||
|
||||
abstract class ServerInfoStorage {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:arbiter/features/connection/connection.dart';
|
||||
import 'package:arbiter/proto/user_agent/vault/bootstrap.pb.dart' as ua_bootstrap;
|
||||
import 'package:arbiter/proto/user_agent/vault/bootstrap.pb.dart'
|
||||
as ua_bootstrap;
|
||||
import 'package:arbiter/proto/user_agent/vault/unseal.pb.dart' as ua_unseal;
|
||||
import 'package:arbiter/proto/user_agent/vault/vault.pb.dart' as ua_vault;
|
||||
import 'package:arbiter/proto/user_agent.pb.dart';
|
||||
@@ -27,9 +28,7 @@ Future<ua_bootstrap.BootstrapResult> bootstrapVault(
|
||||
),
|
||||
);
|
||||
if (!response.hasVault()) {
|
||||
throw Exception(
|
||||
'Expected vault response, got ${response.whichPayload()}',
|
||||
);
|
||||
throw Exception('Expected vault response, got ${response.whichPayload()}');
|
||||
}
|
||||
|
||||
final vaultResponse = response.vault;
|
||||
|
||||
Reference in New Issue
Block a user