mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-06 00:37:23 +00:00
Merge remote-tracking branch 'gitlab/main' into nodenext
This commit is contained in:
109 files changed
+4218
-1
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { useNostr } from '@nostrify/react';
|
||||
import { NLogin, useNostrLogin } from '@nostrify/react/login';
|
||||
// NOTE: This file should not be edited except for adding new login methods.
|
||||
export function useLoginActions() {
|
||||
const { nostr } = useNostr();
|
||||
const { logins, addLogin, removeLogin } = useNostrLogin();
|
||||
return {
|
||||
// Login with a Nostr secret key
|
||||
nsec(nsec) {
|
||||
const login = NLogin.fromNsec(nsec);
|
||||
addLogin(login);
|
||||
},
|
||||
// Login with a NIP-46 "bunker://" URI
|
||||
async bunker(uri) {
|
||||
const login = await NLogin.fromBunker(uri, nostr);
|
||||
addLogin(login);
|
||||
},
|
||||
// Login with a NIP-07 browser extension
|
||||
async extension() {
|
||||
const login = await NLogin.fromExtension();
|
||||
addLogin(login);
|
||||
},
|
||||
// Log out the current user
|
||||
async logout() {
|
||||
const login = logins[0];
|
||||
if (login) {
|
||||
removeLogin(login.id);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user