Can someone point me to the best working open-source example of gun ACL in 2022?
Do you mean Access Control List? If so, you would use SEA.encrypt()
and SEA.decrypt()
along with SEA.certify()
to create access/read/write policies. https://gun.eco/docs/SEA#certify
probably a simple question.. can some point me to an example of how to use Rad to build create a storage adapter?
All storage adapter examples are here: https://gun.eco/docs/Storage
Good Afternoon, I'm currently trying to set up gun as a p2p backend for my decentralised application. I'm using gun in react and and currently testing my understanding my adding and removing items from a set according to a form input. I retrieve the 'items' set from gun using:
const gunItems = gun.get('items');
Then add a new item to the set by doing:
const newItem = gun.get(keccak256(formData).toString('hex')).put({data: formData})
gunItems.set(newItem);
In this case, I'm creating objects in gun where the key is the hash of the data in the form of hash(data) : {data: formData}.
I'm "deleting" data using:
gunItems.get(keccak256(formData).toString('hex')).put(null);
After adding "a", "b", then deleting "a" and looking at my local storage, I can see that within the items set, hash(a) : null. However, the object hash(a) : {data: "a"} still exists outside of the set. Shouldn't all values associated with hash(a) be null?
root.on('out', {'@': msg['#'], '#': root.ask(open), ok: {rtc: {offer: offer, id: opt.pid}}});
?
@champ5898 We've talked about moving console.log in gun over to an error event handler, but it's lower on the priority list than upgrading gun's DHT. You could potentially turn off all console logging:
let cl = console.log
console.log = {}
// Turn back on:
console.log = cl
But please keep the welcome message unless you are paying for professional support
I'm having a very mysterious bug, where I'm trying to pass a IGunUserInstance around from a factory function to a client function, but the object seems to be mutated when it exits my factory function.
If I return user.get.bind(user)
directly, then there is no problem. But if I return user
(const user = gun.user()
), then the object outside the factory function is different and "loses" the .get
method.
Does this talk to anyone?
function userFactory() {
const user = gun.user()
return new Promise(resolve => {
gun.on('auth', () =>{
console.log(user.get); // fine
resolve(user);
});
});
}
userFactory().then(user => {
console.log(user.get); // undefined
})
const
issues when dealing with JS prototypal inheritance (chains) earlier, so you might be wise to test :)
user
directly (not in a promise), then there is no problem either. I will investigate more later, the problem might be in the framework and not gun.
this
usually being window
or global
but within gun chain it should be the gun
instance
.put(
is dumb simple, .set(
is a convenience wrapper that covers 2+ "array-like" edge cases: Loosely-Ordered Appends & Mathematical Sets (tables), but likewise, requires more understanding to use / checking docs. I'd love if this could be simplified, but like with ACLs, the nature of these things in any system (centralized or not) have nuances to them. Honestly, that is why I prefer more key/value object stores: they're pretty dumb simple & predictable to use.put(formData)
not put({data: formData})
, (B) doing .put(null)
nulls out the LINK to the data (GUN is a graph database), it doesn't null the data itself, unless (C) you serialize your formData as a string? (maybe a bad idea), then when you do .put("the form data")
and later .put(null)
the null overwrites the bytes of the previous string/text, because the data was saved in-place not as a link to another data node.GUN({store: {put: ..., get: ...}
@
is ACK, #
is msg ID, ok
means no error. A new thing (as of this last couple months) is we're officially supporting "hijacking" ACK/OK responses with custom data / behavior, which is how the WebRTC module is generating its SDP negotiation handshake as a RPCed state machine. But as far as GUN / wire, its just ACK / ID / OK. It doesn't know any better.v0.2020.1238
? If not, please upgrade & try again.o
, t
etc. as if I'm a human minifier. But it works, super fast speed, 10K ops/sec on 2015 Air!in
& out
events to message things, while as DAM uses mesh.say(data, peer)
and hear things. onto
is my event listener/emitter library - its faster than everything else I tested because it does direct function calls rather than using a delegator.v0.2020.1238
, or an older one?api.rs
or something in flutter for @VittorioParagallo ? ( @tylerjwatson how's your Rusting going?)