소스 검색

dsk接口jwt更改token检验

ellisran 5 달 전
부모
커밋
dbb02792b7
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      app/lib/dsk.js

+ 4 - 1
app/lib/dsk.js

@@ -9,6 +9,8 @@
  */
 const crypto = require('crypto');
 const moment = require('moment');
+const jwt = require('jsonwebtoken');
+const privateKey = 'zhzhjwtqwerty';
 class DSK {
 
     /**
@@ -24,7 +26,8 @@ class DSK {
     }
 
     getToken() {
-        return crypto.createHash('md5').update(crypto.createHash('md5').update(this.tokenKey).digest('hex') + moment().format('DD-HH')).digest('hex');
+        // return crypto.createHash('md5').update(crypto.createHash('md5').update(this.tokenKey).digest('hex') + moment().format('DD-HH')).digest('hex');
+        return jwt.sign({ iat: Date.now() }, privateKey);
     }
 
     async sendSms(mobile) {