This commit is contained in:
Christien Rioux 2023-08-01 00:39:50 -04:00
parent 57c366ef91
commit c35056f687
39 changed files with 1382 additions and 662 deletions

View file

@ -1,6 +1,6 @@
import 'dart:typed_data';
import 'package:veilid/veilid.dart';
import '../veilid_support/veilid_support.dart';
import 'proto/veilidchat.pb.dart' as proto;
@ -124,3 +124,34 @@ extension TypedKeyProto on TypedKey {
static TypedKey fromProto(proto.TypedKey p) =>
TypedKey(kind: p.kind, value: CryptoKeyProto.fromProto(p.value));
}
/// KeyPair protobuf marshaling
///
extension KeyPairProto on KeyPair {
proto.KeyPair toProto() {
final out = proto.KeyPair()
..key = key.toProto()
..secret = secret.toProto();
return out;
}
static KeyPair fromProto(proto.KeyPair p) => KeyPair(
key: CryptoKeyProto.fromProto(p.key),
secret: CryptoKeyProto.fromProto(p.secret));
}
/// OwnedDHTRecordPointer protobuf marshaling
///
extension OwnedDHTRecordPointerProto on OwnedDHTRecordPointer {
proto.OwnedDHTRecordPointer toProto() {
final out = proto.OwnedDHTRecordPointer()
..recordKey = recordKey.toProto()
..owner = owner.toProto();
return out;
}
static OwnedDHTRecordPointer fromProto(proto.OwnedDHTRecordPointer p) =>
OwnedDHTRecordPointer(
recordKey: TypedKeyProto.fromProto(p.recordKey),
owner: KeyPairProto.fromProto(p.owner));
}