Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

163
Visualizações
Encrypted video streaming

enter image description here

I made this picture that explains what I'm trying to achieve.

Brief summary: I want users to be able to upload an encrypted video that only those which have the password will be able to see as a stream. The point of all this is for the server to not be able to decipher it.

What I managed to do at the moment is only the first part, encrypting the chunks and sending them :

fileInput.addEventListener("change", async () => {
    const file = fileInput.files[0]
    const stream = file.stream()
    const reader = stream.getReader() 
    while(true) {
        const {value, done} = await reader.read()
        if(done) break
        handleChunk(value)
    }
    const out = {
        size: file.size,
        type: file.type,
        encryptedStream: encryptedStream
    }
})

function handleChunk(chunk) { // chunk: Uint8Array
    const parsedChunk = CryptoJS.enc.Utf8.parse(chunk)
    encryptedStream.push(CryptoJS.AES.encrypt(parsedChunk, "encryptionKey").toString())
}

I guess you can also do this with File.slice() but I did not test it.

At this point I feel like I've looked into every API related to files/streams both in Node and in vanilla js but I can't find a way to make this work, all I've managed is to make a Readable out of the encryptedStream array in the backend.

const Readable = require("stream").Readable
let readable = new Readable()
encryptedStream.forEach(aesChunk => readable.push(aesChunk))
readable.push(null)

I have doubts on how to stream it back to another frontend and literally no idea on how to play the video after deciphering it. From what I've looked online, it looks like it's not possible to stream a crypted file, only to download it.

Is this possible to do ?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda