adds test and code for generating secret