@synonymdev/react-native-pubky 0.8.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/README.md +52 -9
  2. package/android/src/main/java/com/pubky/PubkyModule.kt +364 -273
  3. package/android/src/main/java/uniffi/pubkycore/pubkycore.kt +1327 -0
  4. package/android/src/main/jniLibs/arm64-v8a/libpubkycore.so +0 -0
  5. package/android/src/main/jniLibs/armeabi-v7a/libpubkycore.so +0 -0
  6. package/android/src/main/jniLibs/x86/libpubkycore.so +0 -0
  7. package/android/src/main/jniLibs/x86_64/libpubkycore.so +0 -0
  8. package/ios/Frameworks/{PubkyMobile.xcframework → PubkyCore.xcframework}/Info.plist +8 -8
  9. package/ios/Frameworks/{PubkyMobile.xcframework → PubkyCore.xcframework}/ios-arm64/Headers/module.modulemap +2 -2
  10. package/ios/Frameworks/PubkyCore.xcframework/ios-arm64/Headers/pubkycoreFFI.h +297 -0
  11. package/ios/Frameworks/{PubkyMobile.xcframework/ios-arm64/libpubkymobile.a → PubkyCore.xcframework/ios-arm64/libpubkycore.a} +0 -0
  12. package/ios/Frameworks/{PubkyMobile.xcframework → PubkyCore.xcframework}/ios-arm64-simulator/Headers/module.modulemap +2 -2
  13. package/ios/Frameworks/PubkyCore.xcframework/ios-arm64-simulator/Headers/pubkycoreFFI.h +297 -0
  14. package/ios/Frameworks/{PubkyMobile.xcframework/ios-arm64-simulator/libpubkymobile.a → PubkyCore.xcframework/ios-arm64-simulator/libpubkycore.a} +0 -0
  15. package/ios/Pubky-Bridging-Header.h +1 -0
  16. package/ios/Pubky.mm +16 -1
  17. package/ios/Pubky.swift +64 -1
  18. package/ios/{pubkymobile.swift → pubkycore.swift} +354 -37
  19. package/lib/commonjs/index.js +45 -0
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/module/index.js +42 -1
  22. package/lib/module/index.js.map +1 -1
  23. package/lib/typescript/commonjs/src/index.d.ts +16 -9
  24. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  25. package/lib/typescript/module/src/index.d.ts +16 -9
  26. package/lib/typescript/module/src/index.d.ts.map +1 -1
  27. package/package.json +12 -7
  28. package/react-native-pubky.podspec +1 -1
  29. package/src/index.tsx +62 -9
  30. package/android/src/main/java/uniffi/pubkymobile/pubkymobile.kt +0 -862
  31. package/android/src/main/jniLibs/arm64-v8a/libpubkymobile.so +0 -0
  32. package/android/src/main/jniLibs/armeabi-v7a/libpubkymobile.so +0 -0
  33. package/android/src/main/jniLibs/x86/libpubkymobile.so +0 -0
  34. package/android/src/main/jniLibs/x86_64/libpubkymobile.so +0 -0
  35. package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/Headers/mobileFFI.h +0 -188
  36. package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/Headers/pubkymobileFFI.h +0 -264
  37. package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/libmobile.a +0 -0
  38. package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/Headers/mobileFFI.h +0 -188
  39. package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/Headers/pubkymobileFFI.h +0 -264
  40. package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/libmobile.a +0 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # react-native-pubky
2
2
 
