Turkmenistan has officially legalized mining and exchanging cryptocurrency, marking a major shift for its tightly-controlled economy.