doesRelayCoverPubkey static method

dynamic doesRelayCoverPubkey(
  1. RelayJit relay,
  2. String pubkey,
  3. ReadWriteMarker direction
)

Implementation

static doesRelayCoverPubkey(
  RelayJit relay,
  String pubkey,
  ReadWriteMarker direction,
) {
  for (RelayJitAssignedPubkey assignedPubkey in relay.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;
}