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

195
Visualizações
How to isolate a Gunjs database?

I've been trying out GunJs for a couple of days now and I'm really enjoying it. As a starter project I've followed the Fireship chat dapp video aimed at building your own chat.

Here's the issue, now that I've finished the tutorial I would like to create my own chat. However, for some reason if I get a 'chat' node within my own app it seems to pick up on the same 'chat' node as the tutorial one that is online.

onMount(() => {

    // Get Messages in large chat
    db.get('chat')
    .map()
    .once(async (data, id) => {
        if (data) {
            // key for E2E - to do: change for web3
            const key = '#foo';

            var message = {
                //transform the data
                who: await db.user(data).get('alias'),
                what: (await SEA.decrypt(data.what, key)) + '',
                when: GUN.state.is(data, 'what'), 
            };

            if (message.what) {
                messages = [...messages.slice(-100), message]
            }
        }
    })
})

This is also the case if I change the encryption key (then the messages just become undefined). Multiple questions arise from this:

  • Are graph node names unique within the whole of GunDb?
  • How do you handle conflicts where two gun-based apps call on the same node name?
  • Is this problem generally solved through filtering using 'header' props?
  • How do I make it pick up on only my data?

Even if I've read most of the docs, there seems to be something I'm missing in my comprehension of how the graph is generally seperated between apps. Any insight on how this works would be much appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Are graph node names unique within the whole of GunDb?

Yes.

How do you handle conflicts where two gun-based apps call on the same node name?

You don't. The expected result will be, they will overwrite each other.

Is this problem generally solved through filtering using 'header' props?

I don't think it's the right way to do it.

How do I make it pick up on only my data?

Use your own relay server.

Conclusion : gunDB doesn't really care about the who fetch / put the data. If you want to protect your data, use your own relay server (not a public one), and put data in your user space. user space is readonly to the public, but read/write for the owner.

about 4 years ago · Juan Pablo Isaza Relatório
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