mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-05-06 16:25:15 -04:00
dht work
This commit is contained in:
parent
57c366ef91
commit
c35056f687
39 changed files with 1382 additions and 662 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue