mirror of
				https://github.com/mickael-kerjean/filestash.git
				synced 2025-10-31 01:58:11 +08:00 
			
		
		
		
	 1125998944
			
		
	
	1125998944
	
	
	
		
			
			the local plugin would go through bcrypt for every single call which can be annoying at it makes things slower. By reducing the number of rounds, we're making it quicker to use the local plugin. Since a few weeks, every endpoint that relies on bcrypt are rate limited so this shouldn't make things easier for an attacker to break in :)
		
			
				
	
	
		
			13 lines
		
	
	
		
			276 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
		
			276 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import bcrypt from "bcryptjs";
 | |
| 
 | |
| const ROUND = 5;
 | |
| 
 | |
| export function bcrypt_password(password) {
 | |
|     return new Promise((done, error) => {
 | |
|         bcrypt.hash(password, ROUND, (err, hash) => {
 | |
|             if (err) return error(err);
 | |
|             done(hash);
 | |
|         });
 | |
|     });
 | |
| }
 |