amark / gun

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

can't user().delete() #755

Open sirpy opened 5 years ago

sirpy commented 5 years ago

Sometimes it works but most times SEA starts throwing errors and localstorage has some strange gun data.

gun.user().delete()
19:47:34.388 rollbar.min.js:2 User cannot be found!
19:47:34.390 rollbar.min.js:2 NO! Account must match! {~O6Emoex7xk89xs0WocXtozm8LkO49PTymrEOTq5KJRs.2Ve9I0Qv4G-rar7BOvp9SuKa-cJ3ZqeFZT6jYZkkLG4: {…}}

No SEA errors from above delete, but localstorage has this:

gap/gun/: "{}"
{"~@0x12855a9e04781eab92":{"_":{"#":"~@0x12855a9e04781eab92",">":{"~iVvH7ZL0ej946Yx5HtXbPjIamCgHteXcKhwdMftXvD4.ZQ09......

the field has 803KB of data in locastorage

reloading the page trying to create a new user with different credentials results in this SEA error

sea.js:2061 Uncaught TypeError: Cannot read property 's' of null
    at Object.f.c (sea.js:2061)
    at t.f.a (sea.js:2034)
    at Object.r (gun.js:3102)
    at gun.js:3090

only clearing localstorage allows to create new user. but in any case the old username cannot be recreated/loggedin, sea says user is already logging in or being created

amark commented 5 years ago

To be honest, I'm not sure if I want to support this .delete() as a method. It was added by someone else. Or if I do, I might refactor/rename/change its behavior, just as a heads up. But this is super low on priority list.

blazer2k1 commented 1 year ago

Hey @amark so fast forward 2023 how do you delete users? it say nothing in the online docs, just delete data in general

https://gun.eco/docs/Delete

This also seem to not work anymore: https://stackoverflow.com/a/37758715/15578244

    var users = gun.get('users');
    users.put({alice: {name: 'alice'}, bob: {name: 'bob'}});
    users.path('bob').put(null);

Uncaught TypeError: users.path is not a function

EDIT: nvm, I found it: https://gun.eco/docs/User#user-delete user.delete("bob", "my secret", ()=>{ console.log("deleted"); });

gustavcorpas commented 1 year ago

@blazer2k1 does user.delete("bob", "my secret", ()=>{ console.log("deleted"); }); work for you? on my end, I get OK -response in the ack, but the user is not actually deleted it seems.

blazer2k1 commented 1 year ago

@gustavcorpas, somehow that works for me, maybe @amark really needs to have some clarity on this matter.