Comparing version 0.1.1 to 0.2.0
@@ -15,3 +15,3 @@ var fernet = require('../fernet'); | ||
if(opts.time) this.setTime(Date.parse(opts.time)); | ||
else this.setTime(Date.now()); | ||
else this.setTime(); | ||
} | ||
@@ -18,0 +18,0 @@ |
{ | ||
"name": "fernet", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Javascript implementation of Fernet symmetric encryption https://github.com/kr/fernet-spec", | ||
@@ -5,0 +5,0 @@ "main": "fernet.js", |
@@ -68,17 +68,10 @@ //for browser compatibility | ||
test('time defaults to Date.now()', function(){ | ||
var frozenNow = Date.now(); | ||
var oldNow = Date.now | ||
Date.now = function(){ | ||
return frozenNow; | ||
} | ||
var token = new fernet.Token({ | ||
secret: secret | ||
}) | ||
token.encode('foo'); | ||
assert.deepEqual(fernet.timeBytes(frozenNow), token.time); | ||
Date.now = oldNow; | ||
var cipherText = token.encode('foo'); | ||
var recovered = token.decode(cipherText); | ||
assert.equal(recovered, 'foo'); | ||
}) | ||
}) | ||
Sorry, the diff of this file is too big to display
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
303906
8598