From 8c46bd6ec9a71ecfd00e8e96c8cad5adf5265396 Mon Sep 17 00:00:00 2001 From: Mark Nadal Date: Tue, 19 Jun 2018 16:49:23 -0700 Subject: [PATCH] chain != gun, ? chain = user etc., .gun -> $ chain --- lib/open.js | 2 +- sea.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/open.js b/lib/open.js index 13aa3acc..7191bff5 100644 --- a/lib/open.js +++ b/lib/open.js @@ -20,7 +20,7 @@ Gun.chain.open = function(cb, opt, at){ clearTimeout(opt.to); opt.to = setTimeout(function(){ if(!opt.any){ return } - opt.any.call(opt.at.gun, opt.doc, opt.key, opt, opt.ev); + opt.any.call(opt.at.$, opt.doc, opt.key, opt, opt.ev); if(opt.off){ opt.ev.off(); opt.any = null; diff --git a/sea.js b/sea.js index 4e554583..94c3afe5 100644 --- a/sea.js +++ b/sea.js @@ -862,7 +862,7 @@ // add our credentials in-memory only to our root gun instance //var tmp = user._.tag; var opt = user._.opt; - user._ = key.at.gun._; + user._ = key.at.$._; user._.opt = opt; //user._.tag = tmp || user._.tag; // so that way we can use the credentials to encrypt/decrypt data @@ -1038,8 +1038,8 @@ const authLeave = async (gunRoot, alias = gunRoot._.user._.alias) => { var user = gunRoot._.user._ || {}; [ 'get', 'soul', 'ack', 'put', 'is', 'alias', 'pub', 'epub', 'sea' ].map((key) => delete user[key]) - if(user.gun){ - delete user.gun.is; + if(user.$){ + delete user.$.is; } // Let's use default gunRoot.user(); @@ -1068,7 +1068,7 @@ var then = USE('./then'); function User(){ - this._ = {gun: this} + this._ = {$: this} Gun.call() } User.prototype = (function(){ function F(){}; F.prototype = Gun.chain; return new F() }()) // Object.create polyfill @@ -1430,7 +1430,7 @@ function each(msg){ // TODO: Warning: Need to switch to `gun.on('node')`! Do not use `Gun.on('node'` in your apps! // NOTE: THE SECURITY FUNCTION HAS ALREADY VERIFIED THE DATA!!! // WE DO NOT NEED TO RE-VERIFY AGAIN, JUST TRANSFORM IT TO PLAINTEXT. - var to = this.to, vertex = (msg.gun._).put, c = 0, d; + var to = this.to, vertex = (msg.$._).put, c = 0, d; Gun.node.is(msg.put, function(val, key, node){ c++; // for each property on the node // TODO: consider async/await use here... SEA.verify(val, false, function(data){ c--; // false just extracts the plain data.