refactor(backend): replace rndstr with secureRndstr (#11044)
* refactor(backend): replace rndstr with secureRndstr * Update pnpm-lock.yaml * .js
This commit is contained in:
		 Kagami Sascha Rosylight
					Kagami Sascha Rosylight
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							7bb8c71543
						
					
				
				
					commit
					ef354e94f2
				
			| @@ -1,3 +1,3 @@ | ||||
| import { secureRndstr } from '@/misc/secure-rndstr.js'; | ||||
|  | ||||
| export default () => secureRndstr(16, true); | ||||
| export default () => secureRndstr(16); | ||||
|   | ||||
| @@ -1,10 +1,9 @@ | ||||
| import * as crypto from 'node:crypto'; | ||||
|  | ||||
| const L_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz'; | ||||
| export const L_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz'; | ||||
| const LU_CHARS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||||
|  | ||||
| export function secureRndstr(length = 32, useLU = true): string { | ||||
| 	const chars = useLU ? LU_CHARS : L_CHARS; | ||||
| export function secureRndstr(length = 32, { chars = LU_CHARS } = {}): string { | ||||
| 	const chars_len = chars.length; | ||||
|  | ||||
| 	let str = ''; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user