Skip to content

Commit f38cda8

Browse files
committed
add publickey check
1 parent 4b41a3a commit f38cda8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/bitcore-vault/src/secureProcess.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class SecureProcess {
127127
const err = error as Error;
128128

129129
// Determine if this is a fatal error
130-
const fatalActions = ['initialize', 'checkSecureHeap'];
130+
const fatalActions = ['initialize', 'checkSecureHeap', 'getPublicKey'];
131131
if (fatalActions.includes(action)) {
132132
this.sendFatalError(err, messageId);
133133
} else {
@@ -243,6 +243,9 @@ export class SecureProcess {
243243
}
244244

245245
private getPublicKey(): string {
246+
if (!this.publicKey) {
247+
throw new Error('Secure process is missing public key');
248+
}
246249
return this.publicKey.export({ type: 'spki', format: 'pem' }).toString();
247250
}
248251

0 commit comments

Comments
 (0)