gun
gun copied to clipboard
Put silently fails when SEA certificate uses an array
Hi,
The docs https://gun.eco/docs/SEA.certify mention that you can have an array of pubs when creating certificates.
On the current version of Gun 0.2020.1239 two things happen:
- Puts seem to fail silently and never call their callback function when using a certificate with an array of pubs.
- The callbacks on
getsto a node where you attempted toputwill also never be called afterwards.
console.log("Running test");
const sea1 = await SEA.pair();
const sea2 = await SEA.pair();
const sea3 = await SEA.pair();
const policy: any = { "*": "test", "+": "*" };
const cert1 = await SEA.certify([sea2.pub, sea3.pub], policy, sea1);
user.auth(sea2, (data: any) => {
console.log("Authed");
//The callback is never called on this put.
gun
.get(`~${sea1.pub}`)
.get("test")
.get(sea2.pub)
.put({ test: "data" }, console.log, {
opt: { cert: cert1 },
});
//The once call back is also never called.
gun.get(`~${sea1.pub}`).get("test").get(sea2.pub).once(console.log);
});
I have created a sandbox that shows the bug (see index.ts).
🤦 that's not fun or good. Sorry.
I don't have bandwidth for this one until after AXE, RAD/Book. Probably would be good before SecureRender (since that's long term). Anyone want to have a stab? Can get on a code call if need.
Thanks for reporting. This PR fixes the issue. Just wait for the merge. https://github.com/amark/gun/pull/1358