gun icon indicating copy to clipboard operation
gun copied to clipboard

strange behavior of gun.user().recall()

Open janbkrejci opened this issue 4 years ago • 3 comments

Steps to reproduce:

  1. gun.user().create("myLogin", "myPassword")
  2. gun.user().is.alias => "myLogin" // correct
  3. gun.user().recall({sessionStorage: true})
  4. gun.user().is.alias => {pub: "...", epub: "...", priv: "...", epriv: "..."} // strange

is this a feature?

janbkrejci avatar Aug 24 '21 12:08 janbkrejci

couple days ago it confused me too.

btw if you want the alias this works for both scenarios:

let name = '';

gun
    .user(user?._.sea?.pub)
    .get('alias')
    .once((alias) => (name = alias));

ulvido avatar Aug 24 '21 17:08 ulvido

@janbkrejci @ulvido apologies, this is a bug indeed. sessionStorage logs in using keypair not password, which is then badly getting set to .is which is clearly a no-no. Thank you for reporting! (I've noted this in my code already, so hopefully be fixed in next version)

amark avatar Aug 31 '21 04:08 amark

update: gun.user().is.alias after recalling user from session storage now contains just the pub key value, not an object with all four keys.

janbkrejci avatar Jan 25 '22 06:01 janbkrejci