From 316728f8164dd0245f75d5116072e5ffa3896355 Mon Sep 17 00:00:00 2001 From: vnugent Date: Wed, 27 Dec 2023 14:14:01 -0500 Subject: update readme roadmap & heartbeat timeout --- README.md | 2 ++ extension/src/features/auth-api.ts | 15 ++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b6367ff..175938c 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ This project is probably best explained by the features it has an that need to b - Optionally support network based, event authorization applications - Server backed event history to preserve your notes - Support for NIP-46 event signing using an extern library +- Add new support for NIP-44 private messages (fast tracked) ### Extension - ✔ Infinite identities per account @@ -39,6 +40,7 @@ This project is probably best explained by the features it has an that need to b - Chrome and Firefox support (mobile would be nice also) - Build fully featured library/API for other extension builders - Stip metadata tags in events such as [#7f57800e](https://github.com/nostr-protocol/nips/pull/884/commits/7f27800e27c437ce17d223799f37631105d1ae5f) +- Add new support for NIP-44 private messages (fast tracked) ## Motivation Nostr is a simple, new, and fun protocol I really wanted to be a part of. NIP-07 seemed like the gateway to securely contribute notes on my terms. When your identity is permanently linked to a 32 byte secret number, imo it must be taken very seriously (I feel the same way for bitcoin). It can never be changed like a password, no whoopsie can occur, or your identity has been stolen forever. At least with bitcoin "wallets" (more 32 byte secp256k1 secret keys) you may have the possibility of transferring your funds if you believe a breach may have occurred or rotate keys like you might passwords. This cannot happen with nostr in the same way. diff --git a/extension/src/features/auth-api.ts b/extension/src/features/auth-api.ts index e3f6c21..f47d505 100644 --- a/extension/src/features/auth-api.ts +++ b/extension/src/features/auth-api.ts @@ -16,6 +16,7 @@ import { AxiosInstance } from "axios"; import { get } from "@vueuse/core"; import { computed } from "vue"; +import { delay } from "lodash"; import { usePkiAuth, useSession, useUser } from "@vnuge/vnlib.browser"; import type { ClientStatus } from "./types"; import type { AppSettings } from "./settings"; @@ -23,6 +24,7 @@ import type { JsonObject } from "type-fest"; import { type FeatureApi, type BgRuntime, type IFeatureExport, exportForegroundApi, popupAndOptionsOnly, popupOnly } from "./framework"; import { waitForChangeFn } from "./util"; + export interface ProectedHandler { (message: T): Promise } @@ -46,7 +48,7 @@ export interface UserApi extends FeatureApi { export const useAuthApi = (): IFeatureExport => { return { - background: ({ state, onInstalled }:BgRuntime): UserApi =>{ + background: ({ state }:BgRuntime): UserApi =>{ const { loggedIn, clearLoginState } = useSession(); const { currentConfig } = state const { logout, getProfile, heartbeat, userName } = useUser(); @@ -74,14 +76,9 @@ export const useAuthApi = (): IFeatureExport => { } } - //Install hook for interval - onInstalled(() => { - //Configure interval to run every 5 minutes to update the status - setInterval(runHeartbeat, 60 * 1000); - //Run immediately - runHeartbeat(); - return Promise.resolve(); - }) + //Configure interval to run every 5 minutes to update the status + setInterval(runHeartbeat, 60 * 1000); + delay(runHeartbeat, 1000) //Delay 1 second to allow the extension to load return { waitForChange: waitForChangeFn([currentConfig, loggedIn, userName]), -- cgit