Fix/generalize ns update secret generation. Reduce code duplication. Fixes #74.