You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
can i exchange TypedArray or Buffer between host and vm ?
i want to use libsodium-wrapper in vm, but it need crypto.getRandomValues function,
so when i try to impl the crypto.getRandomValues in vm, i notice that this function is a node impl and the web polyfill use randombytes to wrap browser crypto.randomBytes function to impl crypto.getRandomValues function.
but the randomBytes and getRandomValues all process the Buffer or TypedArray .
// crypto.getRandomValues define in `lib.dom.d.ts`getRandomValues<TextendsArrayBufferView|null>(array: T): T;
so , i think it can impl like :
vm request some random -> tell the host -> host generate crypto random Buffer -> pass random Buffer to vm -> get the crypto random Buffer
vm.randomBytes() call -> host.randomBytes() call -> host return random buffer -> vm.randomBytes() return
can i pass TypedArray or Buffer from host to vm ?
The text was updated successfully, but these errors were encountered:
Currently you cannot directly pass a ArrayBuffer or similar to the VM, although it’s an interesting use-case, because we might be able to expose raw data like this directly to the VM without copying in the future.
For now, I suggest converting your random bytes to an Array of number on the host, sending to the vm, and converting from array of number to TypedArray inside the guest.
can i exchange TypedArray or Buffer between host and vm ?
i want to use libsodium-wrapper in vm, but it need
crypto.getRandomValues
function,so when i try to impl the crypto.getRandomValues in vm, i notice that this function is a node impl and the web polyfill use randombytes to wrap browser
crypto.randomBytes
function to implcrypto.getRandomValues
function.but the
randomBytes
andgetRandomValues
all process the Buffer or TypedArray .so , i think it can impl like :
can i pass TypedArray or Buffer from host to vm ?
The text was updated successfully, but these errors were encountered: