Use pubkey instead of npub

This commit is contained in:
Alex Gleason 2024-03-14 16:17:53 -05:00
parent 37cc1e88f6
commit 34bd5b5020
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 5 additions and 2 deletions

View file

@ -1,4 +1,5 @@
import { NSchema as n } from '@soapbox/nspec'; import { NSchema as n } from '@soapbox/nspec';
import { nip19 } from 'nostr-tools';
import React, { useMemo, useState } from 'react'; import React, { useMemo, useState } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
@ -62,6 +63,8 @@ const AccountStep: React.FC<IAccountStep> = ({ accountId, setStep, onClose }) =>
return <ModalLoading />; return <ModalLoading />;
} }
const acct = account.nostr.pubkey ? nip19.npubEncode(account.nostr.pubkey) : account.acct;
return ( return (
<Modal <Modal
title={<FormattedMessage id='nostr_signin.account.title' defaultMessage='Your account' />} title={<FormattedMessage id='nostr_signin.account.title' defaultMessage='Your account' />}
@ -81,7 +84,7 @@ const AccountStep: React.FC<IAccountStep> = ({ accountId, setStep, onClose }) =>
truncate truncate
/> />
<Tooltip text={account.nostr.npub ?? account.acct}> <Tooltip text={acct}>
<Text size='sm' theme='muted' align='center' truncate> <Text size='sm' theme='muted' align='center' truncate>
{username} {username}
</Text> </Text>

View file

@ -53,7 +53,7 @@ const baseAccountSchema = z.object({
z.null(), z.null(),
]).catch(null), ]).catch(null),
nostr: coerceObject({ nostr: coerceObject({
npub: n.bech32().optional().catch(undefined), pubkey: n.id().optional().catch(undefined),
}), }),
note: contentSchema, note: contentSchema,
/** Fedibird extra settings. */ /** Fedibird extra settings. */