Add Nostr login info to context

This commit is contained in:
Alex Gleason committed 2025-04-17 18:46:08 -05:00
1 parent b8175a459e
commit 9a95cbe5ce
2 files changed
+32 -1

No files matched your search

+24
View File
@@ -150,6 +150,30 @@ export function MyComponent() {
The `useCurrentUser` hook should be used to ensure that the user is logged in before they are able to publish Nostr events.
### Nostr Login
Nostr supports several types of logins:
1. Login with nsec
2. Login with browser extension
3. Login with bunker URI
Functions to log in with each of these methods are exposed by the `useLoginActions` hook:
```tsx
function MyComponent() {
const login = useLoginActions();
login.nsec(nsec); // login by the user pasting their secret key
login.bunker(uri); // login by the user pasting a bunker URI
login.extension(); // login with a NIP-07 browser extension
return (
<div>{/* ... */}</div>
);
}
```
## Development Practices
- Uses React Query for data fetching and caching