doesRelayCoverPubkey static method
bool
doesRelayCoverPubkey(
- RelayConnectivity<
JitEngineRelayConnectivityData> relay, - String pubkey,
- ReadWriteMarker direction
checks if relay covers given pubkey in given direction
Implementation
static bool doesRelayCoverPubkey(
RelayConnectivity<JitEngineRelayConnectivityData> relay,
String pubkey,
ReadWriteMarker direction,
) {
for (RelayJitAssignedPubkey assignedPubkey
in relay.specificEngineData!.assignedPubkeys) {
if (assignedPubkey.pubkey == pubkey) {
switch (direction) {
case ReadWriteMarker.readOnly:
return assignedPubkey.direction.isRead;
case ReadWriteMarker.writeOnly:
return assignedPubkey.direction.isWrite;
case ReadWriteMarker.readWrite:
return assignedPubkey.direction == ReadWriteMarker.readWrite;
default:
return false;
}
}
}
return false;
}