I put mine in Mylar bags with an oxygen absorber. Should last 30 years that way.
They’ll probably last a year, if you don’t vacuum seal or put them in Mylar. After that, they’ll just be harder to cook. You could also freeze them.
During the Y2K preps we had some family members who did an experiment with bay leaf. They put dried beans into plastic 5 gallon buckets generously interspersed with bay leaf from the spice shelf. About 10 years later we were present when they opened them and no bugs, and they tasted just fine!