You can keep it in mason jars for a couple of years minimum. Light heat and moisture are its enemies.
6 months it should be at its best.
if you need to keep it longer than 2 years then freeze it.
Your nose is your friend. If it smells like bleach, you know, that ammonia smell, then you've got a problem and best not to consume. If it smells like cut grass or hay you have a process problem but it is still fine to smoke. If it smells sweet or fruity or any lovely natural smells like pine etc, then you have done really well.