amark / gun

An open source cybersecurity protocol for syncing decentralized graph data.
https://gun.eco/docs
Other
18.08k stars 1.16k forks source link

[BUG] can't put to user namespace after user.create() #958

Open mimiza opened 4 years ago

mimiza commented 4 years ago

user.create() automatically authenticates user after account creation, but then user.get('profile').put({name:'Test'}) doesn't work. Please try this on browser console.

TEST 1:

user.create(Gun.text.random(), Gun.text.random(), ack => {
user.get('profile').put({name:'Test'}) // not working
})

This is what I got from TEST 1:

DOMException: The JWK's "x" member defines an octet string of length 0 bytes but should be 32
(sea.js:456)
TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
    at Function.from (sea.js:97)
    at Object.SEA.opt.fall_verify (sea.js:487)
    at async Object.SEA.verify (sea.js:448)
Signature did not match.

TEST 2:

var pair = await sea.pair()
gun.on('auth', ack => { user.get('profile').put({name:'Test'}) // working
})
user.auth(pair)
evdama commented 4 years ago

same thing here, tyring to create a chat message object on the user graph, then putting the ref onto the public graph:

      gunUser = gun.user()
      gunUser.create('bunny', 'highly secret pw')
      gunUser.auth('bunny', 'highly secret pw')
      chatRoomRefUser = gunUser.get('mainroom')
      refOnUserGraph = chatRoomRefUser.put({ user: 'Bunny', message: 'want carrot' })
      gun.get('mainroom').put(refOnUserGraph)

gives this error

DOMException: The JWK's "x" member defines an octet string of length 0 bytes but should be 32
sea.js:456 TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
    at Function.from (sea.js:97)
    at Object.SEA.opt.fall_verify (sea.js:487)
    at async Object.SEA.verify (sea.js:448)
sea.js:456 Signature did not match.
mimiza commented 4 years ago

@evdama please keep in mind that the github version is newer than the npm version. Please use github version.

diatche commented 4 years ago

@mimiza Is ack.error in create() empty?

bitdom8 commented 2 years ago

The problem persists. "Signature did not match." in gundb. When using this relay server ('https://gun-manhattan.herokuapp.com/gun',) it went away. Wanna use my own relay server. Taken the code from here examples but still errs.

philosofonusus commented 2 years ago

The problem persists. "Signature did not match." in gundb. When using this relay server ('https://gun-manhattan.herokuapp.com/gun',) it went away. Wanna use my own relay server. Taken the code from here examples but still errs.

I have exact same error on the local relay server in the docker container and when I try to change it to this one I don't get this problem