gun icon indicating copy to clipboard operation
gun copied to clipboard

Gun mutates cert object

Open mimiza opened this issue 4 years ago • 0 comments

This issue is created as Mark's request in PR https://github.com/amark/gun/pull/1092

Currently, when using cert, in the current gun version (master branch), I want people to be able to use cert like this:

gun.put('blah blah', null, {opt: { cert: cert}})

But it is not possible if you run multiple put. Why? Because Gun MUTATES the original cert object into something else. So currently, only the first put works with the above example. To put multiple times using cert, people have to use Object.assign() + call() to clone the cert then "call" put, which is very annoying and not my desired behavior when I designed Certify. So Mark can you please help doing something so Gun won't mutate the "opt" object.

This is how I desired people to use it:

gun.put('blah blah', null, { cert: cert})
  1. Use cert without having to write "opt". Is it possible?
  2. Use cert without having to clone it (without having to use Object.assign() and call())

mimiza avatar Jul 29 '21 06:07 mimiza