I gave a try to .secret()
and .trust()
of gun.user though, there are unexpected results. How could I get the data from other users in order to access control in the application?
as well as I need to know how to decrypt data without the error message, 'Could not decrypt'.
- node 10.16.0
- gun 0.2019.515
- chrome 74.0.3729.169
There are User03 and User01 in left and right. My goal of this test is User01 to get User03's secret data.
1. Put data under the User03 and check the data on both consoles.
S.user.get('test').put('come on'); // on left console as user03
S.user.get('test').once(console.log); // on left console as user03
user03.get('test').once(console.log); // on right console as user01
2. Let User03 .trust()
User01 on left side.
S.user.get('test').trust( user01 ); // left
3. Make User03's data secret
using User03's pair.
S.user.get('test').secret( S.user.pair ); //left
4. Check the encrypt data on both sides.
S.user.get('test').once(console.log); // on left console as user03
user03.get('test').once(console.log); // on right console as user01
5. Decrypt user03's secret using user01's pair on the right.
it gets the error message, 'Could not decrypt'.
user03.get('test').once((data)=>{
SEA.decrypt(data, S.user.pair, console.log);
});; // right
6. Check the inside the return object of STEP 5.
I expect the output 'come on' as decrypted data.