Add test
This commit is contained in:
parent
b630fb7ef8
commit
308c0f8af1
@ -29,7 +29,7 @@ AuthToken.prototype.genToken = async function(userData, expiresSeconds) {
|
|||||||
userData: userData,
|
userData: userData,
|
||||||
expires: {ttl: expiresSeconds, ts: Math.floor(Date.now() / 1000)}
|
expires: {ttl: expiresSeconds, ts: Math.floor(Date.now() / 1000)}
|
||||||
};
|
};
|
||||||
this.tokenDB.set(userToken, JSON.stringify(tokenData), 'EX', expiresSeconds);
|
await this.tokenDB.set(userToken, JSON.stringify(tokenData), 'EX', expiresSeconds);
|
||||||
|
|
||||||
return userToken;
|
return userToken;
|
||||||
};
|
};
|
||||||
|
12
auth/test.js
Normal file
12
auth/test.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* 作者:likeagle@163.com,
|
||||||
|
* 功能:
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const r = {"host": "101.200.241.0", "port": 6379, "password": "ehason"};
|
||||||
|
const a = require('./index')(r);
|
||||||
|
a.genToken({name: 'u', sex: 'm'}, 100).then( t =>{
|
||||||
|
console.log(t);
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user