30 lines
2.8 KiB
JavaScript
30 lines
2.8 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const plugins = require("./smartsocket.plugins");
|
|
const smartsocket_classes_socketfunction_1 = require("./smartsocket.classes.socketfunction");
|
|
const smartsocket_classes_socketrequest_1 = require("./smartsocket.classes.socketrequest");
|
|
// SocketConnection helpers
|
|
exports.checkPasswordForRole = (dataArg, referenceSmartsocket) => {
|
|
let targetPasswordHash = exports.getSocketRoleByName(dataArg.role, referenceSmartsocket).passwordHash;
|
|
let computedCompareHash = plugins.nodehash.sha256FromStringSync(dataArg.password);
|
|
return targetPasswordHash === computedCompareHash;
|
|
};
|
|
// 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; });
|
|
};
|
|
// SocketRole helpers
|
|
/**
|
|
* get corresponding SocketRole instance by name
|
|
*/
|
|
exports.getSocketRoleByName = (socketRoleNameArg, referenceSmartsocket) => {
|
|
return referenceSmartsocket.socketRoles.find((socketRoleArg) => { return socketRoleArg.name === socketRoleNameArg; });
|
|
};
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzb2NrZXQuaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0c29ja2V0LmhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBaUQ7QUFJakQsNkZBQTBGO0FBRTFGLDJGQUEyRztBQUczRywyQkFBMkI7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