dnt-connect
Advanced tools
Comparing version 3.0.0 to 3.0.1
{ | ||
"name": "dnt-connect", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Node.JS library for DNT's single sign on service DNT Connect", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"hint": "eslint index.js test.js examples", | ||
"test": "mocha -b -c --check-leaks -R spec test.js", | ||
"test": "mocha -b -c --check-leaks -R tap test.js", | ||
"watch": "mocha -w -b -c --check-leaks -R progress test.js" | ||
@@ -11,0 +11,0 @@ }, |
@@ -36,3 +36,3 @@ # DNT Connect | ||
```javascript | ||
var client = new Connect('myClientName', 'mySecretKey'); | ||
var client = new Connect('myClientName', 'myBase64EncodedSecretKey'); | ||
``` | ||
@@ -39,0 +39,0 @@ |
48
test.js
@@ -53,3 +53,3 @@ 'use strict'; | ||
describe('new Connect()', function describe() { | ||
it('should throw error for missing client string', function it() { | ||
it('throws error for missing client string', function it() { | ||
assert.throws(function throws() { | ||
@@ -60,3 +60,3 @@ c = new Connect(); | ||
it('should throw error for missing key string', function it() { | ||
it('throws error for missing key string', function it() { | ||
assert.throws(function throws() { | ||
@@ -67,3 +67,3 @@ c = new Connect('myApp'); | ||
it('should make new client instance', function it() { | ||
it('returns new client instance', function it() { | ||
assert(c instanceof Connect); | ||
@@ -76,3 +76,3 @@ assert(c.key instanceof Buffer); | ||
describe('#hmacPlaintext()', function describe() { | ||
it('should return HMAC for plaintext and iv', function it() { | ||
it('returns HMAC for plaintext and iv', function it() { | ||
assert.equal(c.hmacPlaintext(pt, iv), hs); | ||
@@ -83,11 +83,11 @@ }); | ||
describe('#verifyPlaintext()', function describe() { | ||
it('should return true for correct hmac', function it() { | ||
it('returns true for correct hmac', function it() { | ||
assert.equal(c.verifyPlaintext(pt, iv, hs), true); | ||
}); | ||
it('should return false for incorrect hmac', function it() { | ||
it('returns false for incorrect hmac', function it() { | ||
hs = ['AKMvNyM6MKg8BFfWtLWSDrPRHmIZzfU8DOo/np3SQC9RXVj4JqpfpYz6nXzoUEa5Hp//a12', 'sOmsAzdc+3S/Lug=='].join(''); | ||
assert.equal(c.verifyPlaintext(pt, iv, hs), false); | ||
}); | ||
it('should return false for incorrect iv', function it() { | ||
it('returns false for incorrect iv', function it() { | ||
iv = new Buffer('ADVC0Adh8UEFaeVXwUNHEw==', 'base64'); | ||
@@ -97,3 +97,3 @@ assert.equal(c.verifyPlaintext(pt, iv, hs), false); | ||
it('should return false for incorrect plaintext', function it() { | ||
it('returns false for incorrect plaintext', function it() { | ||
pt = JSON.stringify({ | ||
@@ -107,6 +107,6 @@ foo: 'baz', | ||
describe('#encryptPlaintext()', function describe() { | ||
it('ciphertext length should be multiple of 16', function it() { | ||
it('returns ciphertext with length multiple of 16', function it() { | ||
assert.equal(new Buffer(c.encryptPlaintext(pt, iv), 'base64').length % 16, 0); | ||
}); | ||
it('should return ciphertext, prepended iv, for plaintext and iv input', function it() { | ||
it('returns ciphertext, prepended iv, for plaintext and iv input', function it() { | ||
assert.equal(c.encryptPlaintext(pt, iv), ivct); | ||
@@ -117,3 +117,3 @@ }); | ||
describe('#decryptCiphertext()', function describe() { | ||
it('should return plaintext for ciphertext and iv input', function it() { | ||
it('returns plaintext for ciphertext and iv input', function it() { | ||
assert.equal(c.decryptCiphertext(new Buffer(ct, 'base64'), iv), pt); | ||
@@ -124,3 +124,3 @@ }); | ||
describe('#encryptAndHash()', function describe() { | ||
it('should return ciphertext, prepended iv, and hmac for plaintext and iv', function it() { | ||
it('returns ciphertext, prepended iv, and hmac for plaintext and iv', function it() { | ||
const ref = c.encryptAndHash(pt, iv); | ||
@@ -136,3 +136,3 @@ const ciphertext = ref[0]; | ||
describe('#decryptAndVerify()', function describe() { | ||
it('should return plaintext and validation for ciphertext and hmac', function it() { | ||
it('returns plaintext and validation for ciphertext and hmac', function it() { | ||
const ref = c.decryptAndVerify(ivct, hs); | ||
@@ -148,3 +148,3 @@ const plaintext = ref[0]; | ||
describe('#encryptJSON()', function describe() { | ||
it('should return encrypted JSON data and verification hmac', function it() { | ||
it('returns encrypted JSON data and verification hmac', function it() { | ||
const ref = c.encryptJSON(JSON.parse(pt), iv); | ||
@@ -160,3 +160,3 @@ const ciphertext = ref[0]; | ||
describe('#decryptJSON()', function describe() { | ||
it('should return decrypted JSON data and verify hmac', function it() { | ||
it('returns decrypted JSON data and verify hmac', function it() { | ||
const data = encodeURIComponent(ivct); | ||
@@ -177,3 +177,3 @@ const hmac = encodeURIComponent(hs); | ||
it('should return valid url with encrypted data and hmac', function it() { | ||
it('returns valid url with encrypted data and hmac', function it() { | ||
const ref = c.getUrl('bounce', _url).split('?', 2); | ||
@@ -201,3 +201,3 @@ const url = ref[0]; | ||
it('should return valid bounce url', function it() { | ||
it('returns valid bounce url', function it() { | ||
const ref = c.bounce(_url).split('?', 2); | ||
@@ -217,3 +217,3 @@ const url = ref[0]; | ||
it('should return valid signon url', function it() { | ||
it('returns valid signon url', function it() { | ||
const ref = c.signon(_url).split('?', 2); | ||
@@ -231,3 +231,3 @@ const url = ref[0]; | ||
describe('#decrypt()', function describe() { | ||
it('should handle missing query parameter', function it() { | ||
it('handle missing query parameter', function it() { | ||
assert.throws(function throws() { | ||
@@ -238,3 +238,3 @@ c.decrypt(); | ||
it('should handle missing data property', function it() { | ||
it('handle missing data property', function it() { | ||
assert.throws(function throws() { | ||
@@ -245,3 +245,3 @@ c.decrypt({}); | ||
it('should handle missing hmac property', function it() { | ||
it('handle missing hmac property', function it() { | ||
assert.throws(function throws() { | ||
@@ -254,3 +254,3 @@ c.decrypt({ | ||
it('should decrypt valid ciphertext and hmac', function it() { | ||
it('decrypt valid ciphertext and hmac', function it() { | ||
const ref = c.decrypt({ | ||
@@ -272,3 +272,3 @@ data: encodeURIComponent(ivct), | ||
it('should redirect user to DNT Connect', function it(done) { | ||
it('redirects user to DNT Connect', function it(done) { | ||
app.get('/connect') | ||
@@ -280,3 +280,3 @@ .expect(302) | ||
it('should authenticate user from DNT Connect', function it(done) { | ||
it('authenticates user from DNT Connect', function it(done) { | ||
const ref = c.encryptJSON(JSON.parse(pt), iv); | ||
@@ -283,0 +283,0 @@ const ciphertext = ref[0]; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
21351