Skip to content

Commit 1e555e0

Browse files
committed
fix promise on sign ca
1 parent 91dab78 commit 1e555e0

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/app/services/qz-tray.service.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ export class QzTrayService {
5050
}
5151

5252
// Set certificate promise - return as a function that returns a promise
53-
this.qz.security.setCertificatePromise(() => {
54-
return Promise.resolve(this.certificateCache || "");
55-
});
53+
this.qz.security.setCertificatePromise(
54+
(resolve: (arg0: string) => any, reject: any) => {
55+
return resolve(this.certificateCache || "");
56+
}
57+
);
5658

5759
// Override certificate check for self-signed certificates
5860
this.qz.security.setSignatureAlgorithm("SHA512");
@@ -65,8 +67,11 @@ export class QzTrayService {
6567

6668
// Set signing function using backend - this signs ALL data sent to QZ Tray
6769
this.qz.security.setSignaturePromise((toSign: string) => {
68-
console.log("QZ Tray requesting signature for data...");
69-
return new Promise<string>((resolve, reject) => {
70+
console.log("QZ Tray requesting signature for data...", toSign);
71+
return (
72+
resolve: (arg0: string) => void,
73+
reject: (arg0: Error) => void
74+
) => {
7075
this.http
7176
.post<{
7277
signature: string;
@@ -91,7 +96,7 @@ export class QzTrayService {
9196
reject(new Error(errorMsg));
9297
},
9398
});
94-
});
99+
};
95100
});
96101

97102
this.qzInitialized = true;

0 commit comments

Comments
 (0)