The context is a paragraph discussing conspiracy against a prince (i.e. ruler). When a conspirator looks for support from other people, anyone who gets involved in the conspiracy is constantly at risk of being betrayed to the ruler in return for a reward. This is what Machiavelli in the words preceding the quote in the question:
As soon as you have opened your mind to a dissatisfied person, you have given him the material with which to satisfy himself, because by informing on you he can look for every advantage. So, because of the certain gains from informing and the uncertain gains and certain dangers from conspiring, (...)
So in order to be loyal to you or to support you (see the synonyms for keep faith with in Collins), a co-conspirator
must be a very true friend [i.e. of you], or a thoroughly determined enemy of the prince to keep faith with you [i.e., you as a conspirator, after you have revealed your intentions].
For comparison, here is the relevant passage in Peter Bondanella's translation (Oxford University Press, 2005, 2008):
Anyone who conspires cannot act alone, (...). As soon as you have revealed your intention to one malcontent, you give him the means to make himself content, since he can have everything he desires by revealing the plot. This is so much the case that, seeing a sure gain on the one hand, and one that is doubtful and full of danger on the other, if he is to remain loyal to you he must either be a rare kind of friend or a wholly obstinate enemy of the prince.
Response to a comment saying that Machiavelli is here giving advice to the prince:
It is important to be aware of the fact that the pronoun "you" in The Prince does not always refer to the ruler (the "prince"). This becomes obvious when you substitute "the prince" for "you" in this whole passage (and adapt "your" etc accordingly):
A conspirator cannot act alone, nor can he take a companion except from those whom he believes to be dissatisfied. As soon as the prince [has] opened his mind to a dissatisfied person, he [has] given him the material with which to satisfy himself, because by informing on the prince he can look for every advantage. So, because of the certain gains from informing and the uncertain gains and certain dangers from conspiring, he must be a very true friend, or a thoroughly determined enemy of the prince, to keep faith with the prince.
This obviously does not make sense, since "informing" here refers to revealing the conspiracy to the prince. "You" here refers to someone who is thinking of starting a conspiracy against the prince.