Refactor the code
Update 'getSecretKey' function