2018-12-24 20:31:02 +01:00
|
|
|
const jwt = require('jsonwebtoken');
|
|
|
|
|
|
|
|
|
|
function toHexString(bytes) {
|
|
|
|
|
return Array.from(bytes, byte =>
|
|
|
|
|
("00" + (byte & 0xFF).toString(16)).slice(-2)
|
|
|
|
|
).join('');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
2019-10-13 20:44:05 +02:00
|
|
|
getlinkregByEmail: function (idapp, email, username) {
|
2018-12-24 20:31:02 +01:00
|
|
|
try{
|
2019-10-13 20:44:05 +02:00
|
|
|
mystr = idapp + email + username;
|
2018-12-24 20:31:02 +01:00
|
|
|
return jwt.sign(toHexString(mystr), process.env.SIGNCODE).toString();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
};
|