Add attempt at exportKey for secret key. Fix global namespace pollution