kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
22 wiersze
537 B
TypeScript
22 wiersze
537 B
TypeScript
import { nip19 } from 'nostr-tools';
|
|
|
|
import { signer } from 'soapbox/features/nostr/sign';
|
|
import { type AppDispatch } from 'soapbox/store';
|
|
|
|
import { verifyCredentials } from './auth';
|
|
|
|
/** Log in with a Nostr pubkey. */
|
|
function nostrLogIn() {
|
|
return async (dispatch: AppDispatch) => {
|
|
if (!signer) {
|
|
throw new Error('No Nostr signer available');
|
|
}
|
|
|
|
const pubkey = await signer.getPublicKey();
|
|
const npub = nip19.npubEncode(pubkey);
|
|
|
|
return dispatch(verifyCredentials(npub));
|
|
};
|
|
}
|
|
|
|
export { nostrLogIn }; |