Skip to content

Commit

Permalink
fix: keyring issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AbbasAliLokhandwala authored and sh-wallet committed Dec 9, 2024
1 parent 7f76268 commit 19c43fc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/background/src/keyring/keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,10 @@ export class KeyRing {
): Promise<{
multiKeyStoreInfo: MultiKeyStoreInfoWithSelected;
}> {
if (this.password !== "" && this.status !== KeyRingStatus.UNLOCKED) {
await this.unlock(this.password);
}

if (this.status !== KeyRingStatus.UNLOCKED || this.password == "") {
throw new Error("Key ring is locked or not initialized");
}
Expand Down Expand Up @@ -1184,6 +1188,10 @@ export class KeyRing {
): Promise<{
multiKeyStoreInfo: MultiKeyStoreInfoWithSelected;
}> {
if (this.password !== "" && this.status !== KeyRingStatus.UNLOCKED) {
await this.unlock(this.password);
}

if (this.status !== KeyRingStatus.UNLOCKED || this.password == "") {
throw new Error("Key ring is locked or not initialized");
}
Expand Down Expand Up @@ -1212,6 +1220,10 @@ export class KeyRing {
): Promise<{
multiKeyStoreInfo: MultiKeyStoreInfoWithSelected;
}> {
if (this.password !== "" && this.status !== KeyRingStatus.UNLOCKED) {
await this.unlock(this.password);
}

if (this.status !== KeyRingStatus.UNLOCKED || this.password == "") {
throw new Error("Key ring is locked or not initialized");
}
Expand Down Expand Up @@ -1249,6 +1261,10 @@ export class KeyRing {
): Promise<{
multiKeyStoreInfo: MultiKeyStoreInfoWithSelected;
}> {
if (this.password !== "" && this.status !== KeyRingStatus.UNLOCKED) {
await this.unlock(this.password);
}

if (this.status !== KeyRingStatus.UNLOCKED || this.password == "") {
throw new Error("Key ring is locked or not initialized");
}
Expand Down

0 comments on commit 19c43fc

Please sign in to comment.