3
- React Native implementation of [pubky](https://github.com/pubky/pubky)
3
+ React Native implementation of [pubky-core](https://github.com/pubky/pubky-core)
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,20 +18,17 @@ npm install @synonymdev/react-native-pubky
18
18
  - [x] [resolveHttps](#resolveHttps): Resolve HTTPS records.
19
19
  - [x] [signUp](#signUp): Sign-up to a homeserver and update Pkarr accordingly.
20
20
  - [x] [signIn](#signIn): Sign-in to a homeserver.
21
+ - [x] [session](#session): Check the current session for a given Pubky in its homeserver.
21
22
  - [x] [signOut](#signOut): Sign-out from a homeserver.
22
23
  - [x] [put](#put): Upload a small payload to a given path.
23
24
  - [x] [get](#get): Download a small payload from a given path relative to a pubky author.
24
25
  - [x] [list](#list): Returns a list of Pubky URLs of the files in the path of the `url` provided.
26
+ - [x] [delete](#delete): Delete a file at a path relative to a pubky author.
25
27
  - [x] [generateSecretKey](#generateSecretKey): Generate a secret key.
26
28
  - [x] [getPublicKeyFromSecretKey](#getPublicKeyFromSecretKey): Get the public key string and uri from a secret key.
27
29
  - [x] [create_recovery_file](#createRecoveryFile): Create a recovery file.
28
30
  - [x] [decrypt_recovery_file](#decryptRecoveryFile): Decrypt a recovery file.
29
31
 
30
- ### Methods to be Implemented
31
- - [ ] getProfile: Retrieve the profile of a user.
32
- - [ ] editProfile: Submit changes to the specified profile.
33
-
34
-
35
32
  ## Usage
36
33
  ### <a name="auth"></a>Auth
37
34
  ```js
@@ -161,6 +158,20 @@ if (listRes.isErr()) {
161
158
  console.log(listRes.value);
162
159
  ```
163
160
 
161
+ ### <a name="deleteFile"></a>deleteFile
162
+ ```js
163
+ import { deleteFile } from '@synonymdev/react-native-pubky';
164
+
165
+ const deleteFileRes = await deleteFile(
166
+ 'pubky://z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty/pub/' // URL
167
+ );
168
+ if (deleteFileRes.isErr()) {
169
+ console.log(deleteFileRes.error.message);
170
+ return;
171
+ }
172
+ console.log(deleteFileRes.value);
173
+ ```
174
+
164
175
  ### <a name="generateSecretKey"></a>generateSecretKey
165
176
  ```js
166
177
  import { generateSecretKey } from '@synonymdev/react-native-pubky';
@@ -214,6 +225,20 @@ if (signInRes.isErr()) {
214
225
  console.log(signInRes.value);
215
226
  ```
216
227
 
228
+ ### <a name="session"></a>sessionRes
229
+ ```js
230
+ import { session } from '@synonymdev/react-native-pubky';
231
+
232
+ const sessionRes = await session(
233
+ 'z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty' // Public Key
234
+ );
235
+ if (sessionRes.isErr()) {
236
+ console.log(sessionRes.error.message);
237
+ return;
238
+ }
239
+ console.log(sessionRes.value);
240
+ ```
241
+
217
242
  ### <a name="signOut"></a>signIn
218
243
  ```js
219
244
  import { signOut } from '@synonymdev/react-native-pubky';
@@ -270,12 +295,30 @@ git clone git@github.com:pubky/react-native-pubky.git && cd react-native-pubky &
270
295
  yarn add path/to/react-native-pubky
271
296
  ```
272
297
 
273
- ## Update Bindings
298
+ ## Run React Native Example App
299
+ 1. Run Homeserver:
300
+ ```sh
301
+ cd rust/pubky/pubky-homeserver && cargo run -- --config=./src/config.toml
302
+ ```
303
+ 2. Run the React Native Example App:
304
+ ```sh
305
+ cd example && yarn install && cd ios && pod install && cd ../ && yarn ios
306
+ ```
307
+
308
+ ## Download Remote Bindings
309
+
310
+ This command will download the current bindings from the [SDK repo](https://github.com/pubky/pubky-core-mobile-sdk):
311
+
312
+ ```sh
313
+ npm run update-remote-bindings
314
+ ```
315
+
316
+ ## Setup Local Bindings
274
317
 
275
- After making changes to any of the Rust files, the bindings will need to be updated. To do this, run the following command:
318
+ This command will download the entire Rust project if it doesn't exist and set up the bindings locally for faster iteration and testing:
276
319
 
277
320
  ```sh
278
- npm run update-bindings
321
+ npm run update-local-bindings
279
322
  ```
280
323
 
281
324
  Finally, ensure that `PubkyModule.kt`, `Pubky.swift`, `Pubky.mm` & `src/index.tsx` are updated accordingly based on the changes made to the Rust files.