Update floDapps.js

- myFloID, myPubKey, myPrivKey will now return undefined when user not logged in
This commit is contained in:
sairajzero 2022-08-14 18:38:29 +05:30
parent 91e6b82387
commit 45878e6ebe

View File

@ -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;
}
}
}
});