Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

250
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda