WebSocket server + Search index + indexable content parser
This commit is contained in:
32
lib/internalAuth.js
Normal file
32
lib/internalAuth.js
Normal file
@@ -0,0 +1,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;
|
||||
|
||||
}
|
||||
|
||||
};
|
Reference in New Issue
Block a user