diff --git a/apihub-root/dsu-fabric/web-components/pages/landing-page/landing-page.js b/apihub-root/dsu-fabric/web-components/pages/landing-page/landing-page.js index 38a8e4e9..202deaf6 100644 --- a/apihub-root/dsu-fabric/web-components/pages/landing-page/landing-page.js +++ b/apihub-root/dsu-fabric/web-components/pages/landing-page/landing-page.js @@ -27,6 +27,12 @@ export class LandingPage { alert("Migration is needed. Please access the Demiurge Wallet or ask your administrator to access it then refresh this page."); return; } + + if(migrationStatus === MIGRATION_STATUS.IN_PROGRESS){ + alert("Migration is in progress. Please wait for the process to complete."); + return; + } + try { this.encryptedSSOSecret = await this.getSSOSecret(); } catch (e) { @@ -157,9 +163,9 @@ export class LandingPage { let didDocument; let shouldPersist = false; const mainDID = await scAPI.getMainDIDAsync(); - if (mainDID) { + const healDID = async (didIdentifier)=>{ try { - didDocument = await $$.promisify(w3cDID.resolveDID)(mainDID); + didDocument = await $$.promisify(w3cDID.resolveDID)(didIdentifier); // try to sign with the DID to check if it's valid await $$.promisify(didDocument.sign)("test"); } catch (e) { @@ -175,13 +181,13 @@ export class LandingPage { throw new Error(`Failed to create DID. Error: ${e.message}`); } } + } + if (mainDID) { + await healDID(mainDID); } else { - try { - didDocument = await $$.promisify(w3cDID.createIdentity)("ssi:name", vaultDomain, userId); - shouldPersist = true; - } catch (e) { - throw new Error(`Failed to create DID. Error: ${e.message}`); - } + const didIdentifier = `did:ssi:name:${vaultDomain}:${userId}`; + await healDID(didIdentifier); + shouldPersist = true; } if (shouldPersist) { let batchId; diff --git a/apihub-root/dsu-fabric/web-components/pages/my-account-page/my-account-page.html b/apihub-root/dsu-fabric/web-components/pages/my-account-page/my-account-page.html index ef777d9a..bde92011 100644 --- a/apihub-root/dsu-fabric/web-components/pages/my-account-page/my-account-page.html +++ b/apihub-root/dsu-fabric/web-components/pages/my-account-page/my-account-page.html @@ -16,12 +16,6 @@ -
- -
-

Wallet settings: (build version - $$appVersion)

diff --git a/apihub-root/dsu-fabric/web-components/pages/my-account-page/my-account-page.js b/apihub-root/dsu-fabric/web-components/pages/my-account-page/my-account-page.js index f3977c6f..5961f212 100644 --- a/apihub-root/dsu-fabric/web-components/pages/my-account-page/my-account-page.js +++ b/apihub-root/dsu-fabric/web-components/pages/my-account-page/my-account-page.js @@ -1,14 +1,17 @@ -import constants from "../../../constants.js"; import {changeSidebarFromURL, copyToClipboard} from "../../../utils/utils.js"; const openDSU = require("opendsu"); const config = openDSU.loadAPI("config"); -const credentialsAPI = openDSU.loadAPI("credentials"); const scAPI = openDSU.loadAPI("sc"); export class MyAccountPage { constructor(element, invalidate) { this.invalidate = invalidate; + + this.did = ""; + this.envData = {"in-progress": "Environment data is being read..."}; + this.appVersion = "version data is loading..."; + this.invalidate(async () => { await this.fetchAccountData(); }); @@ -19,7 +22,6 @@ export class MyAccountPage { afterRender() { changeSidebarFromURL(); - this.renderCredentialContainer(this.credential && this.readableCredential); this.renderSettingsContainer(); } @@ -78,28 +80,6 @@ export class MyAccountPage { return version; } - renderCredentialContainer(validCredential) { - if (!validCredential) { - try{ - document.querySelector('.invalid-credential').classList.toggle("hidden"); - }catch(err){ - console.log(err); - } - return - } - const readableContainer = document.querySelector('#readableContainer'); - let readableCredentialElement = readableContainer.querySelector('#readableCredential'); - if (readableCredentialElement) { - readableCredentialElement.remove(); - } - - readableCredentialElement = document.createElement('div'); - readableCredentialElement.id = "readableCredential"; - readableCredentialElement.language = "json"; - readableCredentialElement.innerHTML = `
 ${this.readableCredential} 
`; - readableContainer.appendChild(readableCredentialElement); - } - renderSettingsContainer() { const environmentContainer = document.querySelector('#environmentContainer'); let environmentDataElement = environmentContainer.querySelector('#environmentData'); @@ -116,19 +96,8 @@ export class MyAccountPage { async fetchAccountData() { try { - let mainEnclave = await scAPI.getMainEnclave(); let did = await scAPI.getMainDIDAsync(); this.did = did; - this.credential = await $$.promisify(mainEnclave.readKey)(constants.CREDENTIAL_KEY); - if (this.credential) { - try { - let jwtContent = await $$.promisify(credentialsAPI.parseJWTSegments)(this.credential.token) - const {jwtHeader, jwtPayload} = jwtContent; - this.readableCredential = JSON.stringify({jwtHeader, jwtPayload}, null, 4); - } catch (e) { - this.readableCredential = null; - } - } let envFile = await $$.promisify(config.readEnvFile)(); //hide keySSI properties from display in ui @@ -140,11 +109,9 @@ export class MyAccountPage { const response = await fetch(environmentJsPath); const appEnvContent = await response.text(); this.envData = envFile; - this.appVersion = this.getAppBuildVersion(appEnvContent) + this.appVersion = this.getAppBuildVersion(appEnvContent); } catch (err) { webSkel.notificationHandler.reportUserRelevantError("Failed to get wallet data", err); } - - } } diff --git a/octopus-freeze.json b/octopus-freeze.json index 20e6803c..4dd7db0d 100644 --- a/octopus-freeze.json +++ b/octopus-freeze.json @@ -1,4 +1,4 @@ -{ +{ "workDir": ".", "dependencies": [ { @@ -26,8 +26,8 @@ "type": "smartClone", "target": ".", "collectLog": false, - "commit": "e4d54ab64a8af71cb0d8d4cd34d7b97a47165cdf", - "tag": "v2.0.8" + "commit": "960acc476a43dc2e8fc6b2f552a5f22de9c9474f", + "tag": "v2.0.13" }, { "type": "execute", diff --git a/package.json b/package.json index fb77c06a..82b921c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ePI-workspace", - "version": "v3.0.0", + "version": "v3.0.2", "description": "", "scripts": { "dev-install": "node ./bin/mkDevEnv.js",