Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: remove binary assumption, fixes #34 #36

Merged
merged 2 commits into from
Sep 12, 2016
Merged

tests: remove binary assumption, fixes #34 #36

merged 2 commits into from
Sep 12, 2016

Conversation

dcousens
Copy link
Member

@dcousens dcousens commented Sep 9, 2016

No description provided.

@dcousens
Copy link
Member Author

dcousens commented Sep 9, 2016

resolves #34, doesn't add the warning though.

Ping @dominictarr @indutny @calvinmetcalf and @fanatid on whether we should add that warning, reference: #34 (comment)

@dcousens dcousens mentioned this pull request Sep 9, 2016
@dcousens
Copy link
Member Author

dcousens commented Sep 9, 2016

Naturally, this is going to start failing on Travis on all the pre-binary versions... I'm not sure what the best course of action is.

@fanatid
Copy link
Contributor

fanatid commented Sep 9, 2016

Since this package for browser not whether we should follow by latest active LTS node release?
So, I prefer utf8 by default, drop node 0.10 support and release major version after 2016-10-01.

@dcousens
Copy link
Member Author

dcousens commented Sep 9, 2016

drop node 0.10 support

@fanatid the issue is, Node 6 is the only that one that isn't failing after this PR

@fanatid
Copy link
Contributor

fanatid commented Sep 9, 2016

Node 6 is the only that one that isn't failing after this PR

this should fix the issue:

if (!process.browser && pVersionMajor >= 6) runTests('node pbkdf2', require('../'))

@dcousens under drop 0.10 support I meant remove shim pbkdf2Sync

@dcousens
Copy link
Member Author

dcousens commented Sep 9, 2016

@fanatid so we just curtail the valid test fixtures with UTF8 vs non-UTF8?
I can work around it, but, is that all we want to do? Make the tests pass and move on?

I guess I'm ~OK with that, but, it just sounds like it could hurt someone.

@fanatid
Copy link
Contributor

fanatid commented Sep 9, 2016

we also can use 2 sets of fixtures (utf8 and binary)

if (!Buffer.isBuffer(password)) password = new Buffer(password, 'binary')
if (!Buffer.isBuffer(salt)) salt = new Buffer(salt, 'binary')
if (!Buffer.isBuffer(password)) password = new Buffer(password, 'utf-8')
if (!Buffer.isBuffer(salt)) salt = new Buffer(salt, 'utf-8')
Copy link
Contributor

@fanatid fanatid Sep 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need second argument here now, encoding is 'utf8' by default.
Maybe even use Buffer.from(..) ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't Buffer.from completely break previous versions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, sorry, .from will break all previous versions :(

@indutny
Copy link

indutny commented Sep 9, 2016

Other than one nit by @fanatid , LGTM

if (!Buffer.isBuffer(password)) password = new Buffer(password, 'binary')
if (!Buffer.isBuffer(salt)) salt = new Buffer(salt, 'binary')
if (!Buffer.isBuffer(password)) password = new Buffer(password)
if (!Buffer.isBuffer(salt)) salt = new Buffer(salt)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fanatid they are now defaulted

@dcousens dcousens force-pushed the testfix branch 2 times, most recently from cbd6cd3 to a7aaf54 Compare September 9, 2016 11:01
if (!Buffer.isBuffer(password)) password = new Buffer(password, 'binary')
if (!Buffer.isBuffer(salt)) salt = new Buffer(salt, 'binary')
if (!Buffer.isBuffer(password)) password = new Buffer(password, defaultEncoding)
if (!Buffer.isBuffer(salt)) salt = new Buffer(salt, defaultEncoding)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gah, this sucks. any ideas @calvinmetcalf @fanatid @indutny ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the situation, wondering if you had any thoughts on impl.
Otherwise, I assume this PR is good to go now

@dcousens
Copy link
Member Author

dcousens commented Sep 9, 2016

@fanatid RE

@dcousens under drop 0.10 support I meant remove shim pbkdf2Sync

can you elaborate?

@fanatid
Copy link
Contributor

fanatid commented Sep 9, 2016

@dcousens under drop 0.10 support I meant remove shim pbkdf2Sync

can you elaborate?

after 2016-10-01 node 0.10 will not be supported, so why not remove shim?

@dcousens
Copy link
Member Author

Right, sorry, not sure how that didn't read correctly.
But that doesn't resolve the other issues, its just a way to remove code.
I'm happy with that 👍

@dcousens
Copy link
Member Author

dcousens commented Sep 10, 2016

@fanatid removed 0.10 support, tests should pass now

@dcousens
Copy link
Member Author

Ready to merge

@dcousens dcousens added the bug label Sep 10, 2016
@dcousens dcousens deleted the testfix branch September 12, 2016 00:38
@dcousens
Copy link
Member Author

Published as pbkdf2@3.0.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

5 participants