diff --git a/README.md b/README.md
index fc2aa73..6e2c4a4 100644
--- a/README.md
+++ b/README.md
@@ -16,12 +16,13 @@ npm install @synonymdev/react-native-pubky
- [x] [resolve](#resolve): Functionality to resolve content.
- [x] [publishHttps](#publishHttps): Publish HTTPS records.
- [x] [resolveHttps](#resolveHttps): Resolve HTTPS records.
+- [x] [put](#put): Upload a small payload to a given path.
+- [x] [get](#get): Download a small payload from a given path relative to a pubky author.
+- [x] [list](#list): Returns a list of Pubky URLs of the files in the path of the `url` provided.
### Methods to be Implemented
- [ ] signIn: Sign-in to a homeserver.
- [ ] signUp: Sign-up to a homeserver and update Pkarr accordingly.
- [ ] signOut: Sign-out from a homeserver.
-- [ ] put: Upload a small payload to a given path.
-- [ ] get: Download a small payload from a given path relative to a pubky author.
## Usage
@@ -110,6 +111,49 @@ if (resolveHttpsRes.isErr()) {
console.log(resolveHttpsRes.value);
```
+### put
+```js
+import { put } from '@synonymdev/react-native-pubky';
+
+const putRes = await put(
+ 'url', // URL
+ 'content', // Content
+);
+if (putRes.isErr()) {
+ console.log(putRes.error.message);
+ return;
+}
+console.log(putRes.value);
+```
+
+### get
+```js
+import { get } from '@synonymdev/react-native-pubky';
+
+const getRes = await get(
+ 'url' // URL
+);
+if (getRes.isErr()) {
+ console.log(getRes.error.message);
+ return;
+}
+console.log(getRes.value);
+```
+
+### list
+```js
+import { list } from '@synonymdev/react-native-pubky';
+
+const listRes = await list(
+ 'url' // URL
+);
+if (listRes.isErr()) {
+ console.log(listRes.error.message);
+ return;
+}
+console.log(listRes.value);
+```
+
## Local Installation
1. Clone & npm install:
diff --git a/android/src/main/java/com/pubky/PubkyModule.kt b/android/src/main/java/com/pubky/PubkyModule.kt
index e872188..f53b5f5 100644
--- a/android/src/main/java/com/pubky/PubkyModule.kt
+++ b/android/src/main/java/com/pubky/PubkyModule.kt
@@ -231,6 +231,25 @@ class PubkyModule(reactContext: ReactApplicationContext) :
}
}
+ @ReactMethod
+ fun list(url: String, promise: Promise) {
+ CoroutineScope(Dispatchers.IO).launch {
+ try {
+ val result = list(url)
+ val array = Arguments.createArray().apply {
+ result.forEach { pushString(it) }
+ }
+ withContext(Dispatchers.Main) {
+ promise.resolve(array)
+ }
+ } catch (e: Exception) {
+ withContext(Dispatchers.Main) {
+ promise.reject("Error", e.message)
+ }
+ }
+ }
+ }
+
companion object {
const val NAME = "Pubky"
}
diff --git a/android/src/main/java/uniffi/pubkymobile/pubkymobile.kt b/android/src/main/java/uniffi/pubkymobile/pubkymobile.kt
index b5382fc..de21a32 100644
--- a/android/src/main/java/uniffi/pubkymobile/pubkymobile.kt
+++ b/android/src/main/java/uniffi/pubkymobile/pubkymobile.kt
@@ -389,6 +389,8 @@ internal interface _UniFFILib : Library {
): RustBuffer.ByValue
fun uniffi_pubkymobile_fn_func_get(`url`: RustBuffer.ByValue,
): Pointer
+ fun uniffi_pubkymobile_fn_func_list(`url`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
+ ): RustBuffer.ByValue
fun uniffi_pubkymobile_fn_func_parse_auth_url(`url`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
): RustBuffer.ByValue
fun uniffi_pubkymobile_fn_func_publish(`recordName`: RustBuffer.ByValue,`recordContent`: RustBuffer.ByValue,`secretKey`: RustBuffer.ByValue,_uniffi_out_err: RustCallStatus,
@@ -525,6 +527,8 @@ internal interface _UniFFILib : Library {
): Short
fun uniffi_pubkymobile_checksum_func_get(
): Short
+ fun uniffi_pubkymobile_checksum_func_list(
+ ): Short
fun uniffi_pubkymobile_checksum_func_parse_auth_url(
): Short
fun uniffi_pubkymobile_checksum_func_publish(
@@ -566,6 +570,9 @@ private fun uniffiCheckApiChecksums(lib: _UniFFILib) {
if (lib.uniffi_pubkymobile_checksum_func_get() != 5395.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
+ if (lib.uniffi_pubkymobile_checksum_func_list() != 8522.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_pubkymobile_checksum_func_parse_auth_url() != 29088.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
@@ -749,6 +756,14 @@ suspend fun `get`(`url`: String) : List {
)
}
+fun `list`(`url`: String): List {
+ return FfiConverterSequenceString.lift(
+ rustCall() { _status ->
+ _UniFFILib.INSTANCE.uniffi_pubkymobile_fn_func_list(FfiConverterString.lower(`url`),_status)
+})
+}
+
+
fun `parseAuthUrl`(`url`: String): List {
return FfiConverterSequenceString.lift(
rustCall() { _status ->
diff --git a/android/src/main/jniLibs/arm64-v8a/libpubkymobile.so b/android/src/main/jniLibs/arm64-v8a/libpubkymobile.so
index 4092437..c5154d4 100755
Binary files a/android/src/main/jniLibs/arm64-v8a/libpubkymobile.so and b/android/src/main/jniLibs/arm64-v8a/libpubkymobile.so differ
diff --git a/android/src/main/jniLibs/armeabi-v7a/libpubkymobile.so b/android/src/main/jniLibs/armeabi-v7a/libpubkymobile.so
index 8dc1d34..a35f7d7 100755
Binary files a/android/src/main/jniLibs/armeabi-v7a/libpubkymobile.so and b/android/src/main/jniLibs/armeabi-v7a/libpubkymobile.so differ
diff --git a/android/src/main/jniLibs/x86/libpubkymobile.so b/android/src/main/jniLibs/x86/libpubkymobile.so
index c87cd3f..cebb52c 100755
Binary files a/android/src/main/jniLibs/x86/libpubkymobile.so and b/android/src/main/jniLibs/x86/libpubkymobile.so differ
diff --git a/android/src/main/jniLibs/x86_64/libpubkymobile.so b/android/src/main/jniLibs/x86_64/libpubkymobile.so
index 769dce7..127614e 100755
Binary files a/android/src/main/jniLibs/x86_64/libpubkymobile.so and b/android/src/main/jniLibs/x86_64/libpubkymobile.so differ
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index 3b49eea..fb61410 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -1237,7 +1237,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- - react-native-pubky (0.5.0):
+ - react-native-pubky (0.6.0):
- DoubleConversion
- glog
- hermes-engine
@@ -1757,7 +1757,7 @@ SPEC CHECKSUMS:
React-logger: 4072f39df335ca443932e0ccece41fbeb5ca8404
React-Mapbuffer: 714f2fae68edcabfc332b754e9fbaa8cfc68fdd4
React-microtasksnativemodule: 4943ad8f99be8ccf5a63329fa7d269816609df9e
- react-native-pubky: 6eb6e656a9c7bfc4310556c142db5861a2fe5b7f
+ react-native-pubky: 0240de4239550981499983fa50a1aa6fc200823d
React-nativeconfig: 4a9543185905fe41014c06776bf126083795aed9
React-NativeModulesApple: 0506da59fc40d2e1e6e12a233db5e81c46face27
React-perflogger: 3bbb82f18e9ac29a1a6931568e99d6305ef4403b
diff --git a/example/src/App.tsx b/example/src/App.tsx
index 633185e..abca411 100644
--- a/example/src/App.tsx
+++ b/example/src/App.tsx
@@ -11,6 +11,7 @@ import {
get,
resolveHttps,
publishHttps,
+ list,
} from '@synonymdev/react-native-pubky';
export default function App() {
@@ -207,6 +208,24 @@ export default function App() {
}
}}
/>
+
+