topbit 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/token/token.js +3 -3
package/package.json
CHANGED
package/src/token/token.js
CHANGED
|
@@ -328,14 +328,14 @@ class TopbitToken {
|
|
|
328
328
|
return opts
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
|
|
331
|
+
makeToken(info, id=null, key=null) {
|
|
332
332
|
let riv = randstring(this.ivLength)
|
|
333
333
|
let tid = id || this.randId()
|
|
334
334
|
let token = this.makeikv(info, {id: tid, iv: riv, key: key||this.key})
|
|
335
335
|
return `${riv}.${token}`
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
-
|
|
338
|
+
verifyToken(edata) {
|
|
339
339
|
let tarr = edata.split('.')
|
|
340
340
|
|
|
341
341
|
if (tarr.length != 2 || !tarr[0] || !tarr[1]) {
|
|
@@ -420,7 +420,7 @@ class TopbitToken {
|
|
|
420
420
|
return c.status(self.failedCode).to('!token')
|
|
421
421
|
}
|
|
422
422
|
|
|
423
|
-
let uinfo = self.
|
|
423
|
+
let uinfo = self.verifyToken(token)
|
|
424
424
|
|
|
425
425
|
if (!uinfo.ok) {
|
|
426
426
|
return c.status(self.failedCode).to(uinfo.errcode)
|