Skip to content

Commit

Permalink
refactor(nostr): use dexie api to find permission #1727
Browse files Browse the repository at this point in the history
  • Loading branch information
escapedcat committed Nov 25, 2022
1 parent d2dde89 commit 56d0cb6
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ const signEventOrPrompt = async (message: MessageSignEvent) => {
};
}

const dbPermissions = await db.permissions
const findPermission = await db.permissions
.where("host")
.equalsIgnoreCase(message.origin.host)
.and(
(permission) => permission.enabled && permission.method === "signMessage"
)
.toArray();

const hasPermission = dbPermissions
.filter((permission) => permission.enabled)
.map(({ method }) => method)
.includes("signMessage");

console.log({ hasPermission });
const hasPermission = findPermission.length > 0;

try {
if (!hasPermission) {
Expand Down

0 comments on commit 56d0cb6

Please sign in to comment.