Walshy | Pages
03/19/2023, 6:10 PMDogs
03/19/2023, 6:10 PMnikitasius
03/19/2023, 8:38 PMcrypto.getRandomValues()
.
const arrayBytes = new Uint8Array(8);
crypto.getRandomValues(arrayBytes);
console.log(btoa(arrayBytes));
i wanna 8 random bytes.
OTYsMjExLDE2LDE3OCw0MSw5NSw3OCwzMg==
-> 25 bytes 39 36 2c 32 31 31 2c 31 36 2c 31 37 38 2c 34 31 2c 39 35 2c 37 38 2c 33 32
MTM0LDE0LDI1MCwyMDksMjQ5LDIxNiwxNTMsMTQx
-> 30 bytes 31 33 34 2c 31 34 2c 32 35 30 2c 32 30 39 2c 32 34 39 2c 32 31 36 2c 31 35 33 2c 31 34 31
MjA3LDcwLDE0OSwzNSwyMzMsMTQ5LDY4LDE0OA==
-> 28 bytes 32 30 37 2c 37 30 2c 31 34 39 2c 33 35 2c 32 33 33 2c 31 34 39 2c 36 38 2c 31 34 38
nikitasius
03/19/2023, 8:39 PMDani Foldi
03/19/2023, 8:50 PMbtoa
decodes base64 values. If you want to print the random bytes, you can use the toString
method, or simply console.log(arrayBytes)
, which gave me
> {"0": 99, "1": 95, "2": 88, "3": 45, "4": 87, "5": 217, "6": 127, "7": 71}
for examplenikitasius
03/19/2023, 8:51 PMnikitasius
03/19/2023, 8:51 PMconsole.log(arrayBytes.length);
return 8.Dani Foldi
03/19/2023, 8:51 PMnikitasius
03/19/2023, 8:52 PMnikitasius
03/19/2023, 8:53 PMnikitasius
03/19/2023, 8:53 PMDani Foldi
03/19/2023, 8:53 PM207,70,149,35,233,149,68,148
in one of your example cases.Dani Foldi
03/19/2023, 8:54 PMnikitasius
03/19/2023, 8:54 PMDani Foldi
03/19/2023, 8:56 PMbtoa([...arrayBytes].map(String.fromCodePoint).join(''))
- spread into regular array so array ops work
- map to strings from code point, basically convert to string value
- base64nikitasius
03/19/2023, 9:00 PMrenzor
03/19/2023, 10:30 PMsamon
03/20/2023, 12:16 AMsamon
03/20/2023, 12:16 AMChaika
03/20/2023, 12:44 AMSrd
03/20/2023, 1:58 AMzizi
03/20/2023, 5:21 AMMass
03/20/2023, 7:33 AMapp.coderpunk.dev
and I am trying to call login.coderpunk.dev/.well-known/jwks.json
. login
is a cname that maps to an external api. If I call login.coderpunk.dev/.well-known/jwks.json
with a curl in my terminal I get the response, however when I call that from the worker it looks like the request never fires. Has anyone successfully done anything similar before that can help me with this?gunnars04
03/20/2023, 8:17 AMHardAtWork
03/20/2023, 8:42 AMAm1nCmd
03/20/2023, 10:20 AMHardAtWork
03/20/2023, 10:21 AMAm1nCmd
03/20/2023, 10:22 AMAm1nCmd
03/20/2023, 10:24 AMgunnars04
03/20/2023, 11:22 AM