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

247
Visualizações
Understanding and updating the gun user alias system

On the gun alias system:

Is it like a phone book (public key book) where every user could have a different name for each key?

Is it stored in a user's user space, or is there some kind of local dict, or is it more of a global/universe thing?


There seems to be two ways to initialise a user:

1: via an alias and password, e.g.

let eve = gun.user().auth('Eve' ,'password123')

How do you recover the public key for eve?

Here's what I have but is seems like there'd be a better way:

let userObj
let eve= gun.user().auth('Eve' ,'password456',(u)=>{userObj = u})
let evePub = userObj.put.pub // or eve._.put.pub

2: via SEA pair, e.g.

let bob = await SEA.pair();
await gun.user().auth(bob) 

How do you set an alias for bob?

Perhaps I have to set SEA.name or something to do with ~@ in the user space, but I'm not sure..

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

0

  1. To get the public key for user eve use the call back function:
    let pub =  await new Promise (res => user.auth('Eve' ,'password123',ack => 
    { 
        if (!ack.err) {
           res(ack.put.pub)
        } 
        else {
           res(ack.err)
        }
    }))
  1. The alias is set in the ~@<alias> property of the ~publicKeyOfUser node, like this:
    let link = {};
    let alias = 'bob'
    link['~'+bob.pub] = {'#': '~'+bob.pub};
    gun.get('~'+bob.pub).get('~@'+alias).put(link)
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