2016-08-07 12:58:20 +00:00
|
|
|
"use strict";
|
2017-07-07 20:02:19 +00:00
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2016-08-16 02:48:42 +00:00
|
|
|
const plugins = require("./smartsocket.plugins");
|
2016-08-12 03:56:40 +00:00
|
|
|
const smartsocket_classes_socketfunction_1 = require("./smartsocket.classes.socketfunction");
|
|
|
|
const smartsocket_classes_socketrequest_1 = require("./smartsocket.classes.socketrequest");
|
2016-08-16 02:48:42 +00:00
|
|
|
// SocketConnection helpers
|
2016-09-04 22:34:09 +00:00
|
|
|
exports.checkPasswordForRole = (dataArg, referenceSmartsocket) => {
|
|
|
|
let targetPasswordHash = exports.getSocketRoleByName(dataArg.role, referenceSmartsocket).passwordHash;
|
2016-08-16 02:48:42 +00:00
|
|
|
let computedCompareHash = plugins.nodehash.sha256FromStringSync(dataArg.password);
|
|
|
|
return targetPasswordHash === computedCompareHash;
|
|
|
|
};
|
2016-08-12 03:56:40 +00:00
|
|
|
// SocketFunction helpers
|
|
|
|
exports.getSocketFunctionByName = (functionNameArg) => {
|
|
|
|
return smartsocket_classes_socketfunction_1.allSocketFunctions.find((socketFunctionArg) => { return socketFunctionArg.name === functionNameArg; });
|
|
|
|
};
|
|
|
|
// SocketRequest helpers
|
|
|
|
/**
|
|
|
|
* get corresponding Socketrequest instance by shortId
|
|
|
|
*/
|
|
|
|
exports.getSocketRequestById = (shortIdArg, requestSide) => {
|
|
|
|
return smartsocket_classes_socketrequest_1.allSocketRequests.find((socketRequestArg) => { return socketRequestArg.shortid === shortIdArg; });
|
|
|
|
};
|
2016-08-09 09:42:21 +00:00
|
|
|
// SocketRole helpers
|
2016-08-12 03:56:40 +00:00
|
|
|
/**
|
|
|
|
* get corresponding SocketRole instance by name
|
|
|
|
*/
|
2016-09-04 22:34:09 +00:00
|
|
|
exports.getSocketRoleByName = (socketRoleNameArg, referenceSmartsocket) => {
|
|
|
|
return referenceSmartsocket.socketRoles.find((socketRoleArg) => { return socketRoleArg.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