Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put silently fails when SEA certificate uses an array #1301

Open
Jahb opened this issue Jan 17, 2023 · 2 comments
Open

Put silently fails when SEA certificate uses an array #1301

Jahb opened this issue Jan 17, 2023 · 2 comments

Comments

@Jahb
Copy link

Jahb commented Jan 17, 2023

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 gets to a node where you attempted to put will 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).

@amark
Copy link
Owner

amark commented Feb 1, 2023

🤦 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.

@mimiza
Copy link
Contributor

mimiza commented Jan 23, 2024

Thanks for reporting. This PR fixes the issue. Just wait for the merge.
#1358

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants