refactor: rewrite key module with nan