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

@@ -1237,7 +1237,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-pubky (0.2.3):
- react-native-pubky (0.3.0):
- DoubleConversion
- glog
- hermes-engine
@@ -1757,7 +1757,7 @@ SPEC CHECKSUMS:
React-logger: 4072f39df335ca443932e0ccece41fbeb5ca8404
React-Mapbuffer: 714f2fae68edcabfc332b754e9fbaa8cfc68fdd4
React-microtasksnativemodule: 4943ad8f99be8ccf5a63329fa7d269816609df9e
react-native-pubky: 71108903c771df07c623ed14196f0c49d0d49810
react-native-pubky: 9fd2633ee974bafa9b77e0cd59e2619a0d9d708d
React-nativeconfig: 4a9543185905fe41014c06776bf126083795aed9
React-NativeModulesApple: 0506da59fc40d2e1e6e12a233db5e81c46face27
React-perflogger: 3bbb82f18e9ac29a1a6931568e99d6305ef4403b

View File

@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "bundle install && cd ios && pod install && cd ../ && react-native run-ios",
"ios": "bundle install && cd ios && pod install && cd ../ && react-native run-ios --simulator \"iPhone 15 Pro\"",
"start": "react-native start",
"build:android": "react-native build-android --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"",
"install-pods": "bundle install && cd ios && pod install && cd ../",

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>
);
}