Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

refactored crypto/password.js and added verifierVersion config parameter #507

Merged
merged 2 commits into from Jan 21, 2014

Conversation

dannycoates
Copy link
Contributor

Slightly better password implementation plus the ability to have multiple stretching versions.

I added a version 0 to speed up dev tests that doesn't use scrypt. It saves about 5 seconds on the test suite.

The diff looks horrible, but the changes outside of crypto/password.js are pretty straightforward.

sessionToken: sessionToken
})
}
return password.wrapKb(emailRecord.wrapWrapKb)
Copy link
Contributor

Choose a reason for hiding this comment

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

There's some verb/noun overlap here that's making this hard to follow. Is this unwrapping wrapWrapKb to give you wrapKb? Or is it wrapping it? Is there in fact no difference because of xor encryption? I can't think of a better name, but it may be worth some comments on the definition of this method to clarify exactly what it's for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fact that I had to look at the source of the function to even consider answering your question proves your point :)

Something like xorWrapWrapKey would probably be most accurate but, uh, WTF does that mean. Maybe wrapOrUnwrapWrapKb? (too many wraps!)

Its used to go from wrapWrapKb -> wrapKb and wrapKb -> wrapWrapKb in the code so here's a crazy idea: have 2 names for the same function... getWrapKb and getWrapWrapKb? Silly but easier to read.

Copy link
Contributor

Choose a reason for hiding this comment

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

so here's a crazy idea: have 2 names for the same function

I would totally support this. Suggestion: wrapKey() and unwrapKey(), which may be a bit easier to grok in isolation, but perhaps a bit too generic.

@rfk
Copy link
Contributor

rfk commented Jan 21, 2014

LGTM

dannycoates added a commit that referenced this pull request Jan 21, 2014
refactored crypto/password.js and added verifierVersion config parameter
@dannycoates dannycoates merged commit 101cd84 into mozilla:master Jan 21, 2014
@dannycoates dannycoates deleted the verifierVersion branch May 13, 2015 00:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants