mirror of
https://github.com/wukko/cobalt.git
synced 2025-02-25 12:38:54 +01:00
stream/manage: remove unnecessary Math.floor for timestamp from prehistoric times
This commit is contained in:
parent
e282a9183f
commit
dbe2a02152
1 changed files with 2 additions and 2 deletions
|
@ -21,7 +21,7 @@ export function createStream(obj) {
|
||||||
const streamID = nanoid(),
|
const streamID = nanoid(),
|
||||||
iv = randomBytes(16).toString('base64'),
|
iv = randomBytes(16).toString('base64'),
|
||||||
secret = randomBytes(256).toString('base64'),
|
secret = randomBytes(256).toString('base64'),
|
||||||
exp = Math.floor(new Date().getTime()) + streamLifespan,
|
exp = new Date().getTime() + streamLifespan,
|
||||||
hmac = sha256(`${streamID},${exp},${iv},${secret}`, hmacSalt),
|
hmac = sha256(`${streamID},${exp},${iv},${secret}`, hmacSalt),
|
||||||
streamData = {
|
streamData = {
|
||||||
service: obj.service,
|
service: obj.service,
|
||||||
|
@ -77,7 +77,7 @@ export function verifyStream(id, hmac, exp, secret, iv) {
|
||||||
status: 400
|
status: 400
|
||||||
}
|
}
|
||||||
|
|
||||||
if (String(exp) === String(streamInfo.exp) && Number(exp) > Math.floor(new Date().getTime())) {
|
if (String(exp) === String(streamInfo.exp) && Number(exp) > new Date().getTime()) {
|
||||||
return streamInfo;
|
return streamInfo;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue