This commit is contained in:
Rolands 2022-11-07 18:33:22 +02:00
parent c101f97a0a
commit ed5a6134b4
2 changed files with 2 additions and 2 deletions

View file

@ -17,7 +17,7 @@ await sequelize.query('INSERT INTO Users VALUES("John", 69);')
//set up the WebSocket manager and give it the DB querying function that comes from whatever your DB interface lib provides.
//it needs the raw sql string, which can contain formatting parameters - insert dynamic data into the string.
//Either you in a wrapper function or your DB interface lib should do the sql validation and sanitization, as this lib does not!
const QueryWrap = async (sql='', params={}) => (await sequelize.query(sql, { logging: false, raw: true, replacements: params }))[0]
const QueryWrap = async ({ id = 0, ses_id = '', query = '', params = {} } = {}) => (await sequelize.query(query, { logging: false, raw: true, replacements: params }))[0]
const manager = new SessionManager({ port: ws_port }, QueryWrap, {verbose:true} )
done(`Created SessionManager on port`, ws_port)

View file

@ -18,7 +18,7 @@ await sequelize.query('INSERT INTO Users VALUES("John", 69);')
//set up the WebSocket manager and give it the DB querying function that comes from whatever your DB interface lib provides.
//it needs the raw sql string, which can contain formatting parameters - insert dynamic data into the string.
//Either you in a wrapper function or your DB interface lib should do the sql validation and sanitization, as this lib does not!
const QueryWrap = async (sql = '', params = {}) => (await sequelize.query(sql, { logging: false, raw: true, replacements: params }))[0]
const QueryWrap = async ({ id = 0, ses_id = '', query = '', params = {} } = {}) => (await sequelize.query(query, { logging: false, raw: true, replacements: params }))[0]
//note that these key and iv are here for demonstration purposes and you should always generate your own. You may also supply any cipher algorithm supported by node's crypto module
const ss = new SocioSecurity({ secure_private_key: 'skk#$U#Y$7643GJHKGDHJH#$K#$HLI#H$KBKDBDFKU34534', cipher_iv: 'dsjkfh45h4lu45ilULIY$%IUfdjg', verbose:true })