-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(security): use bcrypt the right way,
not hashing refresh token
- Loading branch information
1 parent
73a1834
commit e625bbc
Showing
7 changed files
with
45 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Hash } from './hash.util'; | ||
|
||
describe('Hash.make', () => { | ||
test('panics if a password longer than 72 is given', () => { | ||
const tooLongPassword = | ||
"abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*(),.:;'-+_abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890"; | ||
|
||
expect(() => Hash.make(tooLongPassword)).toThrow(); | ||
}); | ||
|
||
test('panics if an empty password is given', () => { | ||
expect(() => Hash.make('')).toThrow(); | ||
}); | ||
}); | ||
|
||
describe('Hash.compare', () => { | ||
test('panics if password or hash is an empty string', () => { | ||
const anyHash = Hash.make('any string'); | ||
expect(() => Hash.compare('', anyHash)).toThrow(); | ||
expect(() => Hash.compare('any string', '')).toThrow(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters