I want to create a vault program to store spl token which transferred by A to B. What is the best way to achieve anonymity of B when the token remains in the vault? If B's key is encrypted, how can B verifies the balance he/she has in the vault. And, upon B transfers the balance to his/her wallet I don't want anyone to be able to trace the link between B and the transfer transactions made by A to B such as date and time. Can all these be possible with Zero-Knowledge Proof?
Take a read through here it might be what you’re looking for.
Note that while the token22 program is deployed on mainnet, the confidential extension is not usable until QUIC is rolled out on all validators. The current transaction size limits are too small.
You can play around with it locally though (more info).