Skip to content

Commit

Permalink
chore: sync protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
dufkan committed Mar 23, 2024
1 parent 788bb4c commit 8c04fa6
Show file tree
Hide file tree
Showing 9 changed files with 467 additions and 90 deletions.
6 changes: 3 additions & 3 deletions meesign_core/lib/src/data/network_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ class NetworkDispatcher {
final bool allowBadCerts;

// TODO: shutdown?
final Map<Uuid, rpc.MPCClient> _clients = HashMap();
final Map<Uuid, rpc.MeeSignClient> _clients = HashMap();

late final unauth = _createClient(certKey: null);

NetworkDispatcher(this.host, this._keyStore,
{this.serverCerts, this.allowBadCerts = false, this.port = 1337});

rpc.MPCClient _createClient({List<int>? certKey}) => ClientFactory.create(
rpc.MeeSignClient _createClient({List<int>? certKey}) => ClientFactory.create(
host,
key: certKey,
password: '',
Expand All @@ -32,7 +32,7 @@ class NetworkDispatcher {
connectTimeout: const Duration(seconds: 8),
);

rpc.MPCClient operator [](Uuid did) {
rpc.MeeSignClient operator [](Uuid did) {
_clients[did] ??= _createClient(certKey: _keyStore.load(did));
return _clients[did]!;
}
Expand Down
2 changes: 1 addition & 1 deletion meesign_network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ If you modify a file in [proto](proto), regenerate the Dart gRPC code:
3. Generate Dart code:

```bash
protoc --experimental_allow_proto3_optional --plugin=/path/to/bin/protoc-gen-dart --dart_out=grpc:lib/src/generated/ -I proto proto/mpc.proto
protoc --experimental_allow_proto3_optional --plugin=/path/to/bin/protoc-gen-dart --dart_out=grpc:lib/src/generated/ -I proto proto/meesign.proto
```

4. Format the generated code:
Expand Down
2 changes: 1 addition & 1 deletion meesign_network/lib/grpc.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export 'package:grpc/grpc.dart' show GrpcError;

export 'src/generated/mpc.pbgrpc.dart';
export 'src/generated/meesign.pbgrpc.dart';
6 changes: 3 additions & 3 deletions meesign_network/lib/src/client_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:io';

import 'package:grpc/grpc.dart';

import 'generated/mpc.pbgrpc.dart';
import 'generated/meesign.pbgrpc.dart';

class ClientChannelCredentials extends ChannelCredentials {
final List<int>? _key;
Expand Down Expand Up @@ -39,7 +39,7 @@ class ClientChannelCredentials extends ChannelCredentials {
}

class ClientFactory {
static MPCClient create(
static MeeSignClient create(
String host, {
List<int>? key,
String? password,
Expand All @@ -49,7 +49,7 @@ class ClientFactory {
int port = 1337,
Duration? connectTimeout,
}) =>
MPCClient(
MeeSignClient(
ClientChannel(
host,
port: port,
Expand Down
Loading

0 comments on commit 8c04fa6

Please sign in to comment.