chore: Move helper to E2E test (#37546)
parent
9f77c721f1
commit
8a6cae6f14
@ -1,14 +0,0 @@ |
||||
export const createToken = (): string => { |
||||
const array = new Uint8Array(16); |
||||
if (typeof window !== 'undefined' && window.crypto && window.crypto.getRandomValues) { |
||||
window.crypto.getRandomValues(array); |
||||
} else { |
||||
// Use Node.js crypto
|
||||
const { randomBytes } = require('crypto'); // eslint-disable-line @typescript-eslint/no-var-requires
|
||||
const buffer = randomBytes(16); |
||||
array.set(buffer); |
||||
} |
||||
return Array.from(array) |
||||
.map((byte) => byte.toString(16).padStart(2, '0')) |
||||
.join(''); |
||||
}; |
||||
Loading…
Reference in new issue