@cyyynthia/tokenize
Advanced tools
Comparing version 1.1.2 to 1.1.3
13
index.js
/* | ||
* Copyright (c) 2020 Cynthia K. Rey, All rights reserved. | ||
* Copyright (c) 2020-2021 Cynthia K. Rey, All rights reserved. | ||
* | ||
@@ -30,3 +30,2 @@ * Redistribution and use in source and binary forms, with or without | ||
/** | ||
@@ -70,4 +69,4 @@ * Signs a string with the HMAC-SHA256 algorithm | ||
class Tokenize { | ||
get VERSION () { return 1 } | ||
get TOKENIZE_EPOCH () { return 1546300800000 } | ||
static get VERSION () { return 1 } | ||
static get TOKENIZE_EPOCH () { return 1546300800000 } | ||
@@ -115,4 +114,6 @@ /** | ||
const genTime = parseInt(Buffer.from(splitted[1], 'base64').toString('utf8'), 10) | ||
if (isNaN(genTime)) return false | ||
const accountId = Buffer.from(splitted[0], 'base64').toString('utf8') | ||
const genTime = Buffer.from(splitted[1], 'base64').toString('utf8') | ||
const account = accountFetcher(accountId, prefix) | ||
@@ -136,3 +137,3 @@ if (!account) return null | ||
if (typeof lastTokenReset !== 'number' || lastTokenReset > genTime) return null | ||
if (typeof lastTokenReset !== 'number' || lastTokenReset > ((genTime * 1000) + Tokenize.TOKENIZE_EPOCH)) return null | ||
return account | ||
@@ -139,0 +140,0 @@ } |
{ | ||
"name": "@cyyynthia/tokenize", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "A universal token format for authentication. Designed to be secure, flexible, and usable anywhere.", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16319
173