more punishment cleanup
This commit is contained in:
@@ -91,6 +91,13 @@ extension DHTRecordDescriptorExt on DHTRecordDescriptor {
|
||||
}
|
||||
return KeyPair(key: owner, secret: ownerSecret!);
|
||||
}
|
||||
|
||||
TypedKeyPair? ownerTypedKeyPair() {
|
||||
if (ownerSecret == null) {
|
||||
return null;
|
||||
}
|
||||
return TypedKeyPair(kind: key.kind, key: owner, secret: ownerSecret!);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
@@ -21,6 +21,8 @@ String cryptoKindToString(CryptoKind kind) {
|
||||
return "${String.fromCharCode(kind & 0xFF)}${String.fromCharCode((kind >> 8) & 0xFF)}${String.fromCharCode((kind >> 16) & 0xFF)}${String.fromCharCode((kind >> 24) & 0xFF)}";
|
||||
}
|
||||
|
||||
const CryptoKind bestCryptoKind = cryptoKindVLD0;
|
||||
|
||||
Uint8List cryptoKindToBytes(CryptoKind kind) {
|
||||
var b = Uint8List(4);
|
||||
b[0] = kind & 0xFF;
|
||||
@@ -140,6 +142,8 @@ class TypedKeyPair extends Equatable {
|
||||
String toJson() => toString();
|
||||
factory TypedKeyPair.fromJson(dynamic json) =>
|
||||
TypedKeyPair.fromString(json as String);
|
||||
factory TypedKeyPair.fromKeyPair(CryptoKind kind, KeyPair keyPair) =>
|
||||
TypedKeyPair(kind: kind, key: keyPair.key, secret: keyPair.secret);
|
||||
}
|
||||
|
||||
typedef CryptoKey = FixedEncodedString43;
|
||||
|
Reference in New Issue
Block a user