mirror of
https://github.com/KoalaSat/nostros.git
synced 2024-09-28 22:30:41 +00:00
Fix yarn.lock (#448)
This commit is contained in:
commit
f983b5caa0
@ -3,10 +3,9 @@ import SInfo from 'react-native-sensitive-info'
|
||||
import { RelayPoolContext } from './RelayPoolContext'
|
||||
import { AppContext } from './AppContext'
|
||||
import { getUser } from '../Functions/DatabaseFunctions/Users'
|
||||
import { getPublicKey } from 'nostr-tools'
|
||||
import { getPublicKey, nip19 } from 'nostr-tools'
|
||||
import { dropTables } from '../Functions/DatabaseFunctions'
|
||||
import { navigate } from '../lib/Navigation'
|
||||
import { nsecEncode } from 'nostr-tools/nip19'
|
||||
import { getNpub } from '../lib/nostr/Nip19'
|
||||
import { getGroups } from '../Functions/DatabaseFunctions/Groups'
|
||||
import { getList } from '../Functions/DatabaseFunctions/Lists'
|
||||
@ -174,7 +173,7 @@ export const UserContextProvider = ({ children }: UserContextProviderProps): JSX
|
||||
useEffect(() => {
|
||||
if (privateKey && privateKey !== '') {
|
||||
SInfo.setItem('privateKey', privateKey, {})
|
||||
setNsec(nsecEncode(privateKey))
|
||||
setNsec(nip19.nsecEncode(privateKey))
|
||||
setPublicKey(getPublicKey(privateKey))
|
||||
}
|
||||
}, [privateKey])
|
||||
|
@ -2,7 +2,7 @@ import React, { useContext, useEffect, useState } from 'react'
|
||||
import { type NativeScrollEvent, type NativeSyntheticEvent, StyleSheet, View } from 'react-native'
|
||||
import Clipboard from '@react-native-clipboard/clipboard'
|
||||
import { AppContext } from '../../Contexts/AppContext'
|
||||
import { Kind } from 'nostr-tools'
|
||||
import { Kind, nip05 } from 'nostr-tools'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { FlashList, type ListRenderItem } from '@shopify/flash-list'
|
||||
import {
|
||||
@ -30,7 +30,6 @@ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityI
|
||||
import { useFocusEffect } from '@react-navigation/native'
|
||||
import ProfileData from '../../Components/ProfileData'
|
||||
import { handleInfinityScroll } from '../../Functions/NativeFunctions'
|
||||
import { queryProfile } from 'nostr-tools/nip05'
|
||||
import DatabaseModule from '../../lib/Native/DatabaseModule'
|
||||
import { removeMutedUsersList } from '../../Functions/RelayFunctions/Lists'
|
||||
|
||||
@ -149,7 +148,7 @@ export const ContactsPage: React.FC = () => {
|
||||
let hexKey = contactInput
|
||||
|
||||
if (contactInput.includes('@')) {
|
||||
const profile = await queryProfile(contactInput)
|
||||
const profile = await nip05.queryProfile(contactInput)
|
||||
hexKey = profile?.pubkey ?? hexKey
|
||||
} else {
|
||||
hexKey = getNip19Key(contactInput) ?? hexKey
|
||||
|
@ -35,7 +35,7 @@ import { UserContext } from '../../Contexts/UserContext'
|
||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
|
||||
import { useFocusEffect } from '@react-navigation/native'
|
||||
import { Kind } from 'nostr-tools'
|
||||
import { handleInfinityScroll } from '../../Functions/NativeFunctions'
|
||||
import { formatHour, handleInfinityScroll } from '../../Functions/NativeFunctions'
|
||||
import NostrosAvatar from '../../Components/NostrosAvatar'
|
||||
import UploadImage from '../../Components/UploadImage'
|
||||
import { Swipeable } from 'react-native-gesture-handler'
|
||||
|
@ -7,14 +7,13 @@ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
|
||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
|
||||
import { UserContext } from '../../Contexts/UserContext'
|
||||
import { RelayPoolContext } from '../../Contexts/RelayPoolContext'
|
||||
import { Kind } from 'nostr-tools'
|
||||
import { Kind, nip19 } from 'nostr-tools'
|
||||
import { getMentionNotes, getNotificationsIds } from '../../Functions/DatabaseFunctions/Notes'
|
||||
import { AppContext } from '../../Contexts/AppContext'
|
||||
import { StyleSheet } from 'react-native'
|
||||
import RBSheet from 'react-native-raw-bottom-sheet'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { navigate } from '../../lib/Navigation'
|
||||
import { decode } from 'nostr-tools/nip19'
|
||||
import {
|
||||
getDirectMessagesCount,
|
||||
getGroupedDirectMessages,
|
||||
@ -94,7 +93,7 @@ export const HomePage: React.FC = () => {
|
||||
|
||||
const goToEvent: () => void = () => {
|
||||
if (clipboardNip21) {
|
||||
const key = decode(clipboardNip21.replace('nostr:', ''))
|
||||
const key = nip19.decode(clipboardNip21.replace('nostr:', ''))
|
||||
if (key?.data) {
|
||||
if (key.type === 'nevent') {
|
||||
navigate('Note', { noteId: key.data.id })
|
||||
|
@ -9,7 +9,7 @@ import Logo from '../../Components/Logo'
|
||||
import { navigate } from '../../lib/Navigation'
|
||||
import { useFocusEffect } from '@react-navigation/native'
|
||||
import RBSheet from 'react-native-raw-bottom-sheet'
|
||||
import { privateKeyFromSeedWords } from 'nostr-tools/nip06'
|
||||
import { nip06 } from 'nostr-tools'
|
||||
import { AppContext } from '../../Contexts/AppContext'
|
||||
|
||||
interface ProfileConnectPageProps {
|
||||
@ -77,7 +77,7 @@ export const ProfileConnectPage: React.FC<ProfileConnectPageProps> = ({ route })
|
||||
for (let index = 1; index <= 12; index++) {
|
||||
words.push(mnemonicWords[index].trim())
|
||||
}
|
||||
setPrivateKey(privateKeyFromSeedWords(words.join(' ')))
|
||||
setPrivateKey(nip06.privateKeyFromSeedWords(words.join(' ')))
|
||||
setMnemonicWords({})
|
||||
navigate('ProfileLoad')
|
||||
}
|
||||
|
@ -6,8 +6,7 @@ import { Button, Checkbox, Snackbar, Text, TextInput } from 'react-native-paper'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { type DrawerNavigationHelpers } from '@react-navigation/drawer/lib/typescript/src/types'
|
||||
import { UserContext } from '../../Contexts/UserContext'
|
||||
import { privateKeyFromSeedWords } from 'nostr-tools/nip06'
|
||||
import { nsecEncode } from 'nostr-tools/nip19'
|
||||
import { nip06, nip19 } from 'nostr-tools'
|
||||
import { RelayPoolContext } from '../../Contexts/RelayPoolContext'
|
||||
import { getUnixTime } from 'date-fns'
|
||||
import { type Event } from '../../lib/nostr/Events'
|
||||
@ -35,9 +34,9 @@ export const ProfileCreatePage: React.FC<ProfileCreatePageProps> = ({ navigation
|
||||
Keyboard.addListener('keyboardDidHide', () => setKeyboardShow(false))
|
||||
generateRandomMnemonic().then((words) => {
|
||||
setMnemonicWords(words)
|
||||
const privateKey = privateKeyFromSeedWords(Object.values(words).join(' '))
|
||||
const privateKey = nip06.privateKeyFromSeedWords(Object.values(words).join(' '))
|
||||
setKey(privateKey)
|
||||
const nsec = nsecEncode(privateKey)
|
||||
const nsec = nip19.nsecEncode(privateKey)
|
||||
setInputValue(nsec)
|
||||
})
|
||||
createRandomRelays()
|
||||
|
@ -2,8 +2,7 @@ import { useFocusEffect } from '@react-navigation/native'
|
||||
import { FlashList, type ListRenderItem } from '@shopify/flash-list'
|
||||
import { t } from 'i18next'
|
||||
import debounce from 'lodash.debounce'
|
||||
import { Kind } from 'nostr-tools'
|
||||
import { decode } from 'nostr-tools/nip19'
|
||||
import { Kind, nip19 } from 'nostr-tools'
|
||||
import * as React from 'react'
|
||||
import { StyleSheet, View } from 'react-native'
|
||||
import { ActivityIndicator, Text, TextInput, TouchableRipple, useTheme } from 'react-native-paper'
|
||||
@ -118,7 +117,7 @@ export const SearchPage: React.FC<SearchPageProps> = ({ route }) => {
|
||||
React.useEffect(() => {
|
||||
if (searchInput !== '' && validNip21(searchInput)) {
|
||||
try {
|
||||
const key = decode(searchInput.replace('nostr:', ''))
|
||||
const key = nip19.decode(searchInput.replace('nostr:', ''))
|
||||
if (key?.data) {
|
||||
if (key.type === 'nevent') {
|
||||
setSearchInput('')
|
||||
|
@ -1,18 +1,11 @@
|
||||
import {
|
||||
decode,
|
||||
type EventPointer,
|
||||
neventEncode,
|
||||
nprofileEncode,
|
||||
npubEncode,
|
||||
type ProfilePointer,
|
||||
} from 'nostr-tools/nip19'
|
||||
import { nip19 } from 'nostr-tools'
|
||||
|
||||
export function getNpub(key: string | undefined): string {
|
||||
if (!key) return ''
|
||||
if (isPublicKey(key)) return key
|
||||
|
||||
try {
|
||||
return npubEncode(key)
|
||||
return nip19.npubEncode(key)
|
||||
} catch {
|
||||
console.log('Error encoding')
|
||||
}
|
||||
@ -24,7 +17,7 @@ export function getNprofile(key: string, relays: string[]): string {
|
||||
if (!key) return ''
|
||||
|
||||
try {
|
||||
return nprofileEncode({
|
||||
return nip19.nprofileEncode({
|
||||
pubkey: key,
|
||||
relays,
|
||||
})
|
||||
@ -40,7 +33,7 @@ export function getNevent(key: string | undefined, relays: string[]): string {
|
||||
if (isPublicKey(key)) return key
|
||||
|
||||
try {
|
||||
return neventEncode({ id: key, relays })
|
||||
return nip19.neventEncode({ id: key, relays })
|
||||
} catch {
|
||||
console.log('Error encoding')
|
||||
}
|
||||
@ -48,16 +41,16 @@ export function getNevent(key: string | undefined, relays: string[]): string {
|
||||
return key
|
||||
}
|
||||
|
||||
export function getNip19Key(nip19: string): string | null {
|
||||
export function getNip19Key(key: string): string | null {
|
||||
let result = null
|
||||
|
||||
try {
|
||||
const decoded = decode(nip19)
|
||||
const decoded = nip19.decode(key)
|
||||
if (decoded.type === 'nprofile') {
|
||||
const data = decoded.data as ProfilePointer
|
||||
const data = decoded.data as nip19.ProfilePointer
|
||||
result = data.pubkey
|
||||
} else if (decoded.type === 'nevent') {
|
||||
const data = decoded.data as EventPointer
|
||||
const data = decoded.data as nip19.EventPointer
|
||||
result = data.id
|
||||
} else {
|
||||
result = decoded.data as string
|
||||
|
@ -32,7 +32,7 @@
|
||||
"i18next": "^22.4.10",
|
||||
"lnurl-pay": "^2.2.0",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"nostr-tools": "^1.2.1",
|
||||
"nostr-tools": "^1.7.5",
|
||||
"react": "18.2.0",
|
||||
"react-content-loader": "^6.2.0",
|
||||
"react-i18next": "^12.2.0",
|
||||
|
Loading…
Reference in New Issue
Block a user