Skip to content

Commit

Permalink
Merge pull request #10 from pharmaledgerassoc/3.0.2
Browse files Browse the repository at this point in the history
[ITSM-450] Release 3.0.2
  • Loading branch information
drajcan authored May 24, 2024
2 parents 8daf5f4 + e428428 commit 4c2894d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
</div>
</div>

<div id="readableContainer">
<div class="invalid-credential hidden">

</div>
</div>

<div>
<div class="d-flex">
<p class="user-label">Wallet settings: (build version - $$appVersion)</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
});
Expand All @@ -19,7 +22,6 @@ export class MyAccountPage {

afterRender() {
changeSidebarFromURL();
this.renderCredentialContainer(this.credential && this.readableCredential);
this.renderSettingsContainer();
}

Expand Down Expand Up @@ -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 = `<pre><code> ${this.readableCredential} </code></pre>`;
readableContainer.appendChild(readableCredentialElement);
}

renderSettingsContainer() {
const environmentContainer = document.querySelector('#environmentContainer');
let environmentDataElement = environmentContainer.querySelector('#environmentData');
Expand All @@ -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
Expand All @@ -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);
}


}
}
6 changes: 3 additions & 3 deletions octopus-freeze.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"workDir": ".",
"dependencies": [
{
Expand Down Expand Up @@ -26,8 +26,8 @@
"type": "smartClone",
"target": ".",
"collectLog": false,
"commit": "e4d54ab64a8af71cb0d8d4cd34d7b97a47165cdf",
"tag": "v2.0.8"
"commit": "960acc476a43dc2e8fc6b2f552a5f22de9c9474f",
"tag": "v2.0.13"
},
{
"type": "execute",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ePI-workspace",
"version": "v3.0.0",
"version": "v3.0.2",
"description": "",
"scripts": {
"dev-install": "node ./bin/mkDevEnv.js",
Expand Down

0 comments on commit 4c2894d

Please sign in to comment.