Magic exists which can divine the intentions of other creatures toward me.
"Wand of Enemy Detection"
While holding it, you can use an action and expend 1 charge to speak its Command Word. For the next minute, you know the direction of the nearest creature Hostile to you within 60 feet, but not its distance from you. The wand can sense the presence of Hostile creatures that are ethereal, Invisible, disguised, or hidden, as well as those in plain sight.
Arcane Archer: Shadow Arrow (emphasis mine)
You weave illusion magic into your arrow, causing it to occlude your foe’s vision with shadows. The creature hit by the arrow takes an extra 2d6 psychic damage, and it must succeed on a Wisdom saving throw or be unable to see anything farther than 5 feet away until the start of your next turn.
Abilities and Effects do what they say they do. There is no fluff in descriptions. As written, it appears that if I hit a creature with my Shadow Arrow, it does regular arrow damage plus 2d6 psychic damage. In addition, if the creature hit is my foe, it must make a Wisdom save or have its vision occluded.
Suppose I want to determine if an NPC of uncertain loyalty is my foe or not. I hit him with Shadow Arrows. If his vision becomes occluded, he must be my foe. If not, he is either not my foe or he has made his save.
Does the Shadow Arrow really know who is my foe, similar to a wand of enemy detection, or does it assume that anyone I would shoot at must be my foe?
If the latter, could an NPC that was trying to gain my trust volunteer to receive my arrow? Would that affect the result if they were being truthful? Deceptive?
If my DM has me roll critical fails as attacks on allies when I fire into a melee, can I be confident that my shadow arrow will not be able to occlude the vision of anyone friendly to me?
Related: What is the definition of hostile?
What is the difference between "hostile" and "enemy"?
What is considered an enemy for an Orc's Aggressive trait?