I once asked a seed technologist how to store seed properly. The response was enlightening. It depends on the species.
The below information is from my own experience and reinforced by discussions with Glenn Drowns at Sandhill preservation about the best way to store different species.
Cool and dry is best followed by warm and dry. And after that, cool and damp followed by warm and damp which applies to several species. Even with optimum storage, some seed have very limited life. Onions and carrots are good examples with typical storage life under optimum conditions of about 2 years. Most common garden vegetables are best stored in a freezer properly dried with very low oxygen levels. That means a sealed glass jar with seed and desiccant will give good to very good results. What about other seed? Chestnuts, Acorns, beech seed, coconuts, and many others must never be allowed to dry out and are just fine at room temperature so long as they are moist. If they dry, they die. Pecan and walnut are best stored cool and damp in a refrigerator which prepares them to germinate.
Here are some average storage lifespans for common seed:
Beans (phaseolus Vulgaris) - 5 to 7 years with reduced germination up to 12 years
Lima Beans (Phaseolus Lunatus) - 3 to 6 years with reduced germination up to 10 years
Tepary Beans (Phaseolus Acutifolus) - 3 to 9 years, must be VERY dry
Peanuts and most other legumes are good for 3 to 5 years
Peas - 3 to 6 years, germination drops slowly over time
Cowpeas - 5 to 7 years, I’ve had decent germination with some 8 year old seed
Above best stored in a freezer after proper drying with desiccant in a sealed container
Tomatoes - 3 to 12 years, variety dependent, heart tomatoes have short storage lives
Peppers - 2 to 5 years, some varieties have short and others long storage lives
Eggplant - 2 to 7 years, most varieties will make it 4 years
Potato - 5 to 15 years, I’ve grown 10 year old potato seed with nearly 100% germination
Physalis - rarely last more than 3 years
Other solanums - species dependent, but for the most part, can be stored up to 10 years
Solanums store best in the freezer in sealed containers with desiccant. Oxygen levels should be LOW.
Field corn - up to 15 years though germination drops fast after 9 years, red varieties last longest
Sweet corn - 3 to 4 years is about the best you can get
Maize seed should be stored in the freezer after fully dried with desiccant in a sealed container.
Cucumber - 3 to 7 years, must be very dry and best in a sealed container
Cantaloupe - 4 to 9 years, very dry, sealed container, desiccant
Watermelon - 3 to 8 years, very dry, sealed container, desiccant
Squash - 2 to 6 years, very dry, sealed container
All members of the curcurbit family should be stored frozen in sealed container.
Radish, turnip, rutabage, cabbage, cauliflower, broccoli - all store best fully dry, frozen, sealed container
Carrots - Rarely last more than 2 or 3 years
Onions - 2 years is about it
Lettuce - 2 years, if kept frozen the entire time, some will germinate at 3 to 4 years
Above best stored in the freezer fully dry in a sealed container with low oxygen.
Okra - fully dry, sealed container, very low oxygen, typically good for 5 to 7 years
Glass jars in a freezer can be very fragile. I put each jar in a large ziploc bag. That way if the jar is broken, the bag keeps the seed together. I’ve only had a broken jar in the freezer one time in the last 40 years. I had to empty the freezer to get all the broken glass out. It was not that big a deal as the freezer needed to be thawed and cleaned anyway. Still makes sense to use ziploc bags as it prevents and contains glass breakage. Under no conditions should seed be left in the sun to dry. Direct sunlight is deadly to most species. The exception is a few cacti.