mirror of
https://github.com/coder/code-server.git
synced 2026-06-22 09:57:15 +02:00
chore(vscode): update to 1.54.2
This commit is contained in:
@@ -19,13 +19,22 @@ for (let i = 0; i < 256; i++) {
|
||||
|
||||
// todo@jrieken
|
||||
// 1. node nodejs use`crypto#randomBytes`, see: https://nodejs.org/docs/latest/api/crypto.html#crypto_crypto_randombytes_size_callback
|
||||
// 2. use browser-crypto
|
||||
const _fillRandomValues = function (bucket: Uint8Array): Uint8Array {
|
||||
for (let i = 0; i < bucket.length; i++) {
|
||||
bucket[i] = Math.floor(Math.random() * 256);
|
||||
}
|
||||
return bucket;
|
||||
};
|
||||
let _fillRandomValues: (bucket: Uint8Array) => Uint8Array;
|
||||
|
||||
declare const crypto: undefined | { getRandomValues(data: Uint8Array): Uint8Array };
|
||||
|
||||
if (typeof crypto === 'object' && typeof crypto.getRandomValues === 'function') {
|
||||
// browser
|
||||
_fillRandomValues = crypto.getRandomValues.bind(crypto);
|
||||
|
||||
} else {
|
||||
_fillRandomValues = function (bucket: Uint8Array): Uint8Array {
|
||||
for (let i = 0; i < bucket.length; i++) {
|
||||
bucket[i] = Math.floor(Math.random() * 256);
|
||||
}
|
||||
return bucket;
|
||||
};
|
||||
}
|
||||
|
||||
export function generateUuid(): string {
|
||||
// get data
|
||||
|
||||
Reference in New Issue
Block a user