Skip to content

Commit

Permalink
optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
terance-edmonds committed Sep 25, 2023
1 parent 7eb38bc commit 9d73b6c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/core/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@ export default {
/* set did */
setDID({ request: { did: holderDID }, data });

const signInfo: any = await checkSigning(
/* const signInfo: any = await checkSigning(
data.provider,
data.loggedInState,
data.signingInfoSet
);
if (signInfo?.provider) data.provider = signInfo.provider;
if (signInfo?.signingInfoSet) data.signingInfoSet = signInfo.signingInfoSet;
); */
data.provider = await getProvider(holderDID);
data.signingInfoSet = [];

/* set new singing key */
await setSingingKey({
Expand Down Expand Up @@ -238,7 +238,7 @@ export default {
request: { currentDID, keyString: request.keyString, type: request.type },
data
});

console.log({ kid });
/* update local message to indicate there's new content */
sendContext({ request: { task: CONTEXT_TASKS.NEW_CONTENT } });

Expand Down
52 changes: 42 additions & 10 deletions src/core/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,50 @@ var storage: any;
var tabs: any;

try {
engine = browser;
action = browser.browserAction;
runtime = browser.runtime;
tabs = browser.tabs;
storage = browser.storage.local;
engine = chrome;
} catch (err) {
try {
engine = chrome;
action = chrome.action;
runtime = chrome.runtime;
tabs = chrome.tabs;
storage = chrome.storage.local;
engine = browser;
} catch (err) {
console.log('DID-SIOP ERROR: ', err);
}
}

try {
action = chrome.action;
} catch (err) {
try {
action = browser.browserAction;
} catch (err) {
console.log('DID-SIOP ERROR: ', err);
}
}

try {
runtime = chrome.runtime;
} catch (err) {
try {
runtime = browser.runtime;
} catch (err) {
console.log('DID-SIOP ERROR: ', err);
}
}

try {
tabs = chrome.tabs;
} catch (err) {
try {
tabs = browser.tabs;
} catch (err) {
console.log('DID-SIOP ERROR: ', err);
}
}

try {
storage = chrome.storage.local;
} catch (err) {
try {
storage = browser.storage.local;
} catch (err) {
console.log('DID-SIOP ERROR: ', err);
}
Expand Down

0 comments on commit 9d73b6c

Please sign in to comment.