fix: add publish and resolve

Adds publish & resolve methods.
Updates example app.
Add npmignore.
Bumps version to 0.3.0.
This commit is contained in:
coreyphillips
2024-09-21 16:35:14 -04:00
parent acde22bd5f
commit 476235399f
27 changed files with 721 additions and 140 deletions

View File

@@ -1,5 +1,10 @@
import { StyleSheet, View, Button } from 'react-native';
import { auth, parseAuthUrl } from '@synonymdev/react-native-pubky';
import {
auth,
parseAuthUrl,
publish,
resolve,
} from '@synonymdev/react-native-pubky';
export default function App() {
return (
@@ -9,7 +14,7 @@ export default function App() {
onPress={async (): Promise<void> => {
try {
const res = await auth(
'pubkyauth:///?caps=/pub/pubky.app/:rw,/pub/foo.bar/file:r&secret=_K8yj2nS4naHWytpECCX48XhjhGc8KAhlpnuLUiHYBI&relay=http://localhost:52244/',
'pubkyauth:///?caps=/pub/pubky.app/:rw,/pub/foo.bar/file:r&secret=U55XnoH6vsMCpx1pxHtt8fReVg4Brvu9C0gUBuw-Jkw&relay=http://167.86.102.121:4173/',
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
);
if (res.isErr()) {
@@ -39,6 +44,42 @@ export default function App() {
}
}}
/>
<Button
title={'publish'}
onPress={async (): Promise<void> => {
try {
const res = await publish(
'recordnametest',
'recordcontenttest',
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
);
if (res.isErr()) {
console.log(res.error.message);
return;
}
console.log(res.value);
} catch (e) {
console.log(e);
}
}}
/>
<Button
title={'resolve'}
onPress={async (): Promise<void> => {
try {
const res = await resolve(
'z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty'
);
if (res.isErr()) {
console.log(res.error.message);
return;
}
console.log(res.value);
} catch (e) {
console.log(e);
}
}}
/>
</View>
);
}