amark / gun

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

when not logged in SEA.certify gives "Signature did not match." #1251

Closed zilveer closed 2 years ago

zilveer commented 2 years ago

Hi, I am using the same SEA.certify example code from: https://github.com/amark/gun/wiki/SEA.certify#some-examples

The code :

var Alice = await SEA.pair()
var Bob = await SEA.pair()
var Dave = await SEA.pair()

// Alice wants to allow Bob and Dave to use write to her "inbox" and "stories" UNTIL TOMORROW
// On Alice's side:
var certificate = await SEA.certify([Bob.pub, Dave.pub], [{"*": "inbox", "+": "*"}, {"*": "stories"}], Alice, null, {expiry: Gun.state()+(60*60*24*1000)})

// Now on Bob/Dave's side, they can write to Alice's graph using gun.put:
gun.get('~'+Alice.pub).get('inbox').get('deeper'+Bob.pub).put('hello world', null, {opt: {cert: certificate}}) // {opt: {cert: certificate}} is how you use Certificate in gun.put

runs without any issue when I am not logged in as a user in gun, but when I am not logged in I get the following message in the console: Signature did not match.

What has a user sessin login with Signature did not match. when nothing of the code above has to do with a logged in user?

How to reproduce the issue: run the code in the console with a user session in gun -> it works run the code in the console without a user session -> it doesn't work

Any idea what the issue could be?

fitouch commented 2 years ago

@zilveer user always need to .auth(...) to write to other user's graph with certify.

zilveer commented 2 years ago

@zilveer user always need to .auth(...) to write to other user's graph with certify.

Now I get the comment // Now on Bob/Dave's side, they can write to Alice's graph using gun.put:

Thank you so much @fitouch ! :)