You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
321 B

  1. "use strict";
  2. const crypto = require('crypto');
  3. /**
  4. * Internal Authentication
  5. */
  6. module.exports = {
  7. _curKey: false,
  8. init(inKey) {
  9. this._curKey = inKey;
  10. return this;
  11. },
  12. generateKey() {
  13. return crypto.randomBytes(20).toString('hex');
  14. },
  15. validateKey(inKey) {
  16. return inKey === this._curKey;
  17. }
  18. };