internalAuth.js 320 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
"use strict";

const crypto = require('crypto');

/**
 * Internal Authentication
 */
module.exports = {

	_curKey: false,

	init(inKey) {

		this._curKey = inKey;

		return this;

	},

	generateKey() {

		return crypto.randomBytes(20).toString('hex')

	},

	validateKey(inKey) {

		return inKey === this._curKey;

	}

};