Skip to content
Snippets Groups Projects
Commit d4c57b23 authored by Florian Azizian's avatar Florian Azizian
Browse files

FIX #16205 TIME 1 Websocket session closes unexpectedly

parent 43353407
No related branches found
No related tags found
No related merge requests found
......@@ -28,19 +28,19 @@
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.1100.7",
"@angular/animations": "^11.2.0",
"@angular/cdk": "^11.2.0",
"@angular/cli": "^11.2.0",
"@angular/common": "^11.2.0",
"@angular/compiler": "^11.2.0",
"@angular/compiler-cli": "^11.2.0",
"@angular/core": "^11.2.0",
"@angular/forms": "^11.2.0",
"@angular/language-service": "^11.2.0",
"@angular/material": "^11.2.0",
"@angular/platform-browser": "^11.2.0",
"@angular/platform-browser-dynamic": "^11.2.0",
"@angular/router": "^11.2.0",
"@angular/animations": "^11.2.3",
"@angular/cdk": "^11.2.1",
"@angular/cli": "^11.2.1",
"@angular/common": "^11.2.3",
"@angular/compiler": "^11.2.3",
"@angular/compiler-cli": "^11.2.3",
"@angular/core": "^11.2.3",
"@angular/forms": "^11.2.3",
"@angular/language-service": "^11.2.3",
"@angular/material": "^11.2.1",
"@angular/platform-browser": "^11.2.3",
"@angular/platform-browser-dynamic": "^11.2.3",
"@angular/router": "^11.2.3",
"@biesbjerg/ngx-translate-extract": "^6.0.3",
"@fortawesome/fontawesome-free": "^5.15.2",
"@ionic/angular": "^5.5.4",
......@@ -48,12 +48,12 @@
"@ngrx/store-devtools": "^9.2.1",
"@ngx-translate/core": "^12.1.2",
"@ngx-translate/http-loader": "^4.0.0",
"@peculiar/fortify-webcomponents": "^0.16.0",
"@types/hammerjs": "^2.0.38",
"@types/jasmine": "^3.6.3",
"@peculiar/fortify-webcomponents": "^0.16.2",
"@types/hammerjs": "^2.0.39",
"@types/jasmine": "^3.6.4",
"@types/jasminewd2": "^2.0.8",
"@types/jquery": "^3.5.5",
"@types/node": "^13.13.42",
"@types/node": "^13.13.45",
"angular2-draggable": "^2.3.2",
"angular2-signaturepad": "^3.0.4",
"codelyzer": "^5.1.2",
......
......@@ -34,6 +34,8 @@ export class SignatureMethodModalComponent implements OnInit {
certificate: any;
signatureLength: any = null;
server: any = null;
@Input() note: string;
@Input() signatureMode: string;
@Input() idsToProcess: any[];
......@@ -64,20 +66,26 @@ export class SignatureMethodModalComponent implements OnInit {
}
async certificateChosen(certData: any) {
this.loadingController.create({
message: this.translate.instant('lang.processing'),
spinner: 'dots'
}).then(async (load: HTMLIonLoadingElement) => {
load.present();
// this.loadingController.create({
// message: this.translate.instant('lang.processing'),
// spinner: 'dots'
// }).then(async (load: HTMLIonLoadingElement) => {
// load.present();
try {
this.server = certData.detail.server;
this.checkWebsocketSession();
this.provider = await certData.detail.server.getCrypto(certData.detail.providerId);
this.checkWebsocketSession();
this.cert = await this.provider.certStorage.getItem(certData.detail.certificateId);
this.checkWebsocketSession();
this.certPem = await this.provider.certStorage.exportCert('pem', this.cert);
this.checkWebsocketSession();
this.privateKey = await this.provider.keyStorage.getItem(certData.detail.privateKeyId);
} catch (e) {
this.notificationService.error('lang.fortifyReadException');
load.dismiss();
console.log('certificateChosen');
this.notificationService.error(e);
// load.dismiss();
this.modalController.dismiss(false);
return;
}
......@@ -92,9 +100,17 @@ export class SignatureMethodModalComponent implements OnInit {
this.signatures = await this.actionsService.getElementsFromDoc();
result = await this.sendAndSign(this.idsToProcess[index]);
}
load.dismiss();
// load.dismiss();
this.modalController.dismiss(result);
});
// });
}
async checkWebsocketSession() {
// Why session closed?!
while(this.server.client.state !== WebSocket.OPEN) {
await this.server.connect();
await new Promise(resolve => setTimeout(resolve, 150));
}
}
async sendAndSign(idToProcess: number) {
......@@ -140,9 +156,11 @@ export class SignatureMethodModalComponent implements OnInit {
let hashSignature: any;
try {
this.checkWebsocketSession();
hashSignature = await this.provider.subtle.sign(alg, this.privateKey, hashDocumentHex);
} catch (e) {
this.notificationService.error('lang.fortifyReadException');
console.log('signDocument');
this.notificationService.error(e);
resolve(false);
return of(false);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment