From 45878e6ebe3d8f8aecd81d02ad17fd977e7896ad Mon Sep 17 00:00:00 2001 From: sairajzero Date: Sun, 14 Aug 2022 18:38:29 +0530 Subject: [PATCH] Update floDapps.js - myFloID, myPubKey, myPrivKey will now return undefined when user not logged in --- floDapps.js | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/floDapps.js b/floDapps.js index 556e7fe..e2435a8 100644 --- a/floDapps.js +++ b/floDapps.js @@ -1,16 +1,26 @@ -(function(EXPORTS) { //floDapps v2.3.2a +(function(EXPORTS) { //floDapps v2.3.2b /* General functions for FLO Dapps*/ 'use strict'; const floDapps = EXPORTS; const DEFAULT = { - get root() { - return "floDapps" - }, + root: "floDapps", application: floGlobals.application, adminID: floGlobals.adminID }; + Object.defineProperties(floDapps, { + application: { + get: () => DEFAULT.application + }, + adminID: { + get: () => DEFAULT.adminID + }, + root: { + get: () => DEFAULT.root + } + }); + var user_priv_raw, aes_key, user_priv_wrap; //private variable inside capsule const raw_user = { get private() { @@ -73,16 +83,40 @@ Object.defineProperties(window, { myFloID: { - get: () => user.id + get: () => { + try { + return user.id; + } catch { + return; + } + } }, myUserID: { - get: () => user.id + get: () => { + try { + return user.id; + } catch { + return; + } + } }, myPubKey: { - get: () => user.public + get: () => { + try { + return user.public; + } catch { + return; + } + } }, myPrivKey: { - get: () => user.private + get: () => { + try { + return user.private; + } catch { + return; + } + } } });