Comparing version 0.11.0 to 0.11.1
@@ -0,3 +1,3 @@ | ||
import t from 'tap'; | ||
import argon2 from './'; | ||
import t from 'tap'; | ||
@@ -9,3 +9,3 @@ const password = 'password'; | ||
const truncatedBase64 = buffer => buffer.toString('base64').replace(/\=*$/, ''); | ||
const truncatedBase64 = buffer => buffer.toString('base64').replace(/=*$/, ''); | ||
@@ -12,0 +12,0 @@ const hashes = Object.freeze({ |
@@ -0,3 +1,3 @@ | ||
const crypto = require('crypto'); | ||
const bindings = require('bindings')('argon2'); | ||
const crypto = require('crypto'); | ||
@@ -4,0 +4,0 @@ const defaults = Object.freeze({ |
{ | ||
"name": "argon2", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"description": "An Argon2 library for Node", | ||
@@ -38,3 +38,3 @@ "main": "index.js", | ||
"babel-tap": "^5.0.0", | ||
"xo": "^0.13.0" | ||
"xo": "^0.14.0" | ||
}, | ||
@@ -45,4 +45,7 @@ "engines": { | ||
"xo": { | ||
"rules": { | ||
"no-div-regex": "warn" | ||
}, | ||
"space": 2 | ||
} | ||
} |
@@ -82,2 +82,4 @@ # node-argon2 [![NPM package][npm-image]][npm-url] [![Build status][travis-image]][travis-url] [![Coverage status][coverage-image]][coverage-url] [![Code Quality][codequality-image]][codequality-url] [![Dependencies][david-dm-image]][david-dm-url] | ||
// ... | ||
}).catch(err => { | ||
// internal failure | ||
}); | ||
@@ -92,3 +94,3 @@ | ||
} catch (err) { | ||
// ... | ||
// internal failure | ||
} | ||
@@ -103,3 +105,3 @@ | ||
} catch (err) { | ||
// ... | ||
// internal failure | ||
} | ||
@@ -160,7 +162,7 @@ ``` | ||
var hash = argon2.hashSync('password', argon2.generateSaltSync(), options); | ||
const hash = argon2.hashSync('password', argon2.generateSaltSync(), options); | ||
// ES7 | ||
var hash = await argon2.hash('password', await argon2.generateSalt(), options); | ||
const hash = await argon2.hash('password', await argon2.generateSalt(), options); | ||
``` | ||
@@ -176,6 +178,10 @@ | ||
```js | ||
argon2.verify('<big long hash>', 'password').then(() => { | ||
// password match | ||
}).catch(() => { | ||
// password did not match | ||
argon2.verify('<big long hash>', 'password').then(match => { | ||
if (match) { | ||
// password match | ||
} else { | ||
// password did not match | ||
} | ||
}).catch(err => { | ||
// internal failure | ||
}); | ||
@@ -185,6 +191,10 @@ | ||
if (argon2.verifySync('<big long hash>', 'password')) { | ||
// password match | ||
} else { | ||
// password did not match | ||
try { | ||
if (argon2.verifySync('<big long hash>', 'password')) { | ||
// password match | ||
} else { | ||
// password did not match | ||
} | ||
} catch (err) { | ||
// internal failure | ||
} | ||
@@ -195,6 +205,9 @@ | ||
try { | ||
await argon2.verify('<big long hash>', 'password'); | ||
// password match | ||
if (await argon2.verify('<big long hash>', 'password')) { | ||
// password match | ||
} else { | ||
// password did not match | ||
} | ||
} catch (err) { | ||
// password did not match | ||
// internal failure | ||
} | ||
@@ -205,2 +218,5 @@ ``` | ||
When you hit an internal failure, the message is properly set. If it is not or | ||
you do not understand it, feel free to open an issue. | ||
# License | ||
@@ -207,0 +223,0 @@ Work licensed under the [MIT License](LICENSE). Please check |
@@ -0,3 +1,3 @@ | ||
const t = require('tap'); | ||
const argon2 = require('./index'); | ||
const t = require('tap'); | ||
@@ -10,3 +10,3 @@ const password = 'password'; | ||
// trailing '=' characters for a more compact representation. | ||
const truncatedBase64 = buffer => buffer.toString('base64').replace(/\=*$/, ''); | ||
const truncatedBase64 = buffer => buffer.toString('base64').replace(/=*$/, ''); | ||
@@ -13,0 +13,0 @@ // hashes for argon2i and argon2d with default options |
@@ -0,3 +1,3 @@ | ||
const t = require('tap'); | ||
const argon2 = require('./'); | ||
const t = require('tap'); | ||
@@ -4,0 +4,0 @@ t.test('js promise + setInterval', t => { |
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
168654
